From d7d6feb00182330a55bb77b6032703546e27b892 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Mon, 17 Jun 2019 12:31:23 +0200 Subject: [PATCH 1/7] Fade volume in / out when game window becomes active / inactive --- osu.Game/OsuGame.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index d5fbcdfee3..978d9cc20c 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -181,7 +181,7 @@ private void load(FrameworkConfigManager frameworkConfig) configSkin.ValueChanged += skinId => SkinManager.CurrentSkinInfo.Value = SkinManager.Query(s => s.ID == skinId.NewValue) ?? SkinInfo.Default; configSkin.TriggerChange(); - LocalConfig.BindWith(OsuSetting.VolumeInactive, inactiveVolumeAdjust); + LocalConfig.BindWith(OsuSetting.VolumeInactive, inactiveVolume); IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true); } @@ -686,14 +686,22 @@ public bool OnPressed(GlobalAction action) return false; } - private readonly BindableDouble inactiveVolumeAdjust = new BindableDouble(); + private readonly BindableDouble inactiveVolume = new BindableDouble(); + + private readonly BindableDouble inactiveVolAdjust = new BindableDouble(); private void updateActiveState(bool isActive) { if (isActive) - Audio.RemoveAdjustment(AdjustableProperty.Volume, inactiveVolumeAdjust); + { + this.TransformBindableTo(inactiveVolAdjust, 1, 750, Easing.In) + .Finally(_ => Audio.RemoveAdjustment(AdjustableProperty.Volume, inactiveVolAdjust)); //wait for the transition to finish to remove the inactive audio adjustement + } else - Audio.AddAdjustment(AdjustableProperty.Volume, inactiveVolumeAdjust); + { + Audio.AddAdjustment(AdjustableProperty.Volume, inactiveVolAdjust); + this.TransformBindableTo(inactiveVolAdjust, inactiveVolume.Value, 750, Easing.Out); + } } public bool OnReleased(GlobalAction action) => false; From ad4c9babe791346402a193c0de2dd4f5d4c10b8e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 17 Jun 2019 23:24:52 +0900 Subject: [PATCH 2/7] Adjust naming and transitions --- osu.Game/OsuGame.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 978d9cc20c..7f9da9a645 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -181,7 +181,7 @@ private void load(FrameworkConfigManager frameworkConfig) configSkin.ValueChanged += skinId => SkinManager.CurrentSkinInfo.Value = SkinManager.Query(s => s.ID == skinId.NewValue) ?? SkinInfo.Default; configSkin.TriggerChange(); - LocalConfig.BindWith(OsuSetting.VolumeInactive, inactiveVolume); + LocalConfig.BindWith(OsuSetting.VolumeInactive, userInactiveVolume); IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true); } @@ -686,21 +686,21 @@ public bool OnPressed(GlobalAction action) return false; } - private readonly BindableDouble inactiveVolume = new BindableDouble(); + private readonly BindableDouble userInactiveVolume = new BindableDouble(); - private readonly BindableDouble inactiveVolAdjust = new BindableDouble(); + private readonly BindableDouble inactiveVolumeFade = new BindableDouble(); private void updateActiveState(bool isActive) { if (isActive) { - this.TransformBindableTo(inactiveVolAdjust, 1, 750, Easing.In) - .Finally(_ => Audio.RemoveAdjustment(AdjustableProperty.Volume, inactiveVolAdjust)); //wait for the transition to finish to remove the inactive audio adjustement + this.TransformBindableTo(inactiveVolumeFade, 1, 500, Easing.OutQuint) + .Finally(_ => Audio.RemoveAdjustment(AdjustableProperty.Volume, inactiveVolumeFade)); //wait for the transition to finish to remove the inactive audio adjustement } else { - Audio.AddAdjustment(AdjustableProperty.Volume, inactiveVolAdjust); - this.TransformBindableTo(inactiveVolAdjust, inactiveVolume.Value, 750, Easing.Out); + Audio.AddAdjustment(AdjustableProperty.Volume, inactiveVolumeFade); + this.TransformBindableTo(inactiveVolumeFade, userInactiveVolume.Value, 1500, Easing.OutSine); } } From 3a04684efb21ace6ff19d3d9226c04cfc6583f71 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 17 Jun 2019 23:25:16 +0900 Subject: [PATCH 3/7] Add region --- osu.Game/OsuGame.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 7f9da9a645..aa891f6c87 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -686,6 +686,8 @@ public bool OnPressed(GlobalAction action) return false; } + #region Inactive audio dimming + private readonly BindableDouble userInactiveVolume = new BindableDouble(); private readonly BindableDouble inactiveVolumeFade = new BindableDouble(); @@ -704,6 +706,8 @@ private void updateActiveState(bool isActive) } } + #endregion + public bool OnReleased(GlobalAction action) => false; private Container overlayContent; From 04dc1c1744da9f4e7c1efe33da66192d6d6c8d51 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Mon, 17 Jun 2019 16:44:53 +0200 Subject: [PATCH 4/7] Fix typo in comment Co-Authored-By: Joseph Madamba --- osu.Game/OsuGame.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index aa891f6c87..f38eecef81 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -697,7 +697,7 @@ private void updateActiveState(bool isActive) if (isActive) { this.TransformBindableTo(inactiveVolumeFade, 1, 500, Easing.OutQuint) - .Finally(_ => Audio.RemoveAdjustment(AdjustableProperty.Volume, inactiveVolumeFade)); //wait for the transition to finish to remove the inactive audio adjustement + .Finally(_ => Audio.RemoveAdjustment(AdjustableProperty.Volume, inactiveVolumeFade)); //wait for the transition to finish to remove the inactive audio adjustment } else { From 07ea0f9755268e163c282847f4f01b5106936c4f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Jun 2019 14:16:54 +0900 Subject: [PATCH 5/7] Make OsuButton non-abstract again --- osu.Game/Graphics/UserInterface/OsuButton.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index 494d4e4262..7a27f825f6 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -17,11 +17,11 @@ namespace osu.Game.Graphics.UserInterface /// /// A button with added default sound effects. /// - public abstract class OsuButton : Button + public class OsuButton : Button { private Box hover; - protected OsuButton() + public OsuButton() { Height = 40; From 2d20c088f7ab9d7e39c721efe760430cb20b9cfe Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Jun 2019 18:31:42 +0900 Subject: [PATCH 6/7] Remove test which is failing due to magic numbers --- .../SongSelect/TestScenePlaySongSelect.cs | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs index 738b7f14f3..962e0fb362 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs @@ -214,37 +214,6 @@ public void TestStartAfterUnMatchingFilterDoesNotStart() AddAssert("start not requested", () => !startRequested); } - [Test] - public void TestAddNewBeatmapWhileSelectingRandom() - { - const int test_count = 10; - int beatmapChangedCount = 0; - int debounceCount = 0; - createSongSelect(); - AddStep("Setup counters", () => - { - beatmapChangedCount = 0; - debounceCount = 0; - songSelect.Carousel.SelectionChanged += _ => beatmapChangedCount++; - }); - AddRepeatStep($"Create beatmaps {test_count} times", () => - { - importForRuleset(0); - - Scheduler.AddDelayed(() => - { - // Wait for debounce - songSelect.Carousel.SelectNextRandom(); - ++debounceCount; - }, 400); - }, test_count); - - AddUntilStep("Debounce limit reached", () => debounceCount == test_count); - - // The selected beatmap should have changed an additional 2 times since both initially loading songselect and the first import also triggers selectionChanged - AddAssert($"Beatmap changed {test_count + 2} times", () => beatmapChangedCount == test_count + 2); - } - [Test] public void TestHideSetSelectsCorrectBeatmap() { From a5adc8983920d97b5488c5a59be6410b954bb99c Mon Sep 17 00:00:00 2001 From: KingLuigi4932 Date: Tue, 18 Jun 2019 20:37:56 +0300 Subject: [PATCH 7/7] Update framework --- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 957d365724..9dd8c8572e 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -15,7 +15,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 9b146fa490..1482b6ed03 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + +