mirror of
https://github.com/osukey/osukey.git
synced 2025-08-02 22:26:41 +09:00
Preserve current channel if ChatOverlay is being loaded in
This commit is contained in:
@ -59,15 +59,16 @@ namespace osu.Game.Overlays.Chat.Tabs
|
||||
|
||||
/// <summary>
|
||||
/// Adds a channel to the ChannelTabControl.
|
||||
/// The first channel added will automaticly selected.
|
||||
/// The first channel added will automaticly selected if <paramref name="setChannel"/> is true.
|
||||
/// </summary>
|
||||
/// <param name="channel">The channel that is going to be added.</param>
|
||||
public void AddChannel(Channel channel)
|
||||
/// <param name="setChannel">If the current channel should be changed if none was selected before</param>
|
||||
public void AddChannel(Channel channel, bool setChannel = true)
|
||||
{
|
||||
if (!Items.Contains(channel))
|
||||
AddItem(channel);
|
||||
|
||||
if (Current.Value == null)
|
||||
if (Current.Value == null && setChannel)
|
||||
Current.Value = channel;
|
||||
}
|
||||
|
||||
|
@ -221,8 +221,14 @@ namespace osu.Game.Overlays
|
||||
// TODO: consider scheduling bindable callbacks to not perform when overlay is not present.
|
||||
channelManager.JoinedChannels.ItemsAdded += onChannelAddedToJoinedChannels;
|
||||
channelManager.JoinedChannels.ItemsRemoved += onChannelRemovedFromJoinedChannels;
|
||||
|
||||
bool channelSelected = channelManager.CurrentChannel.Value != null;
|
||||
|
||||
foreach (Channel channel in channelManager.JoinedChannels)
|
||||
ChannelTabControl.AddChannel(channel);
|
||||
ChannelTabControl.AddChannel(channel, !channelSelected);
|
||||
|
||||
if (channelSelected)
|
||||
ChannelTabControl.Current.Value = channelManager.CurrentChannel.Value;
|
||||
|
||||
channelManager.AvailableChannels.ItemsAdded += availableChannelsChanged;
|
||||
channelManager.AvailableChannels.ItemsRemoved += availableChannelsChanged;
|
||||
|
Reference in New Issue
Block a user