2019-02-07 16:52:40 +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;
|
2019-02-21 18:04:31 +08:00
|
|
|
using osu.Framework.Bindables;
|
2019-02-07 16:52:40 +08:00
|
|
|
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;
|
2019-02-07 16:52:40 +08:00
|
|
|
|
2020-12-25 23:50:00 +08:00
|
|
|
namespace osu.Game.Screens.OnlinePlay.Components
|
2019-02-07 16:52:40 +08:00
|
|
|
{
|
|
|
|
public class StatusColouredContainer : Container
|
|
|
|
{
|
|
|
|
private readonly double transitionDuration;
|
|
|
|
|
|
|
|
[Resolved(typeof(Room), nameof(Room.Status))]
|
|
|
|
private Bindable<RoomStatus> status { get; set; }
|
|
|
|
|
2020-07-10 18:37:27 +08:00
|
|
|
[Resolved(typeof(Room), nameof(Room.Category))]
|
|
|
|
private Bindable<RoomCategory> category { get; set; }
|
|
|
|
|
2019-02-07 16:52:40 +08:00
|
|
|
public StatusColouredContainer(double transitionDuration = 100)
|
|
|
|
{
|
|
|
|
this.transitionDuration = transitionDuration;
|
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(OsuColour colours)
|
|
|
|
{
|
2020-07-10 18:37:27 +08:00
|
|
|
status.BindValueChanged(s =>
|
|
|
|
{
|
2022-05-27 22:40:15 +08:00
|
|
|
this.FadeColour(colours.ForRoomCategory(category.Value) ?? s.NewValue.GetAppropriateColour(colours), transitionDuration);
|
2020-07-10 18:37:27 +08:00
|
|
|
}, true);
|
2019-02-07 16:52:40 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|