1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 22:37:26 +08:00
osu-lazer/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomStatusPill.cs

44 lines
1.2 KiB
C#
Raw Normal View History

2023-06-23 00:37:25 +08:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
2021-07-12 14:11:07 +08:00
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
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>
public partial class RoomStatusPill : OnlinePlayPill
2021-07-12 14:11:07 +08:00
{
[Resolved]
2023-06-23 00:37:25 +08:00
private OsuColour colours { get; set; } = null!;
2021-07-12 14:11:07 +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;
Pill.Background.Alpha = 1;
2021-07-12 14:11:07 +08:00
}
private void updateDisplay()
{
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);
TextFlow.Text = status.Message;
2021-07-12 14:11:07 +08:00
}
}
}