1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-22 01:23:24 +08:00

Add OnRequestLeave

This commit is contained in:
DrabWeb 2017-05-26 03:56:10 -03:00
parent d632435a34
commit 4c551270e9
2 changed files with 4 additions and 1 deletions

View File

@ -37,6 +37,7 @@ namespace osu.Game.Overlays.Chat
} }
public Action<Channel> OnRequestJoin; public Action<Channel> OnRequestJoin;
public Action<Channel> OnRequestLeave;
private Channel channel; private Channel channel;
public Channel Channel public Channel Channel
@ -60,7 +61,7 @@ namespace osu.Game.Overlays.Chat
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
Action = () => { if (!Channel.Joined) OnRequestJoin?.Invoke(Channel); }; Action = () => { (Channel.Joined ? OnRequestLeave : OnRequestJoin)?.Invoke(Channel); };
Children = new Drawable[] Children = new Drawable[]
{ {

View File

@ -29,6 +29,7 @@ namespace osu.Game.Overlays.Chat
private readonly SearchContainer<ChannelSection> sectionsFlow; private readonly SearchContainer<ChannelSection> sectionsFlow;
public Action<Channel> OnRequestJoin; public Action<Channel> OnRequestJoin;
public Action<Channel> OnRequestLeave;
public IEnumerable<ChannelSection> Sections public IEnumerable<ChannelSection> Sections
{ {
@ -41,6 +42,7 @@ namespace osu.Game.Overlays.Chat
foreach (ChannelListItem c in s.ChannelFlow.Children) foreach (ChannelListItem c in s.ChannelFlow.Children)
{ {
c.OnRequestJoin = channel => { OnRequestJoin?.Invoke(channel); }; c.OnRequestJoin = channel => { OnRequestJoin?.Invoke(channel); };
c.OnRequestLeave = channel => { OnRequestLeave?.Invoke(channel); };
} }
} }
} }