From bb6478cdc3e98dee0cbfb8a6d722d012ae556233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Thu, 10 May 2018 10:15:47 +0200 Subject: [PATCH 01/10] Adds a check to disable music controller's seek --- osu.Game/Overlays/MusicController.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index b4021f2808..0605b211b0 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -206,7 +206,7 @@ namespace osu.Game.Overlays Anchor = Anchor.BottomCentre, Height = progress_height, FillColour = colours.Yellow, - OnSeek = progress => current?.Track.Seek(progress) + OnSeek = progress => ConditionalSeek(progress) } }, }, @@ -219,6 +219,13 @@ namespace osu.Game.Overlays playlist.StateChanged += s => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint); } + private bool? ConditionalSeek(double progress) + { + if (current.Track.Looping) + return current?.Track.Seek(progress); + return false; + } + protected override void LoadComplete() { beatmapBacking.ValueChanged += beatmapChanged; From 5b99d8df62c5176f1400d41c81e88905d7c108e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Thu, 10 May 2018 11:29:19 +0200 Subject: [PATCH 02/10] Fixes private method name capitalization --- osu.Game/Overlays/MusicController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 0605b211b0..ee928b3ccc 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -206,7 +206,7 @@ namespace osu.Game.Overlays Anchor = Anchor.BottomCentre, Height = progress_height, FillColour = colours.Yellow, - OnSeek = progress => ConditionalSeek(progress) + OnSeek = progress => conditionalSeek(progress) } }, }, @@ -219,7 +219,7 @@ namespace osu.Game.Overlays playlist.StateChanged += s => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint); } - private bool? ConditionalSeek(double progress) + private bool? conditionalSeek(double progress) { if (current.Track.Looping) return current?.Track.Seek(progress); From d54a7295f6a72a49cd7d7eece02cbb4cdb30f5b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Thu, 10 May 2018 13:20:04 +0200 Subject: [PATCH 03/10] Adds DisableSeek property to MusicController --- osu.Game/OsuGame.cs | 9 ++++++--- osu.Game/Overlays/MusicController.cs | 6 +++--- osu.Game/Screens/OsuScreen.cs | 2 ++ osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs | 2 ++ 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index d443ed36ae..4d6b4520fe 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -537,10 +537,13 @@ namespace osu.Game // we only want to apply these restrictions when we are inside a screen stack. // the use case for not applying is in visual/unit tests. - bool applyRestrictions = !currentScreen?.AllowBeatmapRulesetChange ?? false; + bool applyBeatmapRulesetRestrictions = !currentScreen?.AllowBeatmapRulesetChange ?? false; + bool applyUserSeekRestrictions = !currentScreen?.AllowUserSeek ?? false; - Ruleset.Disabled = applyRestrictions; - Beatmap.Disabled = applyRestrictions; + Ruleset.Disabled = applyBeatmapRulesetRestrictions; + Beatmap.Disabled = applyBeatmapRulesetRestrictions; + + musicController.DisableSeek = applyUserSeekRestrictions; mainContent.Padding = new MarginPadding { Top = ToolbarOffset }; diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index ee928b3ccc..9cfce04685 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -221,9 +221,7 @@ namespace osu.Game.Overlays private bool? conditionalSeek(double progress) { - if (current.Track.Looping) - return current?.Track.Seek(progress); - return false; + return DisableSeek ? false : current?.Track.Seek(progress); } protected override void LoadComplete() @@ -235,6 +233,8 @@ namespace osu.Game.Overlays base.LoadComplete(); } + public bool DisableSeek { get; set; } + private void beatmapDisabledChanged(bool disabled) { if (disabled) diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 7a910574e0..48c3d95b0c 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -50,6 +50,8 @@ namespace osu.Game.Screens /// public virtual bool AllowBeatmapRulesetChange => true; + public virtual bool AllowUserSeek => true; + protected readonly Bindable Beatmap = new Bindable(); protected virtual float BackgroundParallaxAmount => 1; diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index 1ccc5e2fe8..add02732d4 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -17,6 +17,8 @@ namespace osu.Game.Screens.Play public override bool AllowBeatmapRulesetChange => false; + public override bool AllowUserSeek => false; + protected const float BACKGROUND_FADE_DURATION = 800; protected float BackgroundOpacity => 1 - (float)DimLevel; From a877855fc615f697d4d205a304d4dde62031e70a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Fri, 11 May 2018 09:39:55 +0200 Subject: [PATCH 04/10] Changes conditionSeek return type to void --- osu.Game/Overlays/MusicController.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 9cfce04685..a0074ccee7 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -219,9 +219,11 @@ namespace osu.Game.Overlays playlist.StateChanged += s => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint); } - private bool? conditionalSeek(double progress) + private void conditionalSeek(double progress) { - return DisableSeek ? false : current?.Track.Seek(progress); + if (DisableSeek) + return; + current?.Track.Seek(progress); } protected override void LoadComplete() From 17ed5e48390cb3d19fb8ae2554b86c6aa60a3985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Fri, 11 May 2018 09:41:31 +0200 Subject: [PATCH 05/10] Moves seek restrictions to Player --- osu.Game/Screens/Play/Player.cs | 2 ++ osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 83958b2912..8989cbaad4 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -45,6 +45,8 @@ namespace osu.Game.Screens.Play public bool AllowLeadIn { get; set; } = true; public bool AllowResults { get; set; } = true; + public override bool AllowUserSeek => false; + private Bindable mouseWheelDisabled; private Bindable userAudioOffset; diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index add02732d4..1ccc5e2fe8 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -17,8 +17,6 @@ namespace osu.Game.Screens.Play public override bool AllowBeatmapRulesetChange => false; - public override bool AllowUserSeek => false; - protected const float BACKGROUND_FADE_DURATION = 800; protected float BackgroundOpacity => 1 - (float)DimLevel; From c55d47ff1085d0b215f3619678bcbac277c63adf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Fri, 11 May 2018 09:56:23 +0200 Subject: [PATCH 06/10] Converts OnSeek assignment to method group --- osu.Game/Overlays/MusicController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index a0074ccee7..45a59a0f87 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -206,7 +206,7 @@ namespace osu.Game.Overlays Anchor = Anchor.BottomCentre, Height = progress_height, FillColour = colours.Yellow, - OnSeek = progress => conditionalSeek(progress) + OnSeek = conditionalSeek } }, }, From a7e7c3a74a2132d173f2be310e2583acd808d126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Sat, 12 May 2018 11:55:52 +0200 Subject: [PATCH 07/10] Enables/Disables seek and Play/Resume on call to beatmapDisabledChanged --- osu.Game/OsuGame.cs | 3 --- osu.Game/Overlays/MusicController.cs | 9 +++++---- osu.Game/Screens/OsuScreen.cs | 2 -- osu.Game/Screens/Play/Player.cs | 2 -- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 4d6b4520fe..4e79ea48ca 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -538,13 +538,10 @@ namespace osu.Game // we only want to apply these restrictions when we are inside a screen stack. // the use case for not applying is in visual/unit tests. bool applyBeatmapRulesetRestrictions = !currentScreen?.AllowBeatmapRulesetChange ?? false; - bool applyUserSeekRestrictions = !currentScreen?.AllowUserSeek ?? false; Ruleset.Disabled = applyBeatmapRulesetRestrictions; Beatmap.Disabled = applyBeatmapRulesetRestrictions; - musicController.DisableSeek = applyUserSeekRestrictions; - mainContent.Padding = new MarginPadding { Top = ToolbarOffset }; CursorOverrideContainer.CanShowCursor = currentScreen?.CursorVisible ?? false; diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 45a59a0f87..8ff8dfb3ad 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -221,9 +221,8 @@ namespace osu.Game.Overlays private void conditionalSeek(double progress) { - if (DisableSeek) - return; - current?.Track.Seek(progress); + if (EnableSeek) + current?.Track.Seek(progress); } protected override void LoadComplete() @@ -235,16 +234,18 @@ namespace osu.Game.Overlays base.LoadComplete(); } - public bool DisableSeek { get; set; } + private bool EnableSeek { get; set; } private void beatmapDisabledChanged(bool disabled) { if (disabled) playlist.Hide(); + playButton.Enabled.Value = !disabled; prevButton.Enabled.Value = !disabled; nextButton.Enabled.Value = !disabled; playlistButton.Enabled.Value = !disabled; + EnableSeek = !disabled; } protected override void UpdateAfterChildren() diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 48c3d95b0c..7a910574e0 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -50,8 +50,6 @@ namespace osu.Game.Screens /// public virtual bool AllowBeatmapRulesetChange => true; - public virtual bool AllowUserSeek => true; - protected readonly Bindable Beatmap = new Bindable(); protected virtual float BackgroundParallaxAmount => 1; diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 2e6db93065..f397d0c3d4 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -45,8 +45,6 @@ namespace osu.Game.Screens.Play public bool AllowLeadIn { get; set; } = true; public bool AllowResults { get; set; } = true; - public override bool AllowUserSeek => false; - private Bindable mouseWheelDisabled; private Bindable userAudioOffset; From 861a8cf9a749a079f983ac38b4bb38fe0704f790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Sat, 12 May 2018 23:10:03 +0200 Subject: [PATCH 08/10] Fixes capitalization of enableSeek --- osu.Game/Overlays/MusicController.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 8ff8dfb3ad..0406bb812c 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -221,7 +221,7 @@ namespace osu.Game.Overlays private void conditionalSeek(double progress) { - if (EnableSeek) + if (enableSeek) current?.Track.Seek(progress); } @@ -234,7 +234,7 @@ namespace osu.Game.Overlays base.LoadComplete(); } - private bool EnableSeek { get; set; } + private bool enableSeek { get; set; } private void beatmapDisabledChanged(bool disabled) { @@ -245,7 +245,7 @@ namespace osu.Game.Overlays prevButton.Enabled.Value = !disabled; nextButton.Enabled.Value = !disabled; playlistButton.Enabled.Value = !disabled; - EnableSeek = !disabled; + enableSeek = !disabled; } protected override void UpdateAfterChildren() From 2979cb96a6eae23852f245042a248966e5e802ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Wed, 4 Jul 2018 21:09:28 +0200 Subject: [PATCH 09/10] attemptSeek accesses beatmap Disabled directly --- osu.Game/Overlays/MusicController.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index f7f0d7ec6a..94b69271fd 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -183,7 +183,7 @@ namespace osu.Game.Overlays Anchor = Anchor.BottomCentre, Height = progress_height, FillColour = colours.Yellow, - OnSeek = conditionalSeek + OnSeek = attemptSeek } }, }, @@ -198,9 +198,9 @@ namespace osu.Game.Overlays playlist.StateChanged += s => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint); } - private void conditionalSeek(double progress) + private void attemptSeek(double progress) { - if (enableSeek) + if (!beatmap.Disabled) current?.Track.Seek(progress); } @@ -220,8 +220,6 @@ namespace osu.Game.Overlays base.LoadComplete(); } - private bool enableSeek { get; set; } - private void beatmapDisabledChanged(bool disabled) { if (disabled) @@ -231,7 +229,6 @@ namespace osu.Game.Overlays prevButton.Enabled.Value = !disabled; nextButton.Enabled.Value = !disabled; playlistButton.Enabled.Value = !disabled; - enableSeek = !disabled; } protected override void UpdateAfterChildren() From 71c49de0312c769922b91250a1de42eb8f7f5831 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 26 Jul 2018 21:00:18 +0900 Subject: [PATCH 10/10] Fix possible nullref if no fruits are ever caught --- osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index 2f42902fd0..7b06426b07 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -52,6 +52,9 @@ namespace osu.Game.Rulesets.Catch.UI { void runAfterLoaded(Action action) { + if (lastPlateableFruit == null) + return; + // this is required to make this run after the last caught fruit runs UpdateState at least once. // TODO: find a better alternative if (lastPlateableFruit.IsLoaded)