diff --git a/osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs index 823d00df1b..2f1af8a241 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs @@ -48,7 +48,7 @@ namespace osu.Desktop.VisualTests.Tests })); } - private class ExampleContainer : SettingsContainer + private class ExampleContainer : SettingsDropdownContainer { public override string Title => @"EXAMPLE"; } diff --git a/osu.Game/Graphics/UserInterface/SettingsContainer.cs b/osu.Game/Graphics/UserInterface/SettingsDropdownContainer.cs similarity index 80% rename from osu.Game/Graphics/UserInterface/SettingsContainer.cs rename to osu.Game/Graphics/UserInterface/SettingsDropdownContainer.cs index 45ba2f8677..38344cc4d7 100644 --- a/osu.Game/Graphics/UserInterface/SettingsContainer.cs +++ b/osu.Game/Graphics/UserInterface/SettingsDropdownContainer.cs @@ -3,6 +3,7 @@ using OpenTK; using OpenTK.Graphics; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; @@ -10,7 +11,7 @@ using osu.Game.Graphics.Sprites; namespace osu.Game.Graphics.UserInterface { - public abstract class SettingsContainer : Container + public abstract class SettingsDropdownContainer : Container { /// /// The title of this container. @@ -18,16 +19,19 @@ namespace osu.Game.Graphics.UserInterface public abstract string Title { get; } private const float transition_duration = 600; - private const int container_width = 250; + private const int container_width = 270; private const int border_thickness = 2; private const int header_height = 30; private const int corner_radius = 5; - private readonly FillFlowContainer content; - private readonly SimpleButton button; + private FillFlowContainer content; + private SimpleButton button; private bool buttonIsPressed; - protected SettingsContainer() + private Color4 buttonPressedColour; + + [BackgroundDependencyLoader] + private void load(OsuColour colours) { AutoSizeAxes = Axes.Y; Width = container_width; @@ -54,6 +58,7 @@ namespace osu.Game.Graphics.UserInterface { new Container { + Name = @"Header", RelativeSizeAxes = Axes.X, Height = header_height, Origin = Anchor.TopCentre, @@ -76,13 +81,15 @@ namespace osu.Game.Graphics.UserInterface Anchor = Anchor.CentreRight, Position = new Vector2(-15,0), Icon = FontAwesome.fa_bars, - Scale = new Vector2(0.7f), - Action = () => triggerContentVisibility(), + Scale = new Vector2(0.75f), + Colour = buttonPressedColour = colours.Yellow, + Action = triggerContentVisibility, }, } }, content = new FillFlowContainer { + Name = @"Content", Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, @@ -91,13 +98,11 @@ namespace osu.Game.Graphics.UserInterface Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, Padding = new MarginPadding(15), - Spacing = new Vector2(0, 10), + Spacing = new Vector2(0, 15), } } }, }; - - button.TriggerClick(); } public new void Add(Drawable drawable) @@ -107,10 +112,6 @@ namespace osu.Game.Graphics.UserInterface private void triggerContentVisibility() { - buttonIsPressed = !buttonIsPressed; - - button.FadeColour(buttonIsPressed ? OsuColour.FromHex(@"ffcc22") : Color4.White, 200, EasingTypes.OutQuint); - if (buttonIsPressed) { content.ClearTransforms(); @@ -121,6 +122,10 @@ namespace osu.Game.Graphics.UserInterface content.AutoSizeAxes = Axes.None; content.ResizeHeightTo(0, transition_duration, EasingTypes.OutQuint); } + + button.FadeColour(buttonIsPressed ? buttonPressedColour : Color4.White, 200, EasingTypes.OutQuint); + + buttonIsPressed = !buttonIsPressed; } } } diff --git a/osu.Game/Screens/Play/Settings/CollectionSettings.cs b/osu.Game/Screens/Play/Settings/CollectionSettings.cs index 094395e52f..752ed29e77 100644 --- a/osu.Game/Screens/Play/Settings/CollectionSettings.cs +++ b/osu.Game/Screens/Play/Settings/CollectionSettings.cs @@ -10,7 +10,7 @@ using osu.Game.Graphics.UserInterface; namespace osu.Game.Screens.Play.Settings { - public class CollectionSettings : SettingsContainer + public class CollectionSettings : SettingsDropdownContainer { public override string Title => @"COLLECTIONS"; diff --git a/osu.Game/Screens/Play/Settings/DiscussionSettings.cs b/osu.Game/Screens/Play/Settings/DiscussionSettings.cs index cf7ccb6063..ba38ed9bec 100644 --- a/osu.Game/Screens/Play/Settings/DiscussionSettings.cs +++ b/osu.Game/Screens/Play/Settings/DiscussionSettings.cs @@ -9,7 +9,7 @@ using osu.Game.Overlays.Settings; namespace osu.Game.Screens.Play.Settings { - public class DiscussionSettings : SettingsContainer + public class DiscussionSettings : SettingsDropdownContainer { public override string Title => @"DISCUSSIONS"; diff --git a/osu.Game/Screens/Play/Settings/PlaybackSettings.cs b/osu.Game/Screens/Play/Settings/PlaybackSettings.cs index 0d012be960..f019eed206 100644 --- a/osu.Game/Screens/Play/Settings/PlaybackSettings.cs +++ b/osu.Game/Screens/Play/Settings/PlaybackSettings.cs @@ -8,7 +8,7 @@ using osu.Game.Graphics.UserInterface; namespace osu.Game.Screens.Play.Settings { - public class PlaybackSettings : SettingsContainer + public class PlaybackSettings : SettingsDropdownContainer { public override string Title => @"PLAYBACK"; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 82a67aa890..3dc7c0dc9f 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -239,7 +239,7 @@ - +