From eafe215169b6ba92b813e280d2681e76b7d1b723 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 23 May 2017 11:53:12 +0300 Subject: [PATCH 1/6] Simplify Hud visibility change --- osu.Game/Screens/Play/HUDOverlay.cs | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 1e57c2ba2a..34522d74ef 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -30,7 +30,6 @@ namespace osu.Game.Screens.Play public readonly SongProgress Progress; public readonly ModDisplay ModDisplay; - private Bindable showKeyCounter; private Bindable showHud; private static bool hasShownNotificationOnce; @@ -46,6 +45,7 @@ namespace osu.Game.Screens.Play protected HUDOverlay() { RelativeSizeAxes = Axes.Both; + AlwaysPresent = true; Add(content = new Container { @@ -67,24 +67,8 @@ namespace osu.Game.Screens.Play [BackgroundDependencyLoader(true)] private void load(OsuConfigManager config, NotificationManager notificationManager) { - showKeyCounter = config.GetBindable(OsuSetting.KeyOverlay); - showKeyCounter.ValueChanged += keyCounterVisibility => - { - if (keyCounterVisibility) - KeyCounter.FadeIn(duration); - else - KeyCounter.FadeOut(duration); - }; - showKeyCounter.TriggerChange(); - showHud = config.GetBindable(OsuSetting.ShowInterface); - showHud.ValueChanged += hudVisibility => - { - if (hudVisibility) - content.FadeIn(duration); - else - content.FadeOut(duration); - }; + showHud.ValueChanged += hudVisibility => FadeTo(hudVisibility ? 1 : 0, duration); showHud.TriggerChange(); if (!showHud && !hasShownNotificationOnce) From 4b23cc47eae4d81a2a2a6d4072d5498b9de836ed Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 23 May 2017 11:53:42 +0300 Subject: [PATCH 2/6] Moved KeyCounter visibility logic to it's own class --- osu.Game/Screens/Play/KeyCounterCollection.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 4a561e6036..e53a1dcd99 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -6,14 +6,22 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using OpenTK.Graphics; using osu.Framework.Input; +using osu.Framework.Configuration; +using osu.Framework.Allocation; +using osu.Game.Configuration; namespace osu.Game.Screens.Play { public class KeyCounterCollection : FillFlowContainer { + private const int duration = 100; + + private Bindable showKeyCounter; + public KeyCounterCollection() { AlwaysReceiveInput = true; + AlwaysPresent = true; Direction = FillDirection.Horizontal; AutoSizeAxes = Axes.Both; @@ -34,6 +42,14 @@ namespace osu.Game.Screens.Play counter.ResetCount(); } + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + showKeyCounter = config.GetBindable(OsuSetting.KeyOverlay); + showKeyCounter.ValueChanged += keyCounterVisibility => FadeTo(keyCounterVisibility ? 1 : 0, duration); + showKeyCounter.TriggerChange(); + } + //further: change default values here and in KeyCounter if needed, instead of passing them in every constructor private bool isCounting; public bool IsCounting From c7a241246ecb912897aded1faf75203589f66614 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 23 May 2017 12:09:32 +0300 Subject: [PATCH 3/6] Better letterbox settings transition --- .../Sections/Graphics/LayoutSettings.cs | 49 +++++++++---------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 9a5fd769cd..8b093c8d79 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -4,6 +4,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; namespace osu.Game.Overlays.Settings.Sections.Graphics { @@ -11,11 +12,13 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics { protected override string Header => "Layout"; - private SettingsSlider letterboxPositionX; - private SettingsSlider letterboxPositionY; + private FillFlowContainer letterboxSettings; private Bindable letterboxing; + private const int letterbox_container_height = 75; + private const int duration = 200; + [BackgroundDependencyLoader] private void load(FrameworkConfigManager config) { @@ -33,34 +36,30 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics LabelText = "Letterboxing", Bindable = letterboxing, }, - letterboxPositionX = new SettingsSlider + letterboxSettings = new FillFlowContainer { - LabelText = "Horizontal position", - Bindable = config.GetBindable(FrameworkSetting.LetterboxPositionX) - }, - letterboxPositionY = new SettingsSlider - { - LabelText = "Vertical position", - Bindable = config.GetBindable(FrameworkSetting.LetterboxPositionY) + Direction = FillDirection.Vertical, + RelativeSizeAxes = Axes.X, + Masking = true, + + Children = new Drawable[] + { + new SettingsSlider + { + LabelText = "Horizontal position", + Bindable = config.GetBindable(FrameworkSetting.LetterboxPositionX) + }, + new SettingsSlider + { + LabelText = "Vertical position", + Bindable = config.GetBindable(FrameworkSetting.LetterboxPositionY) + }, + } }, }; - letterboxing.ValueChanged += visibilityChanged; + letterboxing.ValueChanged += isVisible => letterboxSettings.ResizeHeightTo(isVisible ? letterbox_container_height : 0, duration, EasingTypes.OutQuint); letterboxing.TriggerChange(); } - - private void visibilityChanged(bool newVisibility) - { - if (newVisibility) - { - letterboxPositionX.Show(); - letterboxPositionY.Show(); - } - else - { - letterboxPositionX.Hide(); - letterboxPositionY.Hide(); - } - } } } From 2e28b10c3678518e496801d799b9b5f6239ad56f Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 23 May 2017 12:24:16 +0300 Subject: [PATCH 4/6] CI fixes and removed useless property --- osu.Game/Screens/Play/HUDOverlay.cs | 3 +-- osu.Game/Screens/Play/KeyCounterCollection.cs | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 34522d74ef..115611c244 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -45,7 +45,6 @@ namespace osu.Game.Screens.Play protected HUDOverlay() { RelativeSizeAxes = Axes.Both; - AlwaysPresent = true; Add(content = new Container { @@ -68,7 +67,7 @@ namespace osu.Game.Screens.Play private void load(OsuConfigManager config, NotificationManager notificationManager) { showHud = config.GetBindable(OsuSetting.ShowInterface); - showHud.ValueChanged += hudVisibility => FadeTo(hudVisibility ? 1 : 0, duration); + showHud.ValueChanged += hudVisibility => content.FadeTo(hudVisibility ? 1 : 0, duration); showHud.TriggerChange(); if (!showHud && !hasShownNotificationOnce) diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index e53a1dcd99..6e1c8a34e5 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -21,7 +21,6 @@ namespace osu.Game.Screens.Play public KeyCounterCollection() { AlwaysReceiveInput = true; - AlwaysPresent = true; Direction = FillDirection.Horizontal; AutoSizeAxes = Axes.Both; From 165d6ef1bb19e6c5079dbd95e2afced50f437adc Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 23 May 2017 12:30:39 +0300 Subject: [PATCH 5/6] Make transition a bit smoother --- osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 8b093c8d79..8ff145823c 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private Bindable letterboxing; private const int letterbox_container_height = 75; - private const int duration = 200; + private const int duration = 300; [BackgroundDependencyLoader] private void load(FrameworkConfigManager config) From 564abc1a5bc171a7f62e5f0568fa17ec87efeffa Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 23 May 2017 14:32:45 +0300 Subject: [PATCH 6/6] using autosize instead of constant height --- .../Settings/Sections/Graphics/LayoutSettings.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 8ff145823c..ea9ccd3492 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -16,8 +16,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private Bindable letterboxing; - private const int letterbox_container_height = 75; - private const int duration = 300; + private const int transition_duration = 400; [BackgroundDependencyLoader] private void load(FrameworkConfigManager config) @@ -40,6 +39,9 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics { Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + AutoSizeDuration = transition_duration, + AutoSizeEasing = EasingTypes.OutQuint, Masking = true, Children = new Drawable[] @@ -58,7 +60,14 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics }, }; - letterboxing.ValueChanged += isVisible => letterboxSettings.ResizeHeightTo(isVisible ? letterbox_container_height : 0, duration, EasingTypes.OutQuint); + letterboxing.ValueChanged += isVisible => + { + letterboxSettings.ClearTransforms(); + letterboxSettings.AutoSizeAxes = isVisible ? Axes.Y : Axes.None; + + if(!isVisible) + letterboxSettings.ResizeHeightTo(0, transition_duration, EasingTypes.OutQuint); + }; letterboxing.TriggerChange(); } }