1
0
mirror of https://github.com/ppy/osu.git synced 2026-06-01 03:59:58 +08:00

Do not allow leaving team channels

This commit is contained in:
Bartłomiej Dach
2025-02-24 15:10:20 +01:00
Unverified
parent e8f7bcb6e6
commit e13aa4a99b
2 changed files with 9 additions and 3 deletions
@@ -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