1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 10:07:52 +08:00

Move StatusColouredContainer into a more public location

This commit is contained in:
smoogipoo 2019-02-07 17:52:40 +09:00
parent 2d61548251
commit 1e0135af6f
2 changed files with 33 additions and 14 deletions

View File

@ -0,0 +1,31 @@
// 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.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Online.Multiplayer;
namespace osu.Game.Screens.Multi.Components
{
public class StatusColouredContainer : Container
{
private readonly double transitionDuration;
[Resolved(typeof(Room), nameof(Room.Status))]
private Bindable<RoomStatus> status { get; set; }
public StatusColouredContainer(double transitionDuration = 100)
{
this.transitionDuration = transitionDuration;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
status.BindValueChanged(s => this.FadeColour(s.GetAppropriateColour(colours), transitionDuration), true);
}
}
}

View File

@ -95,7 +95,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
{
Children = new Drawable[]
{
new StatusColouredContainer
new StatusColouredContainer(transition_duration)
{
RelativeSizeAxes = Axes.Both,
Child = selectionBox
@ -122,7 +122,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.FromHex(@"212121"),
},
new StatusColouredContainer
new StatusColouredContainer(transition_duration)
{
RelativeSizeAxes = Axes.Y,
Width = side_strip_width,
@ -210,17 +210,5 @@ namespace osu.Game.Screens.Multi.Lounge.Components
Current = name;
}
}
private class StatusColouredContainer : Container
{
[Resolved(typeof(Room), nameof(Online.Multiplayer.Room.Status))]
private Bindable<RoomStatus> status { get; set; }
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
status.BindValueChanged(s => this.FadeColour(s.GetAppropriateColour(colours), transition_duration), true);
}
}
}
}