1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 02:12:57 +08:00
osu-lazer/osu.Game/Screens/OnlinePlay/Components/StatusColouredContainer.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
1.2 KiB
C#
Raw Normal View History

// 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;
2019-02-21 18:04:31 +08:00
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
2020-12-25 12:38:11 +08:00
using osu.Game.Online.Rooms;
namespace osu.Game.Screens.OnlinePlay.Components
{
public partial class StatusColouredContainer : Container
{
private readonly double transitionDuration;
[Resolved(typeof(Room), nameof(Room.Status))]
2024-11-13 17:27:32 +08:00
private Bindable<RoomStatus> status { get; set; } = null!;
2024-11-13 17:27:32 +08:00
private readonly Room room;
2024-11-13 17:27:32 +08:00
public StatusColouredContainer(Room room, double transitionDuration = 100)
{
2024-11-13 17:27:32 +08:00
this.room = room;
this.transitionDuration = transitionDuration;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
status.BindValueChanged(s =>
{
2024-11-13 17:27:32 +08:00
this.FadeColour(colours.ForRoomCategory(room.Category) ?? s.NewValue.GetAppropriateColour(colours), transitionDuration);
}, true);
}
}
}