2023-06-23 00:37:25 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2021-12-07 17:53:08 +08:00
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
2024-11-13 17:57:51 +08:00
|
|
|
|
using System.ComponentModel;
|
2021-12-07 17:53:08 +08:00
|
|
|
|
using osu.Framework.Extensions;
|
2024-11-13 17:57:51 +08:00
|
|
|
|
using osu.Game.Online.Rooms;
|
2021-12-07 17:53:08 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|
|
|
|
{
|
2023-05-16 15:53:11 +08:00
|
|
|
|
public partial class QueueModePill : OnlinePlayPill
|
2021-12-07 17:53:08 +08:00
|
|
|
|
{
|
2024-11-13 17:57:51 +08:00
|
|
|
|
private readonly Room room;
|
|
|
|
|
|
|
|
|
|
public QueueModePill(Room room)
|
|
|
|
|
{
|
|
|
|
|
this.room = room;
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-07 17:53:08 +08:00
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
2024-11-13 17:57:51 +08:00
|
|
|
|
room.PropertyChanged += onRoomPropertyChanged;
|
|
|
|
|
updateRoomQueueMode();
|
2021-12-07 17:53:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-11-13 17:57:51 +08:00
|
|
|
|
private void onRoomPropertyChanged(object? sender, PropertyChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (e.PropertyName == nameof(Room.QueueMode))
|
|
|
|
|
updateRoomQueueMode();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void updateRoomQueueMode()
|
|
|
|
|
=> TextFlow.Text = room.QueueMode.GetLocalisableDescription();
|
|
|
|
|
|
|
|
|
|
protected override void Dispose(bool isDisposing)
|
2021-12-07 17:53:08 +08:00
|
|
|
|
{
|
2024-11-13 17:57:51 +08:00
|
|
|
|
base.Dispose(isDisposing);
|
|
|
|
|
room.PropertyChanged -= onRoomPropertyChanged;
|
2021-12-07 17:53:08 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|