From 08219ccb4278b588f2ac738d09d8f68f1477a500 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 29 May 2017 19:00:29 +0300 Subject: [PATCH] Applied suggested changes --- .../Tests/TestCaseReplaySettingsOverlay.cs | 1 - .../SettingsDropdownContainer.cs | 15 ++++----- .../Graphics/UserInterface/SimpleButton.cs | 12 +++---- osu.Game/Screens/Play/HUDOverlay.cs | 5 +++ osu.Game/Screens/Play/Player.cs | 1 - .../Play/ReplaySettings/CollectionSettings.cs | 19 ++++++----- .../Play/ReplaySettings/DiscussionSettings.cs | 25 ++++++++------- .../Play/ReplaySettings/PlaybackSettings.cs | 12 ++++--- .../ReplaySettings/ReplaySettingsOverlay.cs | 32 ++----------------- 9 files changed, 52 insertions(+), 70 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs index 4b0c4b8b76..81a1633763 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs @@ -21,7 +21,6 @@ namespace osu.Desktop.VisualTests.Tests Add(new ReplaySettingsOverlay() { - IsAvaliable = true, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, }); diff --git a/osu.Game/Graphics/UserInterface/SettingsDropdownContainer.cs b/osu.Game/Graphics/UserInterface/SettingsDropdownContainer.cs index 3e7f61b60c..ccfab53100 100644 --- a/osu.Game/Graphics/UserInterface/SettingsDropdownContainer.cs +++ b/osu.Game/Graphics/UserInterface/SettingsDropdownContainer.cs @@ -40,7 +40,7 @@ namespace osu.Game.Graphics.UserInterface BorderColour = Color4.Black; BorderThickness = border_thickness; - Children = new Drawable[] + InternalChildren = new Drawable[] { new Box { @@ -59,10 +59,10 @@ namespace osu.Game.Graphics.UserInterface new Container { Name = @"Header", - RelativeSizeAxes = Axes.X, - Height = header_height, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, + RelativeSizeAxes = Axes.X, + Height = header_height, Children = new Drawable[] { @@ -90,13 +90,13 @@ namespace osu.Game.Graphics.UserInterface content = new FillFlowContainer { Name = @"Content", + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.X, AutoSizeDuration = transition_duration, AutoSizeEasing = EasingTypes.OutQuint, AutoSizeAxes = Axes.Y, - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, Padding = new MarginPadding(15), Spacing = new Vector2(0, 15), } @@ -105,10 +105,7 @@ namespace osu.Game.Graphics.UserInterface }; } - public new void Add(Drawable drawable) - { - content.Add(drawable); - } + protected override Container Content => content; private void triggerContentVisibility() { diff --git a/osu.Game/Graphics/UserInterface/SimpleButton.cs b/osu.Game/Graphics/UserInterface/SimpleButton.cs index c1c87dda26..e593f7fc05 100644 --- a/osu.Game/Graphics/UserInterface/SimpleButton.cs +++ b/osu.Game/Graphics/UserInterface/SimpleButton.cs @@ -44,12 +44,12 @@ namespace osu.Game.Graphics.UserInterface { content = new Container { - Size = new Vector2(button_size), - CornerRadius = 5, - Masking = true, - Origin = Anchor.Centre, Anchor = Anchor.Centre, + Size = new Vector2 (button_size), + + CornerRadius = 5, + Masking = true, EdgeEffect = new EdgeEffect { Colour = Color4.Black.Opacity(0.04f), @@ -65,9 +65,9 @@ namespace osu.Game.Graphics.UserInterface }, icon = new TextAwesome { - TextSize = 18, Origin = Anchor.Centre, - Anchor = Anchor.Centre + Anchor = Anchor.Centre, + TextSize = 18, } } } diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 4f2110ad52..4610cd2d6a 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -99,8 +99,13 @@ namespace osu.Game.Screens.Play // in the case a replay isn't loaded, we want some elements to only appear briefly. if (!hitRenderer.HasReplayLoaded) + { + ReplaySettingsOverlay.Hide(); + ReplaySettingsOverlay.AlwaysPresent = false; + using (ModDisplay.BeginDelayedSequence(2000)) ModDisplay.FadeOut(200); + } } protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index a1f1689fba..707d026e2b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -202,7 +202,6 @@ namespace osu.Game.Screens.Play hudOverlay.Progress.Objects = HitRenderer.Objects; hudOverlay.Progress.AudioClock = decoupledClock; hudOverlay.Progress.AllowSeeking = HitRenderer.HasReplayLoaded; - hudOverlay.ReplaySettingsOverlay.IsAvaliable = HitRenderer.HasReplayLoaded; hudOverlay.Progress.OnSeek = pos => decoupledClock.Seek(pos); hudOverlay.ModDisplay.Current.BindTo(Beatmap.Mods); diff --git a/osu.Game/Screens/Play/ReplaySettings/CollectionSettings.cs b/osu.Game/Screens/Play/ReplaySettings/CollectionSettings.cs index b0a38537ea..7b2e313353 100644 --- a/osu.Game/Screens/Play/ReplaySettings/CollectionSettings.cs +++ b/osu.Game/Screens/Play/ReplaySettings/CollectionSettings.cs @@ -17,15 +17,18 @@ namespace osu.Game.Screens.Play.ReplaySettings [BackgroundDependencyLoader] private void load() { - Add(new OsuSpriteText + Children = new Drawable[] { - Text = @"Add current song to", - }); - Add(new CollectionsDropdown - { - RelativeSizeAxes = Axes.X, - Items = new[] { new KeyValuePair(@"All", PlaylistCollection.All) }, - }); + new OsuSpriteText + { + Text = @"Add current song to", + }, + new CollectionsDropdown + { + RelativeSizeAxes = Axes.X, + Items = new[] { new KeyValuePair(@"All", PlaylistCollection.All) }, + }, + }; } } } diff --git a/osu.Game/Screens/Play/ReplaySettings/DiscussionSettings.cs b/osu.Game/Screens/Play/ReplaySettings/DiscussionSettings.cs index 4abc772f7d..153e8b05f9 100644 --- a/osu.Game/Screens/Play/ReplaySettings/DiscussionSettings.cs +++ b/osu.Game/Screens/Play/ReplaySettings/DiscussionSettings.cs @@ -16,18 +16,21 @@ namespace osu.Game.Screens.Play.ReplaySettings [BackgroundDependencyLoader] private void load(OsuConfigManager config) { - Add(new SettingsCheckbox + Children = new Drawable[] { - LabelText = "Show floating coments", - Bindable = config.GetBindable(OsuSetting.FloatingComments) - }); - Add(new FocusedTextBox - { - RelativeSizeAxes = Axes.X, - Height = 30, - PlaceholderText = "Add Comment", - HoldFocus = false, - }); + new SettingsCheckbox + { + LabelText = "Show floating coments", + Bindable = config.GetBindable(OsuSetting.FloatingComments) + }, + new FocusedTextBox + { + RelativeSizeAxes = Axes.X, + Height = 30, + PlaceholderText = "Add Comment", + HoldFocus = false, + }, + }; } } } diff --git a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs index 30e0df7bb2..2067645ef0 100644 --- a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs +++ b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Game.Configuration; using osu.Game.Overlays.Settings; using osu.Game.Graphics.UserInterface; +using osu.Framework.Graphics; namespace osu.Game.Screens.Play.ReplaySettings { @@ -15,11 +16,14 @@ namespace osu.Game.Screens.Play.ReplaySettings [BackgroundDependencyLoader] private void load(OsuConfigManager config) { - Add(new SettingsSlider + Children = new Drawable[] { - LabelText = "Playback speed", - Bindable = config.GetBindable(OsuSetting.PlaybackSpeed), - }); + new SettingsSlider + { + LabelText = "Playback speed", + Bindable = config.GetBindable(OsuSetting.PlaybackSpeed), + } + }; } } } diff --git a/osu.Game/Screens/Play/ReplaySettings/ReplaySettingsOverlay.cs b/osu.Game/Screens/Play/ReplaySettings/ReplaySettingsOverlay.cs index 619c20eeb4..9217d54687 100644 --- a/osu.Game/Screens/Play/ReplaySettings/ReplaySettingsOverlay.cs +++ b/osu.Game/Screens/Play/ReplaySettings/ReplaySettingsOverlay.cs @@ -15,26 +15,6 @@ namespace osu.Game.Screens.Play.ReplaySettings private bool isVisible; - private bool isAvaliable; - /// - /// Allow user to interact with this overlay. - /// - public bool IsAvaliable - { - set - { - isAvaliable = value; - if (isAvaliable) - Show(); - else - Hide(); - } - get - { - return isAvaliable; - } - } - public ReplaySettingsOverlay() { AlwaysPresent = true; @@ -54,20 +34,12 @@ namespace osu.Game.Screens.Play.ReplaySettings switch (args.Key) { case Key.H: - toogleVisibility(); + FadeTo(isVisible ? 1 : 0, fade_duration); + isVisible = !isVisible; return true; } return base.OnKeyDown(state, args); } - - private void toogleVisibility() - { - if (isAvaliable) - { - FadeTo(isVisible ? 1 : 0, fade_duration); - isVisible = !isVisible; - } - } } }