From f2af31aceb41a92d1f0c4a31c0f84a9a0a579308 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Thu, 18 May 2017 20:21:58 +0300 Subject: [PATCH] Naming fixes --- .../Tests/TestCaseReplaySettingsOverlay.cs | 26 +++++++ .../Tests/TestCaseSettingsDisplay.cs | 26 ------- .../osu.Desktop.VisualTests.csproj | 2 +- .../UserInterface/SettingsContainer.cs | 68 +++++-------------- osu.Game/Screens/Play/HUDOverlay.cs | 6 +- osu.Game/Screens/Play/Player.cs | 2 +- ...ngsDisplay.cs => ReplaySettingsOverlay.cs} | 4 +- osu.Game/Screens/Play/StandardHUDOverlay.cs | 2 +- osu.Game/osu.Game.csproj | 2 +- 9 files changed, 51 insertions(+), 87 deletions(-) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs rename osu.Game/Screens/Play/Settings/{SettingsDisplay.cs => ReplaySettingsOverlay.cs} (85%) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs new file mode 100644 index 0000000000..a63ded5cf4 --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs @@ -0,0 +1,26 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Testing; +using osu.Game.Screens.Play.Settings; + +namespace osu.Desktop.VisualTests.Tests +{ + internal class TestCaseReplaySettingsOverlay : TestCase + { + public override string Description => @"Settings visible in replay/auto"; + + public override void Reset() + { + base.Reset(); + + Add(new ReplaySettingsOverlay() + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + AutoSizeAxes = Axes.Both, + }); + } + } +} diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSettingsDisplay.cs b/osu.Desktop.VisualTests/Tests/TestCaseSettingsDisplay.cs index 60c4b79e69..e69de29bb2 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSettingsDisplay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSettingsDisplay.cs @@ -1,26 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Graphics; -using osu.Framework.Testing; -using osu.Game.Screens.Play.Settings; - -namespace osu.Desktop.VisualTests.Tests -{ - internal class TestCaseSettingsDisplay : TestCase - { - public override string Description => @"Setting visible in replay/auto"; - - public override void Reset() - { - base.Reset(); - - Add(new SettingsDisplay() - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - AutoSizeAxes = Axes.Both, - }); - } - } -} diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index a9ea68441d..75eff68a63 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -196,7 +196,7 @@ - + diff --git a/osu.Game/Graphics/UserInterface/SettingsContainer.cs b/osu.Game/Graphics/UserInterface/SettingsContainer.cs index 1ce18a4f50..bf5c8cc3d2 100644 --- a/osu.Game/Graphics/UserInterface/SettingsContainer.cs +++ b/osu.Game/Graphics/UserInterface/SettingsContainer.cs @@ -3,7 +3,6 @@ using OpenTK; using OpenTK.Graphics; -using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; @@ -18,9 +17,11 @@ namespace osu.Game.Graphics.UserInterface /// public abstract string Title { get; } - private readonly SettingsDropdown content; + private const float transition_duration = 600; + + private readonly FillFlowContainer content; private readonly SimpleButton button; - private bool contentIsVisible; + private bool buttonIsPressed; protected SettingsContainer() { @@ -76,19 +77,21 @@ namespace osu.Game.Graphics.UserInterface }, } }, - content = new SettingsDropdown + content = new FillFlowContainer { + Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + Padding = new MarginPadding(15), + Spacing = new Vector2(0, 10), } } }, }; - } - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - content.StateChanged += (c, s) => button.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, EasingTypes.OutQuint); + button.TriggerClick(); } public new void Add(Drawable drawable) @@ -98,53 +101,14 @@ namespace osu.Game.Graphics.UserInterface private void triggerContentVisibility() { - contentIsVisible = !contentIsVisible; + buttonIsPressed = !buttonIsPressed; - if (contentIsVisible) + button.FadeColour(buttonIsPressed ? OsuColour.FromHex(@"ffcc22") : Color4.White, 200, EasingTypes.OutQuint); + + if (buttonIsPressed) content.Show(); else content.Hide(); } - - private class SettingsDropdown : OverlayContainer - { - private const float transition_duration = 600; - - private readonly FillFlowContainer content; - - public SettingsDropdown() - { - Children = new Drawable[] - { - content = new FillFlowContainer - { - Direction = FillDirection.Vertical, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - Padding = new MarginPadding(15), - Spacing = new Vector2(0, 10), - } - }; - } - - public new void Add(Drawable drawable) - { - content.Add(drawable); - } - - protected override void PopIn() - { - ResizeTo(new Vector2(1, content.Height), transition_duration, EasingTypes.OutQuint); - FadeIn(transition_duration, EasingTypes.OutQuint); - } - - protected override void PopOut() - { - ResizeTo(new Vector2(1, 0), transition_duration, EasingTypes.OutQuint); - FadeOut(transition_duration); - } - } } } diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 66d8794700..2e7f48b4f5 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -30,7 +30,7 @@ namespace osu.Game.Screens.Play public readonly HealthDisplay HealthDisplay; public readonly SongProgress Progress; public readonly ModDisplay ModDisplay; - public readonly SettingsDisplay SettingsDisplay; + public readonly ReplaySettingsOverlay ReplaySettingsOverlay; private Bindable showKeyCounter; private Bindable showHud; @@ -44,7 +44,7 @@ namespace osu.Game.Screens.Play protected abstract HealthDisplay CreateHealthDisplay(); protected abstract SongProgress CreateProgress(); protected abstract ModDisplay CreateModsContainer(); - protected abstract SettingsDisplay CreateSettingsDisplay(); + protected abstract ReplaySettingsOverlay CreateReplaySettingsOverlay(); protected HUDOverlay() { @@ -63,7 +63,7 @@ namespace osu.Game.Screens.Play HealthDisplay = CreateHealthDisplay(), Progress = CreateProgress(), ModDisplay = CreateModsContainer(), - SettingsDisplay = CreateSettingsDisplay(), + ReplaySettingsOverlay = CreateReplaySettingsOverlay(), } }); } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 44d9455e92..f7a407c8c8 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -208,7 +208,7 @@ namespace osu.Game.Screens.Play hudOverlay.Progress.Objects = HitRenderer.Objects; hudOverlay.Progress.AudioClock = decoupledClock; hudOverlay.Progress.AllowSeeking = HitRenderer.HasReplayLoaded; - hudOverlay.SettingsDisplay.IsVisible = HitRenderer.HasReplayLoaded; + hudOverlay.ReplaySettingsOverlay.IsVisible = HitRenderer.HasReplayLoaded; hudOverlay.Progress.OnSeek = pos => decoupledClock.Seek(pos); hudOverlay.ModDisplay.Current.BindTo(Beatmap.Mods); diff --git a/osu.Game/Screens/Play/Settings/SettingsDisplay.cs b/osu.Game/Screens/Play/Settings/ReplaySettingsOverlay.cs similarity index 85% rename from osu.Game/Screens/Play/Settings/SettingsDisplay.cs rename to osu.Game/Screens/Play/Settings/ReplaySettingsOverlay.cs index 02408e771a..1737010a02 100644 --- a/osu.Game/Screens/Play/Settings/SettingsDisplay.cs +++ b/osu.Game/Screens/Play/Settings/ReplaySettingsOverlay.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics.Containers; namespace osu.Game.Screens.Play.Settings { - public class SettingsDisplay : FillFlowContainer + public class ReplaySettingsOverlay : FillFlowContainer { private bool isVisible; public bool IsVisible @@ -23,7 +23,7 @@ namespace osu.Game.Screens.Play.Settings get { return isVisible; } } - public SettingsDisplay() + public ReplaySettingsOverlay() { Direction = FillDirection.Vertical; Spacing = new Vector2(0, 20); diff --git a/osu.Game/Screens/Play/StandardHUDOverlay.cs b/osu.Game/Screens/Play/StandardHUDOverlay.cs index 21d2bd8e46..1674785b1b 100644 --- a/osu.Game/Screens/Play/StandardHUDOverlay.cs +++ b/osu.Game/Screens/Play/StandardHUDOverlay.cs @@ -72,7 +72,7 @@ namespace osu.Game.Screens.Play Margin = new MarginPadding { Top = 20, Right = 10 }, }; - protected override SettingsDisplay CreateSettingsDisplay() => new SettingsDisplay + protected override ReplaySettingsOverlay CreateReplaySettingsOverlay() => new ReplaySettingsOverlay { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 6fa0917248..8b802392c2 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -236,7 +236,7 @@ - +