diff --git a/osu.Game/Screens/Multi/Components/StatusColouredContainer.cs b/osu.Game/Screens/Multi/Components/StatusColouredContainer.cs new file mode 100644 index 0000000000..6d573d0866 --- /dev/null +++ b/osu.Game/Screens/Multi/Components/StatusColouredContainer.cs @@ -0,0 +1,31 @@ +// Copyright (c) ppy Pty Ltd . 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 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); + } + } +} diff --git a/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs b/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs index 8a2b033ac8..afe2b70524 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs @@ -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 status { get; set; } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - status.BindValueChanged(s => this.FadeColour(s.GetAppropriateColour(colours), transition_duration), true); - } - } } }