Rename the currentChatChanged to currentChannelContainer, move drawing specific part into from chatoverlay to ChannelSelectionOverlay

This commit is contained in:
miterosan
2018-07-09 20:13:34 +02:00
parent 0c62726fd7
commit f22f62ef40
2 changed files with 39 additions and 41 deletions

View File

@ -35,23 +35,6 @@ namespace osu.Game.Overlays.Chat.Selection
public Action<Channel> OnRequestJoin;
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()
{
RelativeSizeAxes = Axes.X;
@ -140,6 +123,27 @@ namespace osu.Game.Overlays.Chat.Selection
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]
private void load(OsuColour colours)
{