mirror of
https://github.com/ppy/osu.git
synced 2025-03-11 02:17:19 +08:00
Do not allow leaving team channels
This commit is contained in:
parent
e8f7bcb6e6
commit
e13aa4a99b
@ -114,9 +114,13 @@ namespace osu.Game.Overlays.Chat.ChannelList
|
||||
if (channelMap.ContainsKey(channel))
|
||||
return;
|
||||
|
||||
ChannelListItem item = new ChannelListItem(channel);
|
||||
ChannelListItem item = new ChannelListItem(channel)
|
||||
{
|
||||
CanLeave = channel.Type != ChannelType.Team
|
||||
};
|
||||
item.OnRequestSelect += chan => OnRequestSelect?.Invoke(chan);
|
||||
item.OnRequestLeave += chan => OnRequestLeave?.Invoke(chan);
|
||||
if (item.CanLeave)
|
||||
item.OnRequestLeave += chan => OnRequestLeave?.Invoke(chan);
|
||||
|
||||
ChannelGroup group = getGroupFromChannel(channel);
|
||||
channelMap.Add(channel, item);
|
||||
|
@ -24,6 +24,8 @@ namespace osu.Game.Overlays.Chat.ChannelList
|
||||
public partial class ChannelListItem : OsuClickableContainer, IFilterable
|
||||
{
|
||||
public event Action<Channel>? OnRequestSelect;
|
||||
|
||||
public bool CanLeave { get; init; } = true;
|
||||
public event Action<Channel>? OnRequestLeave;
|
||||
|
||||
public readonly Channel Channel;
|
||||
@ -160,7 +162,7 @@ namespace osu.Game.Overlays.Chat.ChannelList
|
||||
|
||||
private ChannelListItemCloseButton? createCloseButton()
|
||||
{
|
||||
if (isSelector)
|
||||
if (isSelector || !CanLeave)
|
||||
return null;
|
||||
|
||||
return new ChannelListItemCloseButton
|
||||
|
Loading…
x
Reference in New Issue
Block a user