2021-07-12 14:11:07 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics;
|
2023-05-25 18:55:11 +08:00
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2021-07-12 14:11:07 +08:00
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Online.Rooms;
|
|
|
|
|
|
2021-07-13 15:02:18 +08:00
|
|
|
|
namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
2021-07-12 14:11:07 +08:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// A pill that displays the room's current status.
|
|
|
|
|
/// </summary>
|
2023-05-16 15:53:11 +08:00
|
|
|
|
public partial class RoomStatusPill : OnlinePlayPill
|
2021-07-12 14:11:07 +08:00
|
|
|
|
{
|
|
|
|
|
[Resolved]
|
|
|
|
|
private OsuColour colours { get; set; } = null!;
|
|
|
|
|
|
2023-05-25 18:55:11 +08:00
|
|
|
|
protected override FontUsage Font => base.Font.With(weight: FontWeight.SemiBold);
|
|
|
|
|
|
2021-07-12 14:11:07 +08:00
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
|
|
EndDate.BindValueChanged(_ => updateDisplay());
|
|
|
|
|
Status.BindValueChanged(_ => updateDisplay(), true);
|
2021-08-12 08:13:10 +08:00
|
|
|
|
|
|
|
|
|
FinishTransforms(true);
|
2023-05-16 16:22:52 +08:00
|
|
|
|
|
|
|
|
|
TextFlow.Colour = Colour4.Black;
|
2023-05-17 15:13:54 +08:00
|
|
|
|
Pill.Background.Alpha = 1;
|
2021-07-12 14:11:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void updateDisplay()
|
|
|
|
|
{
|
2024-05-03 17:10:59 +08:00
|
|
|
|
RoomStatus status = Status.Value;
|
2021-07-12 14:11:07 +08:00
|
|
|
|
|
2023-05-16 16:06:48 +08:00
|
|
|
|
Pill.Background.FadeColour(status.GetAppropriateColour(colours), 100);
|
2023-05-17 15:13:54 +08:00
|
|
|
|
TextFlow.Text = status.Message;
|
2021-07-12 14:11:07 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|