1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-10 22:57:19 +08:00

Do not allow leaving team channels

This commit is contained in:
Bartłomiej Dach 2025-02-24 15:10:20 +01:00
parent e8f7bcb6e6
commit e13aa4a99b
No known key found for this signature in database
2 changed files with 9 additions and 3 deletions

View File

@ -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);

View File

@ -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