mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 17:37:23 +09:00
Rename the currentChatChanged to currentChannelContainer, move drawing specific part into from chatoverlay to ChannelSelectionOverlay
This commit is contained in:
parent
0c62726fd7
commit
f22f62ef40
@ -35,23 +35,6 @@ namespace osu.Game.Overlays.Chat.Selection
|
|||||||
public Action<Channel> OnRequestJoin;
|
public Action<Channel> OnRequestJoin;
|
||||||
public Action<Channel> OnRequestLeave;
|
public Action<Channel> OnRequestLeave;
|
||||||
|
|
||||||
public IEnumerable<ChannelSection> Sections
|
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
sectionsFlow.ChildrenEnumerable = value;
|
|
||||||
|
|
||||||
foreach (ChannelSection s in sectionsFlow.Children)
|
|
||||||
{
|
|
||||||
foreach (ChannelListItem c in s.ChannelFlow.Children)
|
|
||||||
{
|
|
||||||
c.OnRequestJoin = channel => { OnRequestJoin?.Invoke(channel); };
|
|
||||||
c.OnRequestLeave = channel => { OnRequestLeave?.Invoke(channel); };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ChannelSelectionOverlay()
|
public ChannelSelectionOverlay()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
@ -140,6 +123,27 @@ namespace osu.Game.Overlays.Chat.Selection
|
|||||||
search.Current.ValueChanged += newValue => sectionsFlow.SearchTerm = newValue;
|
search.Current.ValueChanged += newValue => sectionsFlow.SearchTerm = newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UpdateAvailableChannels(IEnumerable<Channel> channels)
|
||||||
|
{
|
||||||
|
sectionsFlow.ChildrenEnumerable = new[]
|
||||||
|
{
|
||||||
|
new ChannelSection
|
||||||
|
{
|
||||||
|
Header = "All Channels",
|
||||||
|
Channels = channels,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (ChannelSection s in sectionsFlow.Children)
|
||||||
|
{
|
||||||
|
foreach (ChannelListItem c in s.ChannelFlow.Children)
|
||||||
|
{
|
||||||
|
c.OnRequestJoin = channel => { OnRequestJoin?.Invoke(channel); };
|
||||||
|
c.OnRequestLeave = channel => { OnRequestLeave?.Invoke(channel); };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private ChannelManager channelManager;
|
private ChannelManager channelManager;
|
||||||
|
|
||||||
private readonly Container<DrawableChannel> currentChatContainer;
|
private readonly Container<DrawableChannel> currentChannelContainer;
|
||||||
private readonly List<DrawableChannel> loadedChannels = new List<DrawableChannel>();
|
private readonly List<DrawableChannel> loadedChannels = new List<DrawableChannel>();
|
||||||
|
|
||||||
private readonly LoadingAnimation loading;
|
private readonly LoadingAnimation loading;
|
||||||
@ -102,7 +102,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
},
|
||||||
currentChatContainer = new Container<DrawableChannel>
|
currentChannelContainer = new Container<DrawableChannel>
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding
|
Padding = new MarginPadding
|
||||||
@ -188,14 +188,8 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private void availableChannelsChanged(object sender, NotifyCollectionChangedEventArgs args)
|
private void availableChannelsChanged(object sender, NotifyCollectionChangedEventArgs args)
|
||||||
{
|
{
|
||||||
channelSelection.Sections = new[]
|
channelSelection.UpdateAvailableChannels(channelManager.);
|
||||||
{
|
|
||||||
new ChannelSection
|
|
||||||
{
|
|
||||||
Header = "All Channels",
|
|
||||||
Channels = channelManager.AvailableChannels,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void joinedChannelsChanged(object sender, NotifyCollectionChangedEventArgs args)
|
private void joinedChannelsChanged(object sender, NotifyCollectionChangedEventArgs args)
|
||||||
@ -220,42 +214,42 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void currentChatChanged(Channel chat)
|
private void currentChatChanged(Channel channel)
|
||||||
{
|
{
|
||||||
if (chat == null)
|
if (channel == null)
|
||||||
{
|
{
|
||||||
textbox.Current.Disabled = true;
|
textbox.Current.Disabled = true;
|
||||||
currentChatContainer.Clear(false);
|
currentChannelContainer.Clear(false);
|
||||||
chatTabControl.Current.Value = null;
|
chatTabControl.Current.Value = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
textbox.Current.Disabled = chat.ReadOnly;
|
textbox.Current.Disabled = channel.ReadOnly;
|
||||||
|
|
||||||
if (chatTabControl.Current.Value != chat)
|
if (chatTabControl.Current.Value != channel)
|
||||||
Scheduler.Add(() => chatTabControl.Current.Value = chat);
|
Scheduler.Add(() => chatTabControl.Current.Value = channel);
|
||||||
|
|
||||||
var loaded = loadedChannels.Find(d => d.Channel == chat);
|
var loaded = loadedChannels.Find(d => d.Channel == channel);
|
||||||
if (loaded == null)
|
if (loaded == null)
|
||||||
{
|
{
|
||||||
currentChatContainer.FadeOut(500, Easing.OutQuint);
|
currentChannelContainer.FadeOut(500, Easing.OutQuint);
|
||||||
loading.Show();
|
loading.Show();
|
||||||
|
|
||||||
loaded = new DrawableChannel(chat);
|
loaded = new DrawableChannel(channel);
|
||||||
loadedChannels.Add(loaded);
|
loadedChannels.Add(loaded);
|
||||||
LoadComponentAsync(loaded, l =>
|
LoadComponentAsync(loaded, l =>
|
||||||
{
|
{
|
||||||
loading.Hide();
|
loading.Hide();
|
||||||
|
|
||||||
currentChatContainer.Clear(false);
|
currentChannelContainer.Clear(false);
|
||||||
currentChatContainer.Add(loaded);
|
currentChannelContainer.Add(loaded);
|
||||||
currentChatContainer.FadeIn(500, Easing.OutQuint);
|
currentChannelContainer.FadeIn(500, Easing.OutQuint);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
currentChatContainer.Clear(false);
|
currentChannelContainer.Clear(false);
|
||||||
currentChatContainer.Add(loaded);
|
currentChannelContainer.Add(loaded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user