mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 16:13:57 +09:00
Add login placeholder for chat overlay
This commit is contained in:
@ -24,6 +24,7 @@ using osu.Game.Overlays.Chat.Tabs;
|
|||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Game.Online;
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
@ -118,40 +119,47 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
},
|
||||||
currentChannelContainer = new Container<DrawableChannel>
|
new OnlineViewContainer("Sign in to chat")
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding
|
|
||||||
{
|
|
||||||
Bottom = textbox_height
|
|
||||||
},
|
|
||||||
},
|
|
||||||
new Container
|
|
||||||
{
|
|
||||||
Anchor = Anchor.BottomLeft,
|
|
||||||
Origin = Anchor.BottomLeft,
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
Height = textbox_height,
|
|
||||||
Padding = new MarginPadding
|
|
||||||
{
|
|
||||||
Top = padding * 2,
|
|
||||||
Bottom = padding * 2,
|
|
||||||
Left = ChatLine.LEFT_PADDING + padding * 2,
|
|
||||||
Right = padding * 2,
|
|
||||||
},
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
textbox = new FocusedTextBox
|
currentChannelContainer = new Container<DrawableChannel>
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Height = 1,
|
Padding = new MarginPadding
|
||||||
PlaceholderText = "type your message",
|
{
|
||||||
ReleaseFocusOnCommit = false,
|
Bottom = textbox_height
|
||||||
HoldFocus = true,
|
},
|
||||||
}
|
},
|
||||||
}
|
new Container
|
||||||
},
|
{
|
||||||
loading = new LoadingSpinner(),
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = textbox_height,
|
||||||
|
Padding = new MarginPadding
|
||||||
|
{
|
||||||
|
Top = padding * 2,
|
||||||
|
Bottom = padding * 2,
|
||||||
|
Left = ChatLine.LEFT_PADDING + padding * 2,
|
||||||
|
Right = padding * 2,
|
||||||
|
},
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
textbox = new FocusedTextBox
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Height = 1,
|
||||||
|
PlaceholderText = "type your message",
|
||||||
|
ReleaseFocusOnCommit = false,
|
||||||
|
HoldFocus = true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loading = new LoadingSpinner(),
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
tabsArea = new TabsArea
|
tabsArea = new TabsArea
|
||||||
@ -184,9 +192,7 @@ namespace osu.Game.Overlays
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
textbox.OnCommit += postMessage;
|
textbox.OnCommit += postMessage;
|
||||||
|
|
||||||
ChannelTabControl.Current.ValueChanged += current => channelManager.CurrentChannel.Value = current.NewValue;
|
ChannelTabControl.Current.ValueChanged += current => channelManager.CurrentChannel.Value = current.NewValue;
|
||||||
ChannelTabControl.ChannelSelectorActive.ValueChanged += active => ChannelSelectionOverlay.State.Value = active.NewValue ? Visibility.Visible : Visibility.Hidden;
|
ChannelTabControl.ChannelSelectorActive.ValueChanged += active => ChannelSelectionOverlay.State.Value = active.NewValue ? Visibility.Visible : Visibility.Hidden;
|
||||||
ChannelSelectionOverlay.State.ValueChanged += state =>
|
ChannelSelectionOverlay.State.ValueChanged += state =>
|
||||||
@ -203,10 +209,8 @@ namespace osu.Game.Overlays
|
|||||||
else
|
else
|
||||||
textbox.HoldFocus = true;
|
textbox.HoldFocus = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
ChannelSelectionOverlay.OnRequestJoin = channel => channelManager.JoinChannel(channel);
|
ChannelSelectionOverlay.OnRequestJoin = channel => channelManager.JoinChannel(channel);
|
||||||
ChannelSelectionOverlay.OnRequestLeave = channelManager.LeaveChannel;
|
ChannelSelectionOverlay.OnRequestLeave = channelManager.LeaveChannel;
|
||||||
|
|
||||||
ChatHeight = config.GetBindable<float>(OsuSetting.ChatDisplayHeight);
|
ChatHeight = config.GetBindable<float>(OsuSetting.ChatDisplayHeight);
|
||||||
ChatHeight.BindValueChanged(height =>
|
ChatHeight.BindValueChanged(height =>
|
||||||
{
|
{
|
||||||
@ -214,9 +218,7 @@ namespace osu.Game.Overlays
|
|||||||
channelSelectionContainer.Height = 1f - height.NewValue;
|
channelSelectionContainer.Height = 1f - height.NewValue;
|
||||||
tabBackground.FadeTo(height.NewValue == 1f ? 1f : 0.8f, 200);
|
tabBackground.FadeTo(height.NewValue == 1f ? 1f : 0.8f, 200);
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
chatBackground.Colour = colours.ChatBlue;
|
chatBackground.Colour = colours.ChatBlue;
|
||||||
|
|
||||||
loading.Show();
|
loading.Show();
|
||||||
|
|
||||||
// This is a relatively expensive (and blocking) operation.
|
// This is a relatively expensive (and blocking) operation.
|
||||||
@ -226,13 +228,10 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
// TODO: consider scheduling bindable callbacks to not perform when overlay is not present.
|
// TODO: consider scheduling bindable callbacks to not perform when overlay is not present.
|
||||||
channelManager.JoinedChannels.CollectionChanged += joinedChannelsChanged;
|
channelManager.JoinedChannels.CollectionChanged += joinedChannelsChanged;
|
||||||
|
|
||||||
foreach (Channel channel in channelManager.JoinedChannels)
|
foreach (Channel channel in channelManager.JoinedChannels)
|
||||||
ChannelTabControl.AddChannel(channel);
|
ChannelTabControl.AddChannel(channel);
|
||||||
|
|
||||||
channelManager.AvailableChannels.CollectionChanged += availableChannelsChanged;
|
channelManager.AvailableChannels.CollectionChanged += availableChannelsChanged;
|
||||||
availableChannelsChanged(null, null);
|
availableChannelsChanged(null, null);
|
||||||
|
|
||||||
currentChannel = channelManager.CurrentChannel.GetBoundCopy();
|
currentChannel = channelManager.CurrentChannel.GetBoundCopy();
|
||||||
currentChannel.BindValueChanged(currentChannelChanged, true);
|
currentChannel.BindValueChanged(currentChannelChanged, true);
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user