From d7fc9043812b99dc09d843ea94c17da50e8c2f47 Mon Sep 17 00:00:00 2001 From: Ganendra Afrasya Date: Fri, 11 Oct 2019 00:12:36 +0700 Subject: [PATCH 001/159] Make prev button can do restart track --- osu.Game/Overlays/MusicController.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index f5c36a9cac..9b54a6c9a6 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -136,11 +136,20 @@ namespace osu.Game.Overlays } /// - /// Play the previous track. + /// Play the previous track or restart the current track if it's current time below 5000ms /// /// Whether the operation was successful. public bool PrevTrack() { + var currentTrackPosition = current?.Track.CurrentTime; + + if (currentTrackPosition >= 5000) + { + SeekTo(0); + + return true; + } + queuedDirection = TrackChangeDirection.Prev; var playable = BeatmapSets.TakeWhile(i => i.ID != current.BeatmapSetInfo.ID).LastOrDefault() ?? BeatmapSets.LastOrDefault(); @@ -260,8 +269,9 @@ namespace osu.Game.Overlays return true; case GlobalAction.MusicPrev: + var shouldRestart = current?.Track.CurrentTime >= 5000; if (PrevTrack()) - onScreenDisplay?.Display(new MusicControllerToast("Previous track")); + onScreenDisplay?.Display(new MusicControllerToast(shouldRestart ? "Restart track" : "Previous track")); return true; } From b07c477aad08a9c284c6e5a3a01e561fd4506021 Mon Sep 17 00:00:00 2001 From: Ganendra Afrasya Date: Fri, 11 Oct 2019 01:24:03 +0700 Subject: [PATCH 002/159] Add test case on TestSceneNowPlayingOverlay --- .../TestSceneNowPlayingOverlay.cs | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs index e3daa9c279..33706d2e0f 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs @@ -5,6 +5,7 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Timing; +using osu.Game.Beatmaps; using osu.Game.Overlays; namespace osu.Game.Tests.Visual.UserInterface @@ -15,6 +16,8 @@ namespace osu.Game.Tests.Visual.UserInterface [Cached] private MusicController musicController = new MusicController(); + private WorkingBeatmap currentTrack; + public TestSceneNowPlayingOverlay() { Clock = new FramedClock(); @@ -30,7 +33,25 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep(@"show", () => np.Show()); AddToggleStep(@"toggle beatmap lock", state => Beatmap.Disabled = state); - AddStep(@"show", () => np.Hide()); + AddStep(@"hide", () => np.Hide()); + } + + [Test] + public void TestPrevTrackBehavior() + { + AddStep(@"Play track", () => + { + musicController.NextTrack(); + currentTrack = Beatmap.Value; + }); + + AddStep(@"Seek track to 6 second", () => musicController.SeekTo(6000)); + AddStep(@"Call PrevTrack", () => musicController.PrevTrack()); + AddAssert(@"Check if it restarted", () => currentTrack == Beatmap.Value); + + AddStep(@"Seek track to 1 second", () => musicController.SeekTo(1000)); + AddStep(@"Call PrevTrack", () => musicController.PrevTrack()); + AddAssert(@"Check if it changed to prev track'", () => currentTrack != Beatmap.Value); } } } From 3008ade8a2b2182c1daf8a4afb52b1769eb5bb8e Mon Sep 17 00:00:00 2001 From: Ganendra Afrasya Date: Fri, 11 Oct 2019 16:41:54 +0700 Subject: [PATCH 003/159] Using enum to determine the action --- osu.Game/Overlays/MusicController.cs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 9b54a6c9a6..12de2019cb 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -27,6 +27,8 @@ namespace osu.Game.Overlays public IBindableList BeatmapSets => beatmapSets; + private const double restart_cutoff_point = 5000; + private readonly BindableList beatmapSets = new BindableList(); public bool IsUserPaused { get; private set; } @@ -135,22 +137,26 @@ namespace osu.Game.Overlays return true; } + private PreviousButtonAction? prevAction; + /// - /// Play the previous track or restart the current track if it's current time below 5000ms + /// Play the previous track or restart the current track if it's current time below /// /// Whether the operation was successful. public bool PrevTrack() { var currentTrackPosition = current?.Track.CurrentTime; - if (currentTrackPosition >= 5000) + if (currentTrackPosition >= restart_cutoff_point) { SeekTo(0); + prevAction = PreviousButtonAction.Restart; return true; } queuedDirection = TrackChangeDirection.Prev; + prevAction = PreviousButtonAction.Previous; var playable = BeatmapSets.TakeWhile(i => i.ID != current.BeatmapSetInfo.ID).LastOrDefault() ?? BeatmapSets.LastOrDefault(); @@ -269,9 +275,8 @@ namespace osu.Game.Overlays return true; case GlobalAction.MusicPrev: - var shouldRestart = current?.Track.CurrentTime >= 5000; if (PrevTrack()) - onScreenDisplay?.Display(new MusicControllerToast(shouldRestart ? "Restart track" : "Previous track")); + onScreenDisplay?.Display(new MusicControllerToast(prevAction == PreviousButtonAction.Restart ? "Restart track" : "Previous track")); return true; } @@ -296,4 +301,11 @@ namespace osu.Game.Overlays Next, Prev } + + internal enum PreviousButtonAction + { + None, + Restart, + Previous + } } From 736a36a326700ab325db2f3938025f9cf76a1490 Mon Sep 17 00:00:00 2001 From: Ganendra Afrasya Date: Wed, 16 Oct 2019 14:30:09 +0700 Subject: [PATCH 004/159] Fix failed testcase --- .../Visual/UserInterface/TestSceneNowPlayingOverlay.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs index 33706d2e0f..4c76a04bdb 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs @@ -49,9 +49,10 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep(@"Call PrevTrack", () => musicController.PrevTrack()); AddAssert(@"Check if it restarted", () => currentTrack == Beatmap.Value); - AddStep(@"Seek track to 1 second", () => musicController.SeekTo(1000)); + AddStep(@"Seek track to 2 second", () => musicController.SeekTo(2000)); AddStep(@"Call PrevTrack", () => musicController.PrevTrack()); - AddAssert(@"Check if it changed to prev track'", () => currentTrack != Beatmap.Value); + // If the track isn't changing, check the current track's time instead + AddAssert(@"Check if it changed to prev track'", () => currentTrack != Beatmap.Value || currentTrack.Track.CurrentTime < 2000); } } } From 326abc1a55be865f4facf10766f5fe89a6a6864b Mon Sep 17 00:00:00 2001 From: Ganendra Afrasya Date: Wed, 16 Oct 2019 20:11:25 +0700 Subject: [PATCH 005/159] Apply reviews --- osu.Game/Overlays/MusicController.cs | 30 ++++++++++++++++------------ 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 12de2019cb..812c4778dd 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -137,26 +137,21 @@ namespace osu.Game.Overlays return true; } - private PreviousButtonAction? prevAction; - /// /// Play the previous track or restart the current track if it's current time below /// /// Whether the operation was successful. - public bool PrevTrack() + public PreviousButtonAction PrevTrack() { var currentTrackPosition = current?.Track.CurrentTime; if (currentTrackPosition >= restart_cutoff_point) { SeekTo(0); - prevAction = PreviousButtonAction.Restart; - - return true; + return PreviousButtonAction.Restart; } queuedDirection = TrackChangeDirection.Prev; - prevAction = PreviousButtonAction.Previous; var playable = BeatmapSets.TakeWhile(i => i.ID != current.BeatmapSetInfo.ID).LastOrDefault() ?? BeatmapSets.LastOrDefault(); @@ -166,10 +161,10 @@ namespace osu.Game.Overlays working.Value = beatmaps.GetWorkingBeatmap(playable.Beatmaps.First(), beatmap.Value); beatmap.Value.Track.Restart(); - return true; + return PreviousButtonAction.Previous; } - return false; + return PreviousButtonAction.None; } /// @@ -275,10 +270,19 @@ namespace osu.Game.Overlays return true; case GlobalAction.MusicPrev: - if (PrevTrack()) - onScreenDisplay?.Display(new MusicControllerToast(prevAction == PreviousButtonAction.Restart ? "Restart track" : "Previous track")); + switch (PrevTrack()) + { + case PreviousButtonAction.Restart: + onScreenDisplay?.Display(new MusicControllerToast("Restart track")); + return true; - return true; + case PreviousButtonAction.Previous: + onScreenDisplay?.Display(new MusicControllerToast("Previous track")); + return true; + + default: + return false; + } } return false; @@ -302,7 +306,7 @@ namespace osu.Game.Overlays Prev } - internal enum PreviousButtonAction + public enum PreviousButtonAction { None, Restart, From c6d4fc8b2438af9786bf628ca4a7be712f13ff55 Mon Sep 17 00:00:00 2001 From: Ganendra Afrasya Date: Thu, 24 Oct 2019 08:00:45 +0700 Subject: [PATCH 006/159] Apply review --- osu.Game/Overlays/MusicController.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index cc74f234a0..45f08b2a25 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -289,15 +289,14 @@ namespace osu.Game.Overlays { case PreviousButtonAction.Restart: onScreenDisplay?.Display(new MusicControllerToast("Restart track")); - return true; + break; case PreviousButtonAction.Previous: onScreenDisplay?.Display(new MusicControllerToast("Previous track")); - return true; - - default: - return false; + break; } + + return true; } return false; From d22e12d1046a167c547d313bf703e309ef71e583 Mon Sep 17 00:00:00 2001 From: Ganendra Afrasya Date: Thu, 24 Oct 2019 10:28:23 +0700 Subject: [PATCH 007/159] Update doc --- 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 45f08b2a25..b2b0a0afd9 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -155,7 +155,7 @@ namespace osu.Game.Overlays /// /// Play the previous track or restart the current track if it's current time below /// - /// Whether the operation was successful. + /// The that indicate the decided action public PreviousButtonAction PrevTrack() { var currentTrackPosition = current?.Track.CurrentTime; From 967551fec06cc152085116e1510ddc91e98aa799 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 24 Oct 2019 13:10:17 +0900 Subject: [PATCH 008/159] Renames and xmldoc --- .../TestSceneNowPlayingOverlay.cs | 4 ++-- osu.Game/Overlays/MusicController.cs | 21 +++++++++++-------- osu.Game/Overlays/NowPlayingOverlay.cs | 2 +- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs index 4c76a04bdb..f12e647b4e 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs @@ -46,11 +46,11 @@ namespace osu.Game.Tests.Visual.UserInterface }); AddStep(@"Seek track to 6 second", () => musicController.SeekTo(6000)); - AddStep(@"Call PrevTrack", () => musicController.PrevTrack()); + AddStep(@"Call PrevTrack", () => musicController.PreviousTrack()); AddAssert(@"Check if it restarted", () => currentTrack == Beatmap.Value); AddStep(@"Seek track to 2 second", () => musicController.SeekTo(2000)); - AddStep(@"Call PrevTrack", () => musicController.PrevTrack()); + AddStep(@"Call PrevTrack", () => musicController.PreviousTrack()); // If the track isn't changing, check the current track's time instead AddAssert(@"Check if it changed to prev track'", () => currentTrack != Beatmap.Value || currentTrack.Track.CurrentTime < 2000); } diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index b2b0a0afd9..bb246763c7 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -27,6 +27,9 @@ namespace osu.Game.Overlays public IBindableList BeatmapSets => beatmapSets; + /// + /// Point in time after which the current track will be restarted on triggering a "previous track" action. + /// private const double restart_cutoff_point = 5000; private readonly BindableList beatmapSets = new BindableList(); @@ -155,15 +158,15 @@ namespace osu.Game.Overlays /// /// Play the previous track or restart the current track if it's current time below /// - /// The that indicate the decided action - public PreviousButtonAction PrevTrack() + /// The that indicate the decided action + public PreviousTrackResult PreviousTrack() { var currentTrackPosition = current?.Track.CurrentTime; if (currentTrackPosition >= restart_cutoff_point) { SeekTo(0); - return PreviousButtonAction.Restart; + return PreviousTrackResult.Restart; } queuedDirection = TrackChangeDirection.Prev; @@ -176,10 +179,10 @@ namespace osu.Game.Overlays working.Value = beatmaps.GetWorkingBeatmap(playable.Beatmaps.First(), beatmap.Value); beatmap.Value.Track.Restart(); - return PreviousButtonAction.Previous; + return PreviousTrackResult.Previous; } - return PreviousButtonAction.None; + return PreviousTrackResult.None; } /// @@ -285,13 +288,13 @@ namespace osu.Game.Overlays return true; case GlobalAction.MusicPrev: - switch (PrevTrack()) + switch (PreviousTrack()) { - case PreviousButtonAction.Restart: + case PreviousTrackResult.Restart: onScreenDisplay?.Display(new MusicControllerToast("Restart track")); break; - case PreviousButtonAction.Previous: + case PreviousTrackResult.Previous: onScreenDisplay?.Display(new MusicControllerToast("Previous track")); break; } @@ -320,7 +323,7 @@ namespace osu.Game.Overlays Prev } - public enum PreviousButtonAction + public enum PreviousTrackResult { None, Restart, diff --git a/osu.Game/Overlays/NowPlayingOverlay.cs b/osu.Game/Overlays/NowPlayingOverlay.cs index 6b79f2af07..c1c871aade 100644 --- a/osu.Game/Overlays/NowPlayingOverlay.cs +++ b/osu.Game/Overlays/NowPlayingOverlay.cs @@ -137,7 +137,7 @@ namespace osu.Game.Overlays { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Action = () => musicController.PrevTrack(), + Action = () => musicController.PreviousTrack(), Icon = FontAwesome.Solid.StepBackward, }, playButton = new MusicIconButton From 42e33dde0c718188afcaa41cbdf4bd8d731fac9a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 24 Oct 2019 13:18:31 +0900 Subject: [PATCH 009/159] Make tests actually test --- .../Visual/UserInterface/TestSceneNowPlayingOverlay.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs index f12e647b4e..16f788a9fc 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs @@ -46,13 +46,11 @@ namespace osu.Game.Tests.Visual.UserInterface }); AddStep(@"Seek track to 6 second", () => musicController.SeekTo(6000)); - AddStep(@"Call PrevTrack", () => musicController.PreviousTrack()); - AddAssert(@"Check if it restarted", () => currentTrack == Beatmap.Value); + AddAssert(@"Check action is restart track", () => musicController.PreviousTrack() == PreviousTrackResult.Restart); + AddAssert(@"Check track didn't change", () => currentTrack == Beatmap.Value); AddStep(@"Seek track to 2 second", () => musicController.SeekTo(2000)); - AddStep(@"Call PrevTrack", () => musicController.PreviousTrack()); - // If the track isn't changing, check the current track's time instead - AddAssert(@"Check if it changed to prev track'", () => currentTrack != Beatmap.Value || currentTrack.Track.CurrentTime < 2000); + AddAssert(@"Check action is previous track", () => musicController.PreviousTrack() == PreviousTrackResult.Previous); } } } From f32b84d07d98b29371f02fa54dc9ff7d6949e922 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 24 Oct 2019 14:05:56 +0900 Subject: [PATCH 010/159] Fix tests not working on CI (where no beatmaps were present) --- .../TestSceneNowPlayingOverlay.cs | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs index 16f788a9fc..1a824cf226 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs @@ -4,9 +4,9 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Overlays; +using osu.Game.Rulesets.Osu; namespace osu.Game.Tests.Visual.UserInterface { @@ -16,24 +16,31 @@ namespace osu.Game.Tests.Visual.UserInterface [Cached] private MusicController musicController = new MusicController(); - private WorkingBeatmap currentTrack; + private WorkingBeatmap currentBeatmap; - public TestSceneNowPlayingOverlay() + private NowPlayingOverlay nowPlayingOverlay; + + [BackgroundDependencyLoader] + private void load() { - Clock = new FramedClock(); + Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo); - var np = new NowPlayingOverlay + nowPlayingOverlay = new NowPlayingOverlay { Origin = Anchor.Centre, Anchor = Anchor.Centre }; Add(musicController); - Add(np); + Add(nowPlayingOverlay); + } - AddStep(@"show", () => np.Show()); + [Test] + public void TestShowHideDisable() + { + AddStep(@"show", () => nowPlayingOverlay.Show()); AddToggleStep(@"toggle beatmap lock", state => Beatmap.Disabled = state); - AddStep(@"hide", () => np.Hide()); + AddStep(@"hide", () => nowPlayingOverlay.Hide()); } [Test] @@ -42,15 +49,16 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep(@"Play track", () => { musicController.NextTrack(); - currentTrack = Beatmap.Value; + currentBeatmap = Beatmap.Value; }); AddStep(@"Seek track to 6 second", () => musicController.SeekTo(6000)); + AddUntilStep(@"Wait for current time to update", () => currentBeatmap.Track.CurrentTime > 5000); AddAssert(@"Check action is restart track", () => musicController.PreviousTrack() == PreviousTrackResult.Restart); - AddAssert(@"Check track didn't change", () => currentTrack == Beatmap.Value); + AddAssert(@"Check track didn't change", () => currentBeatmap == Beatmap.Value); AddStep(@"Seek track to 2 second", () => musicController.SeekTo(2000)); - AddAssert(@"Check action is previous track", () => musicController.PreviousTrack() == PreviousTrackResult.Previous); + AddAssert(@"Check action is not restart", () => musicController.PreviousTrack() != PreviousTrackResult.Restart); } } } From 7f64012cfc022c82fd12605dd65ea06a02112c16 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 24 Oct 2019 14:35:45 +0900 Subject: [PATCH 011/159] Remove seek --- .../Visual/UserInterface/TestSceneNowPlayingOverlay.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs index 1a824cf226..4626b9d70f 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs @@ -56,8 +56,6 @@ namespace osu.Game.Tests.Visual.UserInterface AddUntilStep(@"Wait for current time to update", () => currentBeatmap.Track.CurrentTime > 5000); AddAssert(@"Check action is restart track", () => musicController.PreviousTrack() == PreviousTrackResult.Restart); AddAssert(@"Check track didn't change", () => currentBeatmap == Beatmap.Value); - - AddStep(@"Seek track to 2 second", () => musicController.SeekTo(2000)); AddAssert(@"Check action is not restart", () => musicController.PreviousTrack() != PreviousTrackResult.Restart); } } From 963215ccbe99fe7170ffe19673937f5013e756b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 6 Nov 2019 22:43:13 +0100 Subject: [PATCH 012/159] Wait for track reset in tests Add a wait step in tests for the "now playing" overlay to make sure the current track was restarted before trying to call PreviousTrack() again. --- .../Visual/UserInterface/TestSceneNowPlayingOverlay.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs index 4626b9d70f..330ccecd54 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs @@ -4,6 +4,7 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.MathUtils; using osu.Game.Beatmaps; using osu.Game.Overlays; using osu.Game.Rulesets.Osu; @@ -55,6 +56,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep(@"Seek track to 6 second", () => musicController.SeekTo(6000)); AddUntilStep(@"Wait for current time to update", () => currentBeatmap.Track.CurrentTime > 5000); AddAssert(@"Check action is restart track", () => musicController.PreviousTrack() == PreviousTrackResult.Restart); + AddUntilStep("Wait for current time to update", () => Precision.AlmostEquals(currentBeatmap.Track.CurrentTime, 0)); AddAssert(@"Check track didn't change", () => currentBeatmap == Beatmap.Value); AddAssert(@"Check action is not restart", () => musicController.PreviousTrack() != PreviousTrackResult.Restart); } From 54a8c00bb854c8bf70cd077302cd6fbba240504a Mon Sep 17 00:00:00 2001 From: Shane Woolcock Date: Thu, 28 Nov 2019 17:09:54 +1030 Subject: [PATCH 013/159] Add support for --sdl command line arg --- .../.idea/runConfigurations/osu_SDL.xml | 20 +++++++++++++++++++ osu.Desktop/Program.cs | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 .idea/.idea.osu.Desktop/.idea/runConfigurations/osu_SDL.xml diff --git a/.idea/.idea.osu.Desktop/.idea/runConfigurations/osu_SDL.xml b/.idea/.idea.osu.Desktop/.idea/runConfigurations/osu_SDL.xml new file mode 100644 index 0000000000..1fd10e0e1a --- /dev/null +++ b/.idea/.idea.osu.Desktop/.idea/runConfigurations/osu_SDL.xml @@ -0,0 +1,20 @@ + + + + \ No newline at end of file diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 141b2cdbbc..bd91bcc933 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -22,8 +22,9 @@ namespace osu.Desktop { // Back up the cwd before DesktopGameHost changes it var cwd = Environment.CurrentDirectory; + bool useSdl = args.Contains("--sdl"); - using (DesktopGameHost host = Host.GetSuitableHost(@"osu", true)) + using (DesktopGameHost host = Host.GetSuitableHost(@"osu", true, useSdl: useSdl)) { host.ExceptionThrown += handleException; From ad077042ba61a9e4fa297e0c9f5e971f3047008c Mon Sep 17 00:00:00 2001 From: Willy Tu Date: Sun, 15 Dec 2019 02:18:12 -0800 Subject: [PATCH 014/159] Created ContextMenu for scores by adding OsuContextMenuContainer as a child of LeaderboardScore and a Drawable that extended the IHasContextMenu interface to the MenuContainer. Tried to the LeaderboardScore extend IHASContextMenu itself, but it is not working yet. --- .../Online/Leaderboards/LeaderboardScore.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index 6ac5219282..c4bc306f05 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -11,10 +11,13 @@ using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; using osu.Game.Graphics; +using osu.Game.Graphics.Cursor; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets.UI; using osu.Game.Scoring; using osu.Game.Users.Drawables; @@ -227,9 +230,28 @@ namespace osu.Game.Online.Leaderboards }, }; + Add( + new OsuContextMenuContainer + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] { + new ContextMenuArea{ + RelativeSizeAxes = Axes.Both + } + } + } + ); + innerAvatar.OnLoadComplete += d => d.FadeInFromZero(200); } + private class ContextMenuArea : Drawable, IHasContextMenu + { + public MenuItem[] ContextMenuItems => new MenuItem[] + { + new OsuMenuItem("Delete", MenuItemType.Destructive), + }; + } public override void Show() { foreach (var d in new[] { avatar, nameLabel, scoreLabel, scoreRank, flagBadgeContainer, modsContainer }.Concat(statisticsLabels)) From bef9637fdf8806f302185fbbc3545c7b85cf0936 Mon Sep 17 00:00:00 2001 From: Willy Tu Date: Mon, 16 Dec 2019 19:25:28 -0800 Subject: [PATCH 015/159] Implemented delete local score individually. Currently does not refresh the score screen after the delete is compelete. --- osu.Game/Online/Leaderboards/Leaderboard.cs | 9 +++-- .../Online/Leaderboards/LeaderboardScore.cs | 34 +++++++------------ .../Select/BeatmapClearScoresDialog.cs | 26 ++++++++++++++ .../Select/Leaderboards/BeatmapLeaderboard.cs | 12 ++++--- 4 files changed, 53 insertions(+), 28 deletions(-) diff --git a/osu.Game/Online/Leaderboards/Leaderboard.cs b/osu.Game/Online/Leaderboards/Leaderboard.cs index 94c50185da..0e2864e88c 100644 --- a/osu.Game/Online/Leaderboards/Leaderboard.cs +++ b/osu.Game/Online/Leaderboards/Leaderboard.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Threading; using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Cursor; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osuTK; @@ -180,10 +181,14 @@ namespace osu.Game.Online.Leaderboards { new Drawable[] { - scrollContainer = new OsuScrollContainer + new OsuContextMenuContainer { RelativeSizeAxes = Axes.Both, - ScrollbarVisible = false, + Child = scrollContainer = new OsuScrollContainer + { + RelativeSizeAxes = Axes.Both, + ScrollbarVisible = false, + } } }, new Drawable[] diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index c4bc306f05..3e5096b051 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -14,11 +14,12 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; using osu.Game.Graphics; -using osu.Game.Graphics.Cursor; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays; using osu.Game.Rulesets.UI; +using osu.Game.Screens.Select; using osu.Game.Scoring; using osu.Game.Users.Drawables; using osuTK; @@ -28,7 +29,7 @@ using osu.Game.Online.API; namespace osu.Game.Online.Leaderboards { - public class LeaderboardScore : OsuClickableContainer + public class LeaderboardScore : OsuClickableContainer, IHasContextMenu { public const float HEIGHT = 60; @@ -53,6 +54,8 @@ namespace osu.Game.Online.Leaderboards private FillFlowContainer modsContainer; private List statisticsLabels; + + private DialogOverlay dialogOverlay; public LeaderboardScore(ScoreInfo score, int rank, bool allowHighlight = true) { @@ -65,9 +68,10 @@ namespace osu.Game.Online.Leaderboards } [BackgroundDependencyLoader] - private void load(IAPIProvider api, OsuColour colour) + private void load(IAPIProvider api, OsuColour colour, DialogOverlay overlay) { var user = score.User; + dialogOverlay = overlay; statisticsLabels = GetStatistics(score).Select(s => new ScoreComponentLabel(s)).ToList(); @@ -230,28 +234,9 @@ namespace osu.Game.Online.Leaderboards }, }; - Add( - new OsuContextMenuContainer - { - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] { - new ContextMenuArea{ - RelativeSizeAxes = Axes.Both - } - } - } - ); - innerAvatar.OnLoadComplete += d => d.FadeInFromZero(200); } - private class ContextMenuArea : Drawable, IHasContextMenu - { - public MenuItem[] ContextMenuItems => new MenuItem[] - { - new OsuMenuItem("Delete", MenuItemType.Destructive), - }; - } public override void Show() { foreach (var d in new[] { avatar, nameLabel, scoreLabel, scoreRank, flagBadgeContainer, modsContainer }.Concat(statisticsLabels)) @@ -381,5 +366,10 @@ namespace osu.Game.Online.Leaderboards Value = value; } } + + public MenuItem[] ContextMenuItems => new MenuItem[] + { + new OsuMenuItem("Delete", MenuItemType.Destructive, () => dialogOverlay?.Push(new BeatmapClearScoresDialog(this.score, null))) + }; } } diff --git a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs index c9b6ca7bb3..b4889bfffc 100644 --- a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs +++ b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs @@ -39,6 +39,32 @@ namespace osu.Game.Screens.Select }; } + public BeatmapClearScoresDialog(ScoreInfo score, Action onCompletion) + { + string accuracy = string.Format(score?.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", score?.Accuracy); + + BodyText = $@"{score?.Beatmap?.Metadata?.Artist} - {score?.Beatmap?.Metadata?.Title} {Environment.NewLine} {score?.User} - Rank: {score?.Rank} - Max Combo: {score?.MaxCombo} - {accuracy} - {score?.Date.Date.ToShortDateString()}"; + + Icon = FontAwesome.Solid.Eraser; + HeaderText = @"Clearing this local score. Are you sure?"; + Buttons = new PopupDialogButton[] + { + new PopupDialogOkButton + { + Text = @"Yes. Please.", + Action = () => + { + Task.Run(() => scoreManager.Delete(score)) + .ContinueWith(_ => onCompletion); + } + }, + new PopupDialogCancelButton + { + Text = @"No, I'm still attached.", + }, + }; + } + [BackgroundDependencyLoader] private void load(ScoreManager scoreManager) { diff --git a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs index 1b45a9d270..d609ee3bdc 100644 --- a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs @@ -182,9 +182,13 @@ namespace osu.Game.Screens.Select.Leaderboards return req; } - protected override LeaderboardScore CreateDrawableScore(ScoreInfo model, int index) => new LeaderboardScore(model, index, IsOnlineScope) - { - Action = () => ScoreSelected?.Invoke(model) - }; + protected override LeaderboardScore CreateDrawableScore(ScoreInfo model, int index){ + model.Beatmap = beatmap; + + return new LeaderboardScore(model, index, IsOnlineScope) + { + Action = () => ScoreSelected?.Invoke(model) + }; + } } } From 8aeef3f59a59747e42bc898cb155048204143ff0 Mon Sep 17 00:00:00 2001 From: wltu Date: Tue, 17 Dec 2019 12:56:30 -0800 Subject: [PATCH 016/159] Added refresh scoreboard upon deleting local score and formatted the code --- .../Online/Leaderboards/LeaderboardScore.cs | 17 +++++++++++++---- .../Screens/Select/BeatmapClearScoresDialog.cs | 6 +----- .../Select/Leaderboards/BeatmapLeaderboard.cs | 10 +++++++--- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index 3e5096b051..ccac748535 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; @@ -54,9 +55,11 @@ namespace osu.Game.Online.Leaderboards private FillFlowContainer modsContainer; private List statisticsLabels; - + private DialogOverlay dialogOverlay; + public Action RefreshAction { get; set; } + public LeaderboardScore(ScoreInfo score, int rank, bool allowHighlight = true) { this.score = score; @@ -367,9 +370,15 @@ namespace osu.Game.Online.Leaderboards } } - public MenuItem[] ContextMenuItems => new MenuItem[] + public MenuItem[] ContextMenuItems { - new OsuMenuItem("Delete", MenuItemType.Destructive, () => dialogOverlay?.Push(new BeatmapClearScoresDialog(this.score, null))) - }; + get + { + return (this.allowHighlight) ? null : new MenuItem[] + { + new OsuMenuItem("Delete", MenuItemType.Destructive, () => dialogOverlay?.Push(new BeatmapClearScoresDialog(this.score, () => Schedule(this.RefreshAction)))) + }; + } + } } } diff --git a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs index b4889bfffc..2c5427993b 100644 --- a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs +++ b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs @@ -52,11 +52,7 @@ namespace osu.Game.Screens.Select new PopupDialogOkButton { Text = @"Yes. Please.", - Action = () => - { - Task.Run(() => scoreManager.Delete(score)) - .ContinueWith(_ => onCompletion); - } + Action = (() => scoreManager.Delete(score)) + onCompletion }, new PopupDialogCancelButton { diff --git a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs index d609ee3bdc..ee360d1e57 100644 --- a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs @@ -15,6 +15,8 @@ using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Scoring; +using osu.Framework.Graphics.UserInterface; + namespace osu.Game.Screens.Select.Leaderboards { public class BeatmapLeaderboard : Leaderboard @@ -182,12 +184,14 @@ namespace osu.Game.Screens.Select.Leaderboards return req; } - protected override LeaderboardScore CreateDrawableScore(ScoreInfo model, int index){ + protected override LeaderboardScore CreateDrawableScore(ScoreInfo model, int index) + { model.Beatmap = beatmap; - + return new LeaderboardScore(model, index, IsOnlineScope) { - Action = () => ScoreSelected?.Invoke(model) + Action = () => ScoreSelected?.Invoke(model), + RefreshAction = () => this.RefreshScores() }; } } From 4646524bf9ff4a3f3923f3a77af9a9fb5f0b08d6 Mon Sep 17 00:00:00 2001 From: wltu Date: Tue, 17 Dec 2019 13:18:20 -0800 Subject: [PATCH 017/159] Remove unnecessary library --- osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs index ee360d1e57..8747bc2d28 100644 --- a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs @@ -15,8 +15,6 @@ using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Scoring; -using osu.Framework.Graphics.UserInterface; - namespace osu.Game.Screens.Select.Leaderboards { public class BeatmapLeaderboard : Leaderboard From 531ac16743edde6d824ae149cd46e26247e12b34 Mon Sep 17 00:00:00 2001 From: Willy Tu Date: Wed, 18 Dec 2019 19:22:42 -0800 Subject: [PATCH 018/159] Update Scoreboard Refresh Method for deleting individual scores --- .../Online/Leaderboards/LeaderboardScore.cs | 11 +++- .../Select/BeatmapClearScoresDialog.cs | 22 ------- .../Select/Leaderboards/BeatmapLeaderboard.cs | 25 +++++++- .../Screens/Select/LocalScoreDeleteDialog.cs | 59 +++++++++++++++++++ 4 files changed, 90 insertions(+), 27 deletions(-) create mode 100644 osu.Game/Screens/Select/LocalScoreDeleteDialog.cs diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index ccac748535..2578b6bbea 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -58,8 +58,6 @@ namespace osu.Game.Online.Leaderboards private DialogOverlay dialogOverlay; - public Action RefreshAction { get; set; } - public LeaderboardScore(ScoreInfo score, int rank, bool allowHighlight = true) { this.score = score; @@ -370,13 +368,20 @@ namespace osu.Game.Online.Leaderboards } } + private void deleteLocalScore(ScoreInfo score) + { + if (score == null || score.ID <= 0) return; + + dialogOverlay?.Push(new LocalScoreDeleteDialog(score)); + } + public MenuItem[] ContextMenuItems { get { return (this.allowHighlight) ? null : new MenuItem[] { - new OsuMenuItem("Delete", MenuItemType.Destructive, () => dialogOverlay?.Push(new BeatmapClearScoresDialog(this.score, () => Schedule(this.RefreshAction)))) + new OsuMenuItem("Delete", MenuItemType.Destructive, () => deleteLocalScore(this.score)) }; } } diff --git a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs index 2c5427993b..c9b6ca7bb3 100644 --- a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs +++ b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs @@ -39,28 +39,6 @@ namespace osu.Game.Screens.Select }; } - public BeatmapClearScoresDialog(ScoreInfo score, Action onCompletion) - { - string accuracy = string.Format(score?.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", score?.Accuracy); - - BodyText = $@"{score?.Beatmap?.Metadata?.Artist} - {score?.Beatmap?.Metadata?.Title} {Environment.NewLine} {score?.User} - Rank: {score?.Rank} - Max Combo: {score?.MaxCombo} - {accuracy} - {score?.Date.Date.ToShortDateString()}"; - - Icon = FontAwesome.Solid.Eraser; - HeaderText = @"Clearing this local score. Are you sure?"; - Buttons = new PopupDialogButton[] - { - new PopupDialogOkButton - { - Text = @"Yes. Please.", - Action = (() => scoreManager.Delete(score)) + onCompletion - }, - new PopupDialogCancelButton - { - Text = @"No, I'm still attached.", - }, - }; - } - [BackgroundDependencyLoader] private void load(ScoreManager scoreManager) { diff --git a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs index 8747bc2d28..751ea7fffd 100644 --- a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs @@ -19,8 +19,10 @@ namespace osu.Game.Screens.Select.Leaderboards { public class BeatmapLeaderboard : Leaderboard { + public Action ScoreSelected; + [Resolved] private RulesetStore rulesets { get; set; } @@ -103,6 +105,8 @@ namespace osu.Game.Screens.Select.Leaderboards { ScoreSelected = s => ScoreSelected?.Invoke(s) }); + + scoreManager.ItemRemoved += deleteLocalScore; } protected override void Reset() @@ -111,6 +115,16 @@ namespace osu.Game.Screens.Select.Leaderboards TopScore = null; } + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + + if (scoreManager != null) + { + scoreManager.ItemRemoved -= deleteLocalScore; + } + } + protected override bool IsOnlineScope => Scope != BeatmapLeaderboardScope.Local; protected override APIRequest FetchScores(Action> scoresCallback) @@ -188,9 +202,16 @@ namespace osu.Game.Screens.Select.Leaderboards return new LeaderboardScore(model, index, IsOnlineScope) { - Action = () => ScoreSelected?.Invoke(model), - RefreshAction = () => this.RefreshScores() + Action = () => ScoreSelected?.Invoke(model) }; } + + private void deleteLocalScore(ScoreInfo score) + { + if (score == null) + return; + + Schedule(() => this.RefreshScores()); + } } } diff --git a/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs b/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs new file mode 100644 index 0000000000..fb0954bdf2 --- /dev/null +++ b/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs @@ -0,0 +1,59 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Game.Overlays.Dialog; +using osu.Game.Scoring; +using System; +using System.Threading.Tasks; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Logging; + +namespace osu.Game.Screens.Select +{ + public class LocalScoreDeleteDialog : PopupDialog + { + private ScoreManager scoreManager; + + public LocalScoreDeleteDialog (ScoreInfo score) + { + try{ + string accuracy = string.Format(score?.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", score?.Accuracy); + + BodyText = $@"{score} {Environment.NewLine} Rank: {score.Rank} - Max Combo: {score.MaxCombo} - {accuracy}"; + Icon = FontAwesome.Solid.Eraser; + HeaderText = @"Clearing this local score. Are you sure?"; + Buttons = new PopupDialogButton[] + { + new PopupDialogOkButton + { + Text = @"Yes. Please.", + Action = () => scoreManager.Delete(score) + }, + new PopupDialogCancelButton + { + Text = @"No, I'm still attached.", + }, + }; + } catch (Exception e){ + Logger.Error(e, "ScoreInfo cannot be null!"); + + HeaderText = $@"ScoreInfo cannot be null!"; + Icon = FontAwesome.Solid.Ambulance; + Buttons = new PopupDialogButton[] + { + new PopupDialogCancelButton + { + Text = @"OK, thanks.", + }, + }; + } + } + + [BackgroundDependencyLoader] + private void load(ScoreManager scoreManager) + { + this.scoreManager = scoreManager; + } + } +} From b67f9860588d1369333d43409ede90b36354ebcb Mon Sep 17 00:00:00 2001 From: Willy Tu Date: Wed, 18 Dec 2019 19:26:35 -0800 Subject: [PATCH 019/159] Fix CodeFactor issues --- .../Screens/Select/Leaderboards/BeatmapLeaderboard.cs | 2 -- osu.Game/Screens/Select/LocalScoreDeleteDialog.cs | 9 ++++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs index 751ea7fffd..df29666a8a 100644 --- a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs @@ -19,10 +19,8 @@ namespace osu.Game.Screens.Select.Leaderboards { public class BeatmapLeaderboard : Leaderboard { - public Action ScoreSelected; - [Resolved] private RulesetStore rulesets { get; set; } diff --git a/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs b/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs index fb0954bdf2..9aa2e5c6e6 100644 --- a/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs +++ b/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs @@ -15,9 +15,10 @@ namespace osu.Game.Screens.Select { private ScoreManager scoreManager; - public LocalScoreDeleteDialog (ScoreInfo score) + public LocalScoreDeleteDialog(ScoreInfo score) { - try{ + try + { string accuracy = string.Format(score?.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", score?.Accuracy); BodyText = $@"{score} {Environment.NewLine} Rank: {score.Rank} - Max Combo: {score.MaxCombo} - {accuracy}"; @@ -35,7 +36,9 @@ namespace osu.Game.Screens.Select Text = @"No, I'm still attached.", }, }; - } catch (Exception e){ + } + catch (Exception e) + { Logger.Error(e, "ScoreInfo cannot be null!"); HeaderText = $@"ScoreInfo cannot be null!"; From 27163a51338a37cb2eee249d7102aca7d5c49547 Mon Sep 17 00:00:00 2001 From: Willy Tu Date: Wed, 18 Dec 2019 21:04:10 -0800 Subject: [PATCH 020/159] Removed unnecessary code for deleting individual local score. --- .../Online/Leaderboards/LeaderboardScore.cs | 7 +-- .../Select/Leaderboards/BeatmapLeaderboard.cs | 5 +- .../Screens/Select/LocalScoreDeleteDialog.cs | 49 +++++++------------ 3 files changed, 20 insertions(+), 41 deletions(-) diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index 2578b6bbea..54eebd69c1 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; @@ -370,8 +369,6 @@ namespace osu.Game.Online.Leaderboards private void deleteLocalScore(ScoreInfo score) { - if (score == null || score.ID <= 0) return; - dialogOverlay?.Push(new LocalScoreDeleteDialog(score)); } @@ -379,9 +376,9 @@ namespace osu.Game.Online.Leaderboards { get { - return (this.allowHighlight) ? null : new MenuItem[] + return (allowHighlight) ? null : new MenuItem[] { - new OsuMenuItem("Delete", MenuItemType.Destructive, () => deleteLocalScore(this.score)) + new OsuMenuItem("Delete", MenuItemType.Destructive, () => deleteLocalScore(score)), }; } } diff --git a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs index df29666a8a..8442e91712 100644 --- a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs @@ -206,10 +206,7 @@ namespace osu.Game.Screens.Select.Leaderboards private void deleteLocalScore(ScoreInfo score) { - if (score == null) - return; - - Schedule(() => this.RefreshScores()); + Schedule(RefreshScores); } } } diff --git a/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs b/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs index 9aa2e5c6e6..635906c08a 100644 --- a/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs +++ b/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs @@ -5,7 +5,7 @@ using osu.Framework.Allocation; using osu.Game.Overlays.Dialog; using osu.Game.Scoring; using System; -using System.Threading.Tasks; +using System.Diagnostics; using osu.Framework.Graphics.Sprites; using osu.Framework.Logging; @@ -17,40 +17,25 @@ namespace osu.Game.Screens.Select public LocalScoreDeleteDialog(ScoreInfo score) { - try - { - string accuracy = string.Format(score?.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", score?.Accuracy); + Debug.Assert(score != null); - BodyText = $@"{score} {Environment.NewLine} Rank: {score.Rank} - Max Combo: {score.MaxCombo} - {accuracy}"; - Icon = FontAwesome.Solid.Eraser; - HeaderText = @"Clearing this local score. Are you sure?"; - Buttons = new PopupDialogButton[] - { - new PopupDialogOkButton - { - Text = @"Yes. Please.", - Action = () => scoreManager.Delete(score) - }, - new PopupDialogCancelButton - { - Text = @"No, I'm still attached.", - }, - }; - } - catch (Exception e) - { - Logger.Error(e, "ScoreInfo cannot be null!"); + string accuracy = string.Format(score.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", score.Accuracy); - HeaderText = $@"ScoreInfo cannot be null!"; - Icon = FontAwesome.Solid.Ambulance; - Buttons = new PopupDialogButton[] + BodyText = $@"{score} {Environment.NewLine} Rank: {score.Rank} - Max Combo: {score.MaxCombo} - {accuracy}"; + Icon = FontAwesome.Solid.Eraser; + HeaderText = @"Deleting this local score. Are you sure?"; + Buttons = new PopupDialogButton[] + { + new PopupDialogOkButton { - new PopupDialogCancelButton - { - Text = @"OK, thanks.", - }, - }; - } + Text = @"Yes. Please.", + Action = () => scoreManager.Delete(score) + }, + new PopupDialogCancelButton + { + Text = @"No, I'm still attached.", + }, + }; } [BackgroundDependencyLoader] From ed07b779b167284f7b51d2031fb67f20bca97eb5 Mon Sep 17 00:00:00 2001 From: Willy Tu Date: Wed, 18 Dec 2019 21:54:02 -0800 Subject: [PATCH 021/159] Update to use score.ID identify local scores --- osu.Game/Online/Leaderboards/LeaderboardScore.cs | 9 +++------ osu.Game/Screens/Select/LocalScoreDeleteDialog.cs | 1 - 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index 54eebd69c1..d2d82d849d 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -374,13 +374,10 @@ namespace osu.Game.Online.Leaderboards public MenuItem[] ContextMenuItems { - get + get => (score.ID == 0) ? null : new MenuItem[] { - return (allowHighlight) ? null : new MenuItem[] - { - new OsuMenuItem("Delete", MenuItemType.Destructive, () => deleteLocalScore(score)), - }; - } + new OsuMenuItem("Delete", MenuItemType.Destructive, () => deleteLocalScore(score)), + }; } } } diff --git a/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs b/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs index 635906c08a..d5f2195c42 100644 --- a/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs +++ b/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs @@ -7,7 +7,6 @@ using osu.Game.Scoring; using System; using System.Diagnostics; using osu.Framework.Graphics.Sprites; -using osu.Framework.Logging; namespace osu.Game.Screens.Select { From 643911ada972f93bcb17d34514b17878dc758a40 Mon Sep 17 00:00:00 2001 From: Willy Tu Date: Wed, 18 Dec 2019 22:41:07 -0800 Subject: [PATCH 022/159] Fix code format for CI --- osu.Game/Online/Leaderboards/LeaderboardScore.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index d2d82d849d..c6a3368a91 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -372,12 +372,18 @@ namespace osu.Game.Online.Leaderboards dialogOverlay?.Push(new LocalScoreDeleteDialog(score)); } + public MenuItem[] ContextMenuItems { - get => (score.ID == 0) ? null : new MenuItem[] + get { - new OsuMenuItem("Delete", MenuItemType.Destructive, () => deleteLocalScore(score)), - }; + List items = new List(); + + if (score.ID != 0) + items.Add(new OsuMenuItem("Delete", MenuItemType.Destructive, () => deleteLocalScore(score))); + + return items.ToArray(); + } } } } From d4d4ddc624c194751e9adbcd319cf42e170798d1 Mon Sep 17 00:00:00 2001 From: Willy Tu Date: Wed, 18 Dec 2019 22:42:26 -0800 Subject: [PATCH 023/159] Remove new line for CodeFactor --- osu.Game/Online/Leaderboards/LeaderboardScore.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index c6a3368a91..c0d366f642 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -372,7 +372,6 @@ namespace osu.Game.Online.Leaderboards dialogOverlay?.Push(new LocalScoreDeleteDialog(score)); } - public MenuItem[] ContextMenuItems { get From 8ab26e8889ee5ca41d129e0aa9e0ba2db7c2fb8a Mon Sep 17 00:00:00 2001 From: Willy Tu Date: Thu, 19 Dec 2019 21:29:54 -0800 Subject: [PATCH 024/159] Update Tests with dependencies on LeaderboardScore. Added its dependency on DialogOverlay for the tests. Added test for deleting individual local score --- .../SongSelect/TestSceneBeatmapLeaderboard.cs | 21 +- .../TestSceneUserTopScoreContainer.cs | 22 +- .../TestSceneDeleteLocalScore.cs | 230 ++++++++++++++++++ .../Online/Leaderboards/LeaderboardScore.cs | 2 +- 4 files changed, 270 insertions(+), 5 deletions(-) create mode 100644 osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs index 57e297bcd5..551fffde54 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs @@ -3,10 +3,12 @@ using System; using System.Collections.Generic; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Leaderboards; +using osu.Game.Overlays; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Scoring; using osu.Game.Screens.Select.Leaderboards; @@ -28,15 +30,22 @@ namespace osu.Game.Tests.Visual.SongSelect private readonly FailableLeaderboard leaderboard; + private DialogOverlay dialogOverlay; + public TestSceneBeatmapLeaderboard() { - Add(leaderboard = new FailableLeaderboard + Add(dialogOverlay = new DialogOverlay() + { + Depth = -1 + }); + + leaderboard = new FailableLeaderboard { Origin = Anchor.Centre, Anchor = Anchor.Centre, Size = new Vector2(550f, 450f), Scope = BeatmapLeaderboardScope.Global, - }); + }; AddStep(@"New Scores", newScores); AddStep(@"Show personal best", showPersonalBest); @@ -281,5 +290,13 @@ namespace osu.Game.Tests.Visual.SongSelect PlaceholderState = state; } } + + [BackgroundDependencyLoader] + private void load() + { + Dependencies.Cache(dialogOverlay); + + Add(leaderboard); + } } } diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs index e34e1844ce..0545f13d44 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs @@ -1,11 +1,13 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osuTK.Graphics; using osu.Game.Online.API.Requests.Responses; +using osu.Game.Overlays; using osu.Game.Scoring; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Screens.Select.Leaderboards; @@ -15,11 +17,19 @@ namespace osu.Game.Tests.Visual.SongSelect { public class TestSceneUserTopScoreContainer : OsuTestScene { + private DialogOverlay dialogOverlay; + private Container container; + public TestSceneUserTopScoreContainer() { UserTopScoreContainer topScoreContainer; - Add(new Container + Add(dialogOverlay = new DialogOverlay() + { + Depth = -1 + }); + + container = new Container { Origin = Anchor.BottomCentre, Anchor = Anchor.Centre, @@ -38,7 +48,7 @@ namespace osu.Game.Tests.Visual.SongSelect Anchor = Anchor.BottomCentre, } } - }); + }; var scores = new[] { @@ -114,5 +124,13 @@ namespace osu.Game.Tests.Visual.SongSelect AddStep(@"Add score(rank 22333)", () => topScoreContainer.Score.Value = scores[2]); AddStep(@"Add null score", () => topScoreContainer.Score.Value = null); } + + [BackgroundDependencyLoader] + private void load() + { + Dependencies.Cache(dialogOverlay); + + Add(container); + } } } diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs new file mode 100644 index 0000000000..5a75cb3e08 --- /dev/null +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs @@ -0,0 +1,230 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using osu.Framework.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Graphics.Sprites; +using osu.Game.Beatmaps; +using osu.Game.Graphics.UserInterface; +using osu.Game.Online.API; +using osu.Game.Online.Leaderboards; +using osu.Game.Overlays; +using osu.Game.Overlays.Dialog; +using osu.Game.Scoring; +using osu.Game.Screens.Select.Leaderboards; +using osu.Game.Users; +using osuTK; +using osuTK.Input; + +namespace osu.Game.Tests.Visual.UserInterface +{ + public class TestSceneDeleteLocalScore : ManualInputManagerTestScene + { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(Placeholder), + typeof(MessagePlaceholder), + typeof(RetrievalFailurePlaceholder), + typeof(UserTopScoreContainer), + typeof(Leaderboard), + typeof(LeaderboardScore), + + }; + + private readonly FailableLeaderboard leaderboard; + + private DialogOverlay dialogOverlay; + + public TestSceneDeleteLocalScore() + { + Add(dialogOverlay = new DialogOverlay() + { + Depth = -1 + }); + + leaderboard = new FailableLeaderboard(dialogOverlay) + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Size = new Vector2(550f, 450f), + Scope = BeatmapLeaderboardScope.Local, + Beatmap = new BeatmapInfo + { + ID = 1, + Metadata = new BeatmapMetadata + { + ID = 1, + Title = "TestSong", + Artist = "TestArtist", + Author = new User + { + Username = "TestAuthor" + }, + }, + Version = "Insane" + }, + }; + + AddStep("Insert Locacl Scores", null); + + TestConfirmDeleteLocalScore(); + TestCancelDeleteLocalScore(); + } + + private void TestConfirmDeleteLocalScore() + { + AddStep("Move to leaderboard", () => InputManager.MoveMouseTo(leaderboard)); + AddStep("Show ContextMenu", () => InputManager.Click(MouseButton.Right)); + AddUntilStep("Wait for ContextMenu", () => typeof(OsuContextMenu) == InputManager.FocusedDrawable.GetType() && InputManager.FocusedDrawable.IsLoaded); + AddStep("Move to Delete Context Menu", () => InputManager.MoveMouseTo(InputManager.FocusedDrawable)); + AddStep("Show Delete Score Dialog", () => InputManager.Click(MouseButton.Left)); + AddUntilStep("Wait for DialogOverlay", () => dialogOverlay.CurrentDialog.IsLoaded); + AddStep("Move to confirm button", () => InputManager.MoveMouseTo(((TestLocalScoreDeleteDialog)dialogOverlay.CurrentDialog).confirmButton)); + AddStep("Confirm Action", () => InputManager.Click(MouseButton.Left)); + AddAssert("Check Score Count", () => leaderboard.ScoreCount() == 49); + } + + private void TestCancelDeleteLocalScore() + { + AddStep("Move to leaderboard", () => InputManager.MoveMouseTo(leaderboard)); + AddStep("Show ContextMenu", () => InputManager.Click(MouseButton.Right)); + AddUntilStep("Wait for ContextMenu", () => typeof(OsuContextMenu) == InputManager.FocusedDrawable.GetType() && InputManager.FocusedDrawable.IsLoaded); + AddStep("Move to Delete Context Menu", () => InputManager.MoveMouseTo(InputManager.FocusedDrawable)); + AddStep("Show Delete Score Dialog", () => InputManager.Click(MouseButton.Left)); + AddUntilStep("Wait for DialogOverlay", () => dialogOverlay.CurrentDialog.IsLoaded); + AddStep("Move to cancel button", () => InputManager.MoveMouseTo(((TestLocalScoreDeleteDialog)dialogOverlay.CurrentDialog).cancelButton)); + AddStep("Cancel Action", () => InputManager.Click(MouseButton.Left)); + AddAssert("Check Score Count", () => leaderboard.ScoreCount() == 49); + } + + [BackgroundDependencyLoader] + private void load() + { + Dependencies.Cache(dialogOverlay); + Add(leaderboard); + } + + private class FailableLeaderboard : BeatmapLeaderboard + { + private DialogOverlay dialogOverlay; + + private List scoreList; + + private Random rnd; + + private bool initialLoad; + + public void DeleteScore(ScoreInfo score) + { + scoreList.Remove(score); + RefreshScores(); + } + + public int ScoreCount() + { + return scoreList.Count; + } + + public FailableLeaderboard(DialogOverlay dialogOverlay) + : base() + { + this.dialogOverlay = dialogOverlay; + initialLoad = true; + } + + public void SetRetrievalState(PlaceholderState state) + { + PlaceholderState = state; + } + + protected override APIRequest FetchScores(Action> scoresCallback) + { + if (initialLoad) + { + rnd = new Random(); + + scoreList = Enumerable.Range(1, 50).Select(createScore).ToList(); + Scores = scoreList.OrderByDescending(s => s.TotalScore).ToArray(); + + initialLoad = false; + } + else + { + Scores = scoreList.OrderByDescending(s => s.TotalScore).ToArray(); + } + + return null; + } + + private ScoreInfo createScore(int id) => new ScoreInfo + { + ID = id, + Accuracy = rnd.NextDouble(), + PP = rnd.Next(1, 1000000), + TotalScore = rnd.Next(1, 1000000), + MaxCombo = rnd.Next(1, 1000), + Rank = ScoreRank.XH, + User = new User { Username = "TestUser" }, + }; + + protected override LeaderboardScore CreateDrawableScore(ScoreInfo model, int index) + { + model.Beatmap = Beatmap; + return new TestLeaderboardScore(model, index, dialogOverlay, this, IsOnlineScope); + } + } + + private class TestLeaderboardScore : LeaderboardScore + { + private DialogOverlay dialogOverlay; + + private FailableLeaderboard leaderboard; + + public TestLeaderboardScore(ScoreInfo score, int rank, DialogOverlay dialogOverlay, FailableLeaderboard leaderboard, bool allowHighlight = true) + : base(score, rank, allowHighlight) + { + this.dialogOverlay = dialogOverlay; + this.leaderboard = leaderboard; + } + + protected override void deleteLocalScore(ScoreInfo score) + { + dialogOverlay?.Push(new TestLocalScoreDeleteDialog(score, leaderboard)); + } + } + + private class TestLocalScoreDeleteDialog : PopupDialog + { + public PopupDialogOkButton confirmButton; + + public PopupDialogCancelButton cancelButton; + + public TestLocalScoreDeleteDialog(ScoreInfo score, FailableLeaderboard leaderboard) + { + Debug.Assert(score != null); + + string accuracy = string.Format(score.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", score.Accuracy); + + BodyText = $@"{score} {Environment.NewLine} Rank: {score.Rank} - Max Combo: {score.MaxCombo} - {accuracy}"; + Icon = FontAwesome.Solid.Eraser; + HeaderText = @"Deleting this local score. Are you sure?"; + Buttons = new PopupDialogButton[] + { + confirmButton = new PopupDialogOkButton + { + Text = @"Yes. Please.", + Action = () => leaderboard.DeleteScore(score) + }, + cancelButton = new PopupDialogCancelButton + { + Text = @"No, I'm still attached.", + }, + }; + } + } + } +} diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index c0d366f642..b706adb8ff 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -367,7 +367,7 @@ namespace osu.Game.Online.Leaderboards } } - private void deleteLocalScore(ScoreInfo score) + protected virtual void deleteLocalScore(ScoreInfo score) { dialogOverlay?.Push(new LocalScoreDeleteDialog(score)); } From e42894cfcf86f6a5a78036b5833f819eed7d7238 Mon Sep 17 00:00:00 2001 From: Willy Tu Date: Thu, 19 Dec 2019 21:32:54 -0800 Subject: [PATCH 025/159] Fixed error for CodeFactor --- osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs index 5a75cb3e08..fbfe3b835e 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs @@ -32,7 +32,6 @@ namespace osu.Game.Tests.Visual.UserInterface typeof(UserTopScoreContainer), typeof(Leaderboard), typeof(LeaderboardScore), - }; private readonly FailableLeaderboard leaderboard; From 6abbd33b512b34cca22eec8b64629b02aa4fbd93 Mon Sep 17 00:00:00 2001 From: Willy Tu Date: Thu, 19 Dec 2019 21:57:14 -0800 Subject: [PATCH 026/159] Fixed CI issues --- .../SongSelect/TestSceneBeatmapLeaderboard.cs | 4 +-- .../TestSceneUserTopScoreContainer.cs | 6 ++--- .../TestSceneDeleteLocalScore.cs | 25 +++++++++---------- .../Online/Leaderboards/LeaderboardScore.cs | 4 +-- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs index 551fffde54..386fadc0d3 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs @@ -30,11 +30,11 @@ namespace osu.Game.Tests.Visual.SongSelect private readonly FailableLeaderboard leaderboard; - private DialogOverlay dialogOverlay; + private readonly DialogOverlay dialogOverlay; public TestSceneBeatmapLeaderboard() { - Add(dialogOverlay = new DialogOverlay() + Add(dialogOverlay = new DialogOverlay { Depth = -1 }); diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs index 0545f13d44..c69626321d 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs @@ -17,14 +17,14 @@ namespace osu.Game.Tests.Visual.SongSelect { public class TestSceneUserTopScoreContainer : OsuTestScene { - private DialogOverlay dialogOverlay; - private Container container; + private readonly DialogOverlay dialogOverlay; + private readonly Container container; public TestSceneUserTopScoreContainer() { UserTopScoreContainer topScoreContainer; - Add(dialogOverlay = new DialogOverlay() + Add(dialogOverlay = new DialogOverlay { Depth = -1 }); diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs index fbfe3b835e..e804891444 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs @@ -36,11 +36,11 @@ namespace osu.Game.Tests.Visual.UserInterface private readonly FailableLeaderboard leaderboard; - private DialogOverlay dialogOverlay; + private readonly DialogOverlay dialogOverlay; public TestSceneDeleteLocalScore() { - Add(dialogOverlay = new DialogOverlay() + Add(dialogOverlay = new DialogOverlay { Depth = -1 }); @@ -70,11 +70,11 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("Insert Locacl Scores", null); - TestConfirmDeleteLocalScore(); - TestCancelDeleteLocalScore(); + testConfirmDeleteLocalScore(); + testCancelDeleteLocalScore(); } - private void TestConfirmDeleteLocalScore() + private void testConfirmDeleteLocalScore() { AddStep("Move to leaderboard", () => InputManager.MoveMouseTo(leaderboard)); AddStep("Show ContextMenu", () => InputManager.Click(MouseButton.Right)); @@ -87,7 +87,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddAssert("Check Score Count", () => leaderboard.ScoreCount() == 49); } - private void TestCancelDeleteLocalScore() + private void testCancelDeleteLocalScore() { AddStep("Move to leaderboard", () => InputManager.MoveMouseTo(leaderboard)); AddStep("Show ContextMenu", () => InputManager.Click(MouseButton.Right)); @@ -109,7 +109,7 @@ namespace osu.Game.Tests.Visual.UserInterface private class FailableLeaderboard : BeatmapLeaderboard { - private DialogOverlay dialogOverlay; + private readonly DialogOverlay dialogOverlay; private List scoreList; @@ -129,7 +129,6 @@ namespace osu.Game.Tests.Visual.UserInterface } public FailableLeaderboard(DialogOverlay dialogOverlay) - : base() { this.dialogOverlay = dialogOverlay; initialLoad = true; @@ -179,9 +178,9 @@ namespace osu.Game.Tests.Visual.UserInterface private class TestLeaderboardScore : LeaderboardScore { - private DialogOverlay dialogOverlay; + private readonly DialogOverlay dialogOverlay; - private FailableLeaderboard leaderboard; + private readonly FailableLeaderboard leaderboard; public TestLeaderboardScore(ScoreInfo score, int rank, DialogOverlay dialogOverlay, FailableLeaderboard leaderboard, bool allowHighlight = true) : base(score, rank, allowHighlight) @@ -190,7 +189,7 @@ namespace osu.Game.Tests.Visual.UserInterface this.leaderboard = leaderboard; } - protected override void deleteLocalScore(ScoreInfo score) + protected override void DeleteLocalScore(ScoreInfo score) { dialogOverlay?.Push(new TestLocalScoreDeleteDialog(score, leaderboard)); } @@ -198,9 +197,9 @@ namespace osu.Game.Tests.Visual.UserInterface private class TestLocalScoreDeleteDialog : PopupDialog { - public PopupDialogOkButton confirmButton; + public readonly PopupDialogOkButton confirmButton; - public PopupDialogCancelButton cancelButton; + public readonly PopupDialogCancelButton cancelButton; public TestLocalScoreDeleteDialog(ScoreInfo score, FailableLeaderboard leaderboard) { diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index b706adb8ff..b49a8bf483 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -367,7 +367,7 @@ namespace osu.Game.Online.Leaderboards } } - protected virtual void deleteLocalScore(ScoreInfo score) + protected virtual void DeleteLocalScore(ScoreInfo score) { dialogOverlay?.Push(new LocalScoreDeleteDialog(score)); } @@ -379,7 +379,7 @@ namespace osu.Game.Online.Leaderboards List items = new List(); if (score.ID != 0) - items.Add(new OsuMenuItem("Delete", MenuItemType.Destructive, () => deleteLocalScore(score))); + items.Add(new OsuMenuItem("Delete", MenuItemType.Destructive, () => DeleteLocalScore(score))); return items.ToArray(); } From 6672cf60590f101acb7d7c7871597d2a9b039df4 Mon Sep 17 00:00:00 2001 From: Willy Tu Date: Thu, 19 Dec 2019 22:22:46 -0800 Subject: [PATCH 027/159] Update variable name --- .../Visual/UserInterface/TestSceneDeleteLocalScore.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs index e804891444..635ad904e3 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs @@ -82,7 +82,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("Move to Delete Context Menu", () => InputManager.MoveMouseTo(InputManager.FocusedDrawable)); AddStep("Show Delete Score Dialog", () => InputManager.Click(MouseButton.Left)); AddUntilStep("Wait for DialogOverlay", () => dialogOverlay.CurrentDialog.IsLoaded); - AddStep("Move to confirm button", () => InputManager.MoveMouseTo(((TestLocalScoreDeleteDialog)dialogOverlay.CurrentDialog).confirmButton)); + AddStep("Move to confirm button", () => InputManager.MoveMouseTo(((TestLocalScoreDeleteDialog)dialogOverlay.CurrentDialog).ConfirmButton)); AddStep("Confirm Action", () => InputManager.Click(MouseButton.Left)); AddAssert("Check Score Count", () => leaderboard.ScoreCount() == 49); } @@ -95,7 +95,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("Move to Delete Context Menu", () => InputManager.MoveMouseTo(InputManager.FocusedDrawable)); AddStep("Show Delete Score Dialog", () => InputManager.Click(MouseButton.Left)); AddUntilStep("Wait for DialogOverlay", () => dialogOverlay.CurrentDialog.IsLoaded); - AddStep("Move to cancel button", () => InputManager.MoveMouseTo(((TestLocalScoreDeleteDialog)dialogOverlay.CurrentDialog).cancelButton)); + AddStep("Move to cancel button", () => InputManager.MoveMouseTo(((TestLocalScoreDeleteDialog)dialogOverlay.CurrentDialog).CancelButton)); AddStep("Cancel Action", () => InputManager.Click(MouseButton.Left)); AddAssert("Check Score Count", () => leaderboard.ScoreCount() == 49); } @@ -197,9 +197,9 @@ namespace osu.Game.Tests.Visual.UserInterface private class TestLocalScoreDeleteDialog : PopupDialog { - public readonly PopupDialogOkButton confirmButton; + public readonly PopupDialogOkButton ConfirmButton; - public readonly PopupDialogCancelButton cancelButton; + public readonly PopupDialogCancelButton CancelButton; public TestLocalScoreDeleteDialog(ScoreInfo score, FailableLeaderboard leaderboard) { From afc11aa547b8401cf0b22f5478e186cabdc61762 Mon Sep 17 00:00:00 2001 From: Willy Tu Date: Thu, 19 Dec 2019 22:37:09 -0800 Subject: [PATCH 028/159] Fixed issues caused by renaming variables --- .../Visual/UserInterface/TestSceneDeleteLocalScore.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs index 635ad904e3..da91051175 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs @@ -212,12 +212,12 @@ namespace osu.Game.Tests.Visual.UserInterface HeaderText = @"Deleting this local score. Are you sure?"; Buttons = new PopupDialogButton[] { - confirmButton = new PopupDialogOkButton + ConfirmButton = new PopupDialogOkButton { Text = @"Yes. Please.", Action = () => leaderboard.DeleteScore(score) }, - cancelButton = new PopupDialogCancelButton + CancelButton = new PopupDialogCancelButton { Text = @"No, I'm still attached.", }, From ba2cff60ca15827c16836ff9f222452e15a01499 Mon Sep 17 00:00:00 2001 From: Willy Tu Date: Fri, 20 Dec 2019 02:13:49 -0800 Subject: [PATCH 029/159] Removed Automation Testing steps for delete local scores. Only manual testing now. --- .../TestSceneDeleteLocalScore.cs | 60 +++++-------------- 1 file changed, 16 insertions(+), 44 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs index da91051175..0441d8659e 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs @@ -9,7 +9,6 @@ using osu.Framework.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps; -using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Online.Leaderboards; using osu.Game.Overlays; @@ -18,7 +17,6 @@ using osu.Game.Scoring; using osu.Game.Screens.Select.Leaderboards; using osu.Game.Users; using osuTK; -using osuTK.Input; namespace osu.Game.Tests.Visual.UserInterface { @@ -45,7 +43,7 @@ namespace osu.Game.Tests.Visual.UserInterface Depth = -1 }); - leaderboard = new FailableLeaderboard(dialogOverlay) + leaderboard = new FailableLeaderboard { Origin = Anchor.Centre, Anchor = Anchor.Centre, @@ -68,36 +66,13 @@ namespace osu.Game.Tests.Visual.UserInterface }, }; - AddStep("Insert Locacl Scores", null); - - testConfirmDeleteLocalScore(); - testCancelDeleteLocalScore(); + AddStep("Insert Local Scores", () => reset()); } - private void testConfirmDeleteLocalScore() + private void reset() { - AddStep("Move to leaderboard", () => InputManager.MoveMouseTo(leaderboard)); - AddStep("Show ContextMenu", () => InputManager.Click(MouseButton.Right)); - AddUntilStep("Wait for ContextMenu", () => typeof(OsuContextMenu) == InputManager.FocusedDrawable.GetType() && InputManager.FocusedDrawable.IsLoaded); - AddStep("Move to Delete Context Menu", () => InputManager.MoveMouseTo(InputManager.FocusedDrawable)); - AddStep("Show Delete Score Dialog", () => InputManager.Click(MouseButton.Left)); - AddUntilStep("Wait for DialogOverlay", () => dialogOverlay.CurrentDialog.IsLoaded); - AddStep("Move to confirm button", () => InputManager.MoveMouseTo(((TestLocalScoreDeleteDialog)dialogOverlay.CurrentDialog).ConfirmButton)); - AddStep("Confirm Action", () => InputManager.Click(MouseButton.Left)); - AddAssert("Check Score Count", () => leaderboard.ScoreCount() == 49); - } - - private void testCancelDeleteLocalScore() - { - AddStep("Move to leaderboard", () => InputManager.MoveMouseTo(leaderboard)); - AddStep("Show ContextMenu", () => InputManager.Click(MouseButton.Right)); - AddUntilStep("Wait for ContextMenu", () => typeof(OsuContextMenu) == InputManager.FocusedDrawable.GetType() && InputManager.FocusedDrawable.IsLoaded); - AddStep("Move to Delete Context Menu", () => InputManager.MoveMouseTo(InputManager.FocusedDrawable)); - AddStep("Show Delete Score Dialog", () => InputManager.Click(MouseButton.Left)); - AddUntilStep("Wait for DialogOverlay", () => dialogOverlay.CurrentDialog.IsLoaded); - AddStep("Move to cancel button", () => InputManager.MoveMouseTo(((TestLocalScoreDeleteDialog)dialogOverlay.CurrentDialog).CancelButton)); - AddStep("Cancel Action", () => InputManager.Click(MouseButton.Left)); - AddAssert("Check Score Count", () => leaderboard.ScoreCount() == 49); + leaderboard.initialLoad = true; + leaderboard.RefreshScores(); } [BackgroundDependencyLoader] @@ -109,13 +84,11 @@ namespace osu.Game.Tests.Visual.UserInterface private class FailableLeaderboard : BeatmapLeaderboard { - private readonly DialogOverlay dialogOverlay; - private List scoreList; private Random rnd; - private bool initialLoad; + public bool initialLoad; public void DeleteScore(ScoreInfo score) { @@ -123,14 +96,8 @@ namespace osu.Game.Tests.Visual.UserInterface RefreshScores(); } - public int ScoreCount() + public FailableLeaderboard() { - return scoreList.Count; - } - - public FailableLeaderboard(DialogOverlay dialogOverlay) - { - this.dialogOverlay = dialogOverlay; initialLoad = true; } @@ -172,20 +139,19 @@ namespace osu.Game.Tests.Visual.UserInterface protected override LeaderboardScore CreateDrawableScore(ScoreInfo model, int index) { model.Beatmap = Beatmap; - return new TestLeaderboardScore(model, index, dialogOverlay, this, IsOnlineScope); + return new TestLeaderboardScore(model, index, this, IsOnlineScope); } } private class TestLeaderboardScore : LeaderboardScore { - private readonly DialogOverlay dialogOverlay; + private DialogOverlay dialogOverlay; private readonly FailableLeaderboard leaderboard; - public TestLeaderboardScore(ScoreInfo score, int rank, DialogOverlay dialogOverlay, FailableLeaderboard leaderboard, bool allowHighlight = true) + public TestLeaderboardScore(ScoreInfo score, int rank, FailableLeaderboard leaderboard, bool allowHighlight = true) : base(score, rank, allowHighlight) { - this.dialogOverlay = dialogOverlay; this.leaderboard = leaderboard; } @@ -193,6 +159,12 @@ namespace osu.Game.Tests.Visual.UserInterface { dialogOverlay?.Push(new TestLocalScoreDeleteDialog(score, leaderboard)); } + + [BackgroundDependencyLoader] + private void load(DialogOverlay dialogOverlay) + { + this.dialogOverlay = dialogOverlay; + } } private class TestLocalScoreDeleteDialog : PopupDialog From a55e5c5c437da004583e22e4297632f5e29d376e Mon Sep 17 00:00:00 2001 From: Willy Tu Date: Fri, 20 Dec 2019 11:16:54 -0800 Subject: [PATCH 030/159] Removed unnecessary code --- .../TestSceneDeleteLocalScore.cs | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs index 0441d8659e..6ca75ea9cb 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs @@ -66,12 +66,12 @@ namespace osu.Game.Tests.Visual.UserInterface }, }; - AddStep("Insert Local Scores", () => reset()); + AddStep("Insert Local Scores", reset); } private void reset() { - leaderboard.initialLoad = true; + leaderboard.InitialLoad = true; leaderboard.RefreshScores(); } @@ -88,7 +88,7 @@ namespace osu.Game.Tests.Visual.UserInterface private Random rnd; - public bool initialLoad; + public bool InitialLoad; public void DeleteScore(ScoreInfo score) { @@ -98,7 +98,7 @@ namespace osu.Game.Tests.Visual.UserInterface public FailableLeaderboard() { - initialLoad = true; + InitialLoad = true; } public void SetRetrievalState(PlaceholderState state) @@ -108,14 +108,14 @@ namespace osu.Game.Tests.Visual.UserInterface protected override APIRequest FetchScores(Action> scoresCallback) { - if (initialLoad) + if (InitialLoad) { rnd = new Random(); scoreList = Enumerable.Range(1, 50).Select(createScore).ToList(); Scores = scoreList.OrderByDescending(s => s.TotalScore).ToArray(); - initialLoad = false; + InitialLoad = false; } else { @@ -169,10 +169,6 @@ namespace osu.Game.Tests.Visual.UserInterface private class TestLocalScoreDeleteDialog : PopupDialog { - public readonly PopupDialogOkButton ConfirmButton; - - public readonly PopupDialogCancelButton CancelButton; - public TestLocalScoreDeleteDialog(ScoreInfo score, FailableLeaderboard leaderboard) { Debug.Assert(score != null); @@ -184,12 +180,12 @@ namespace osu.Game.Tests.Visual.UserInterface HeaderText = @"Deleting this local score. Are you sure?"; Buttons = new PopupDialogButton[] { - ConfirmButton = new PopupDialogOkButton + new PopupDialogOkButton { Text = @"Yes. Please.", Action = () => leaderboard.DeleteScore(score) }, - CancelButton = new PopupDialogCancelButton + new PopupDialogCancelButton { Text = @"No, I'm still attached.", }, From 8353c893c07200bc6a97f00b3153e17c446b0b0b Mon Sep 17 00:00:00 2001 From: Willy Tu Date: Fri, 20 Dec 2019 12:00:10 -0800 Subject: [PATCH 031/159] Update BodyText of LocalScoreDeleteDialog --- .../Visual/UserInterface/TestSceneDeleteLocalScore.cs | 2 +- osu.Game/Screens/Select/LocalScoreDeleteDialog.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs index 6ca75ea9cb..2369b22ec2 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs @@ -175,7 +175,7 @@ namespace osu.Game.Tests.Visual.UserInterface string accuracy = string.Format(score.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", score.Accuracy); - BodyText = $@"{score} {Environment.NewLine} Rank: {score.Rank} - Max Combo: {score.MaxCombo} - {accuracy}"; + BodyText = $@"{score.User}'s {accuracy} {score.Rank} Rank on {score.Beatmap}"; Icon = FontAwesome.Solid.Eraser; HeaderText = @"Deleting this local score. Are you sure?"; Buttons = new PopupDialogButton[] diff --git a/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs b/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs index d5f2195c42..3f52b54e64 100644 --- a/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs +++ b/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs @@ -20,7 +20,7 @@ namespace osu.Game.Screens.Select string accuracy = string.Format(score.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", score.Accuracy); - BodyText = $@"{score} {Environment.NewLine} Rank: {score.Rank} - Max Combo: {score.MaxCombo} - {accuracy}"; + BodyText = $@"{score.User}'s {accuracy} {score.Rank} Rank on {score.Beatmap}"; Icon = FontAwesome.Solid.Eraser; HeaderText = @"Deleting this local score. Are you sure?"; Buttons = new PopupDialogButton[] From 8e60ae70393e891776cee0f2431eb927b8eef007 Mon Sep 17 00:00:00 2001 From: Willy Tu Date: Fri, 20 Dec 2019 15:45:20 -0800 Subject: [PATCH 032/159] Removed directive is not required --- osu.Game/Screens/Select/LocalScoreDeleteDialog.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs b/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs index 3f52b54e64..514c5adf95 100644 --- a/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs +++ b/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs @@ -4,7 +4,6 @@ using osu.Framework.Allocation; using osu.Game.Overlays.Dialog; using osu.Game.Scoring; -using System; using System.Diagnostics; using osu.Framework.Graphics.Sprites; From 7b71e568177f1d827316dd3930ac64fd2921f5c0 Mon Sep 17 00:00:00 2001 From: Craftplacer Date: Thu, 2 Jan 2020 17:07:28 +0100 Subject: [PATCH 033/159] Initial commit --- .../API/Requests/MarkChannelAsReadRequest.cs | 21 +++++++++++++++++++ osu.Game/Online/Chat/Channel.cs | 8 +++++++ osu.Game/Online/Chat/ChannelManager.cs | 8 +++++++ 3 files changed, 37 insertions(+) create mode 100644 osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs diff --git a/osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs b/osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs new file mode 100644 index 0000000000..3f28037816 --- /dev/null +++ b/osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs @@ -0,0 +1,21 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Online.Chat; + +namespace osu.Game.Online.API.Requests +{ + public class MarkChannelAsReadRequest : APIRequest + { + private readonly Channel channel; + private readonly Message message; + + public MarkChannelAsReadRequest(Channel channel, Message message) + { + this.channel = channel; + this.message = message; + } + + protected override string Target => @"/chat/channels/{channel}/mark-as-read/{message}"; + } +} diff --git a/osu.Game/Online/Chat/Channel.cs b/osu.Game/Online/Chat/Channel.cs index 451174a73c..6f67a95f53 100644 --- a/osu.Game/Online/Chat/Channel.cs +++ b/osu.Game/Online/Chat/Channel.cs @@ -36,6 +36,11 @@ namespace osu.Game.Online.Chat /// public readonly SortedList Messages = new SortedList(Comparer.Default); + /// + /// Contains all the messages that weren't read by the user. + /// + public IEnumerable UnreadMessages => Messages.Where(m => LastReadId < m.Id); + /// /// Contains all the messages that are still pending for submission to the server. /// @@ -75,6 +80,9 @@ namespace osu.Game.Online.Chat [JsonProperty(@"last_message_id")] public long? LastMessageId; + [JsonProperty(@"last_read_id")] + public long? LastReadId; + /// /// Signalles if the current user joined this channel or not. Defaults to false. /// diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 1d8c5609d9..e92a4853ff 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -445,6 +445,14 @@ namespace osu.Game.Online.Chat return tcs.Task; } + public void MarkChannelAsRead(Message message) + { + var channel = JoinedChannels.First(c => c.Id == message.ChannelId); + var req = new MarkChannelAsReadRequest(channel, message); + req.Success += () => channel.LastReadId = message.Id; + api.Queue(req); + } + [BackgroundDependencyLoader] private void load(IAPIProvider api) { From 51556a809d578f159387664cf23ce26a856643b1 Mon Sep 17 00:00:00 2001 From: Craftplacer Date: Thu, 2 Jan 2020 17:20:33 +0100 Subject: [PATCH 034/159] Fix variables not being used inside target string --- osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs b/osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs index 3f28037816..76c925588b 100644 --- a/osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs +++ b/osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs @@ -16,6 +16,6 @@ namespace osu.Game.Online.API.Requests this.message = message; } - protected override string Target => @"/chat/channels/{channel}/mark-as-read/{message}"; + protected override string Target => $"/chat/channels/{channel}/mark-as-read/{message}"; } } From e23c71be803ddc3f30d1070d3c1fe2bdd04ee6c9 Mon Sep 17 00:00:00 2001 From: Willy Tu Date: Fri, 3 Jan 2020 11:34:26 -0800 Subject: [PATCH 035/159] Update Resolved and Cached attribute issues --- .../SongSelect/TestSceneBeatmapLeaderboard.cs | 13 +++--------- .../TestSceneUserTopScoreContainer.cs | 14 +++---------- .../TestSceneDeleteLocalScore.cs | 21 +++++-------------- .../Online/Leaderboards/LeaderboardScore.cs | 6 +++--- .../Select/BeatmapClearScoresDialog.cs | 9 ++------ .../Screens/Select/LocalScoreDeleteDialog.cs | 9 ++------ 6 files changed, 18 insertions(+), 54 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs index 386fadc0d3..6ae0a80123 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs @@ -30,6 +30,7 @@ namespace osu.Game.Tests.Visual.SongSelect private readonly FailableLeaderboard leaderboard; + [Cached] private readonly DialogOverlay dialogOverlay; public TestSceneBeatmapLeaderboard() @@ -39,13 +40,13 @@ namespace osu.Game.Tests.Visual.SongSelect Depth = -1 }); - leaderboard = new FailableLeaderboard + Add(leaderboard = new FailableLeaderboard { Origin = Anchor.Centre, Anchor = Anchor.Centre, Size = new Vector2(550f, 450f), Scope = BeatmapLeaderboardScope.Global, - }; + }); AddStep(@"New Scores", newScores); AddStep(@"Show personal best", showPersonalBest); @@ -290,13 +291,5 @@ namespace osu.Game.Tests.Visual.SongSelect PlaceholderState = state; } } - - [BackgroundDependencyLoader] - private void load() - { - Dependencies.Cache(dialogOverlay); - - Add(leaderboard); - } } } diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs index c69626321d..0598324110 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs @@ -17,8 +17,8 @@ namespace osu.Game.Tests.Visual.SongSelect { public class TestSceneUserTopScoreContainer : OsuTestScene { + [Cached] private readonly DialogOverlay dialogOverlay; - private readonly Container container; public TestSceneUserTopScoreContainer() { @@ -29,7 +29,7 @@ namespace osu.Game.Tests.Visual.SongSelect Depth = -1 }); - container = new Container + Add(new Container { Origin = Anchor.BottomCentre, Anchor = Anchor.Centre, @@ -48,7 +48,7 @@ namespace osu.Game.Tests.Visual.SongSelect Anchor = Anchor.BottomCentre, } } - }; + }); var scores = new[] { @@ -124,13 +124,5 @@ namespace osu.Game.Tests.Visual.SongSelect AddStep(@"Add score(rank 22333)", () => topScoreContainer.Score.Value = scores[2]); AddStep(@"Add null score", () => topScoreContainer.Score.Value = null); } - - [BackgroundDependencyLoader] - private void load() - { - Dependencies.Cache(dialogOverlay); - - Add(container); - } } } diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs index 2369b22ec2..de10eaccca 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs @@ -34,6 +34,7 @@ namespace osu.Game.Tests.Visual.UserInterface private readonly FailableLeaderboard leaderboard; + [Cached] private readonly DialogOverlay dialogOverlay; public TestSceneDeleteLocalScore() @@ -43,7 +44,7 @@ namespace osu.Game.Tests.Visual.UserInterface Depth = -1 }); - leaderboard = new FailableLeaderboard + Add(leaderboard = new FailableLeaderboard { Origin = Anchor.Centre, Anchor = Anchor.Centre, @@ -64,7 +65,7 @@ namespace osu.Game.Tests.Visual.UserInterface }, Version = "Insane" }, - }; + }); AddStep("Insert Local Scores", reset); } @@ -75,13 +76,6 @@ namespace osu.Game.Tests.Visual.UserInterface leaderboard.RefreshScores(); } - [BackgroundDependencyLoader] - private void load() - { - Dependencies.Cache(dialogOverlay); - Add(leaderboard); - } - private class FailableLeaderboard : BeatmapLeaderboard { private List scoreList; @@ -145,7 +139,8 @@ namespace osu.Game.Tests.Visual.UserInterface private class TestLeaderboardScore : LeaderboardScore { - private DialogOverlay dialogOverlay; + [Resolved] + private DialogOverlay dialogOverlay { get; set; } private readonly FailableLeaderboard leaderboard; @@ -159,12 +154,6 @@ namespace osu.Game.Tests.Visual.UserInterface { dialogOverlay?.Push(new TestLocalScoreDeleteDialog(score, leaderboard)); } - - [BackgroundDependencyLoader] - private void load(DialogOverlay dialogOverlay) - { - this.dialogOverlay = dialogOverlay; - } } private class TestLocalScoreDeleteDialog : PopupDialog diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index b49a8bf483..7e24dc990b 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -55,7 +55,8 @@ namespace osu.Game.Online.Leaderboards private List statisticsLabels; - private DialogOverlay dialogOverlay; + [Resolved] + private DialogOverlay dialogOverlay { get; set; } public LeaderboardScore(ScoreInfo score, int rank, bool allowHighlight = true) { @@ -68,10 +69,9 @@ namespace osu.Game.Online.Leaderboards } [BackgroundDependencyLoader] - private void load(IAPIProvider api, OsuColour colour, DialogOverlay overlay) + private void load(IAPIProvider api, OsuColour colour) { var user = score.User; - dialogOverlay = overlay; statisticsLabels = GetStatistics(score).Select(s => new ScoreComponentLabel(s)).ToList(); diff --git a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs index c9b6ca7bb3..b32416b361 100644 --- a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs +++ b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs @@ -14,7 +14,8 @@ namespace osu.Game.Screens.Select { public class BeatmapClearScoresDialog : PopupDialog { - private ScoreManager scoreManager; + [Resolved] + private ScoreManager scoreManager { get; set; } public BeatmapClearScoresDialog(BeatmapInfo beatmap, Action onCompletion) { @@ -38,11 +39,5 @@ namespace osu.Game.Screens.Select }, }; } - - [BackgroundDependencyLoader] - private void load(ScoreManager scoreManager) - { - this.scoreManager = scoreManager; - } } } diff --git a/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs b/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs index 514c5adf95..c1d680fd45 100644 --- a/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs +++ b/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs @@ -11,7 +11,8 @@ namespace osu.Game.Screens.Select { public class LocalScoreDeleteDialog : PopupDialog { - private ScoreManager scoreManager; + [Resolved] + private ScoreManager scoreManager { get; set; } public LocalScoreDeleteDialog(ScoreInfo score) { @@ -35,11 +36,5 @@ namespace osu.Game.Screens.Select }, }; } - - [BackgroundDependencyLoader] - private void load(ScoreManager scoreManager) - { - this.scoreManager = scoreManager; - } } } From 9b95ce1045e0d1eba172e41cf96367e656bedffd Mon Sep 17 00:00:00 2001 From: Craftplacer Date: Sat, 4 Jan 2020 00:45:02 +0100 Subject: [PATCH 036/159] Change wrong values used to form target URL Dumb mistake by me, C# used ToString() on these objects. --- osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs b/osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs index 76c925588b..689fd7e485 100644 --- a/osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs +++ b/osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs @@ -16,6 +16,6 @@ namespace osu.Game.Online.API.Requests this.message = message; } - protected override string Target => $"/chat/channels/{channel}/mark-as-read/{message}"; + protected override string Target => $"chat/channels/{channel.Id}/mark-as-read/{message.Id}"; } } From 8dbddfab559830ffe19f3c675af4ca0367a296d3 Mon Sep 17 00:00:00 2001 From: Craftplacer Date: Sat, 4 Jan 2020 00:45:51 +0100 Subject: [PATCH 037/159] Add HTTP method --- osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs b/osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs index 689fd7e485..95a5d0acbd 100644 --- a/osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs +++ b/osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Net.Http; +using osu.Framework.IO.Network; using osu.Game.Online.Chat; namespace osu.Game.Online.API.Requests @@ -17,5 +19,12 @@ namespace osu.Game.Online.API.Requests } protected override string Target => $"chat/channels/{channel.Id}/mark-as-read/{message.Id}"; + + protected override WebRequest CreateWebRequest() + { + var req = base.CreateWebRequest(); + req.Method = HttpMethod.Put; + return req; + } } } From 4f36bc0fd399a69194d10535ea9c61c8c51f395d Mon Sep 17 00:00:00 2001 From: Craftplacer Date: Sat, 4 Jan 2020 00:49:35 +0100 Subject: [PATCH 038/159] Add error log message for debugging --- osu.Game/Online/Chat/ChannelManager.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index e92a4853ff..6eb1674f37 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -450,6 +450,7 @@ namespace osu.Game.Online.Chat var channel = JoinedChannels.First(c => c.Id == message.ChannelId); var req = new MarkChannelAsReadRequest(channel, message); req.Success += () => channel.LastReadId = message.Id; + req.Failure += (e) => Logger.Error(e, "Failed to mark channel as read"); api.Queue(req); } From 7cc388b5abc56b5d49d9fabe9596db1701b22641 Mon Sep 17 00:00:00 2001 From: Craftplacer Date: Sat, 4 Jan 2020 00:50:12 +0100 Subject: [PATCH 039/159] Mark channel up to last message as read when switching channels --- osu.Game/Overlays/ChatOverlay.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index e80c51d82a..b64d3a1893 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -279,6 +279,10 @@ namespace osu.Game.Overlays currentChannelContainer.Clear(false); currentChannelContainer.Add(loaded); } + + // mark channel as read when channel switched + if (e.NewValue.Messages.Any()) + channelManager.MarkChannelAsRead(e.NewValue.Messages.Last()); } private float startDragChatHeight; From cd91cc860d52f029fc77b32034eb966cf4a08bba Mon Sep 17 00:00:00 2001 From: Craftplacer Date: Sat, 4 Jan 2020 01:06:38 +0100 Subject: [PATCH 040/159] Resolve "Redundant lambda signature parentheses" --- osu.Game/Online/Chat/ChannelManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 6eb1674f37..19c3be0d7b 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -450,7 +450,7 @@ namespace osu.Game.Online.Chat var channel = JoinedChannels.First(c => c.Id == message.ChannelId); var req = new MarkChannelAsReadRequest(channel, message); req.Success += () => channel.LastReadId = message.Id; - req.Failure += (e) => Logger.Error(e, "Failed to mark channel as read"); + req.Failure += e => Logger.Error(e, "Failed to mark channel as read"); api.Queue(req); } From 9da7eec0d91f4779c98ec094c321eba952440884 Mon Sep 17 00:00:00 2001 From: Sebastian Krajewski Date: Sat, 4 Jan 2020 08:21:48 +0100 Subject: [PATCH 041/159] Add pulse to slider reverse arrows --- .../Objects/Drawables/DrawableRepeatPoint.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs index b81d94a673..db8ad98f8a 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs @@ -65,12 +65,18 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected override void UpdateInitialTransforms() { - animDuration = Math.Min(150, repeatPoint.SpanDuration / 2); + animDuration = Math.Min(300, repeatPoint.SpanDuration); - this.Animate( - d => d.FadeIn(animDuration), - d => d.ScaleTo(0.5f).ScaleTo(1f, animDuration * 4, Easing.OutElasticHalf) - ); + this.FadeIn(animDuration); + + double fadeInStart = repeatPoint.StartTime - 2 * repeatPoint.SpanDuration; + + // We want first repeat arrow to start pulsing during snake in + if (repeatPoint.RepeatIndex == 0) + fadeInStart -= repeatPoint.TimePreempt; + + for (double pulseStartTime = fadeInStart; pulseStartTime < repeatPoint.StartTime; pulseStartTime += 300) + this.Delay(pulseStartTime - LifetimeStart).ScaleTo(1.3f).ScaleTo(1f, Math.Min(300, repeatPoint.StartTime - pulseStartTime)); } protected override void UpdateStateTransforms(ArmedState state) @@ -88,7 +94,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables break; case ArmedState.Hit: - this.FadeOut(animDuration, Easing.OutQuint) + this.FadeOut(animDuration, Easing.Out) .ScaleTo(Scale * 1.5f, animDuration, Easing.Out); break; } From fc0b622a69dc20e0104536d58b15f5a5f67cf45d Mon Sep 17 00:00:00 2001 From: Sebastian Krajewski Date: Sat, 4 Jan 2020 10:35:10 +0100 Subject: [PATCH 042/159] Change reverse arrow pulse easing to OutQuad --- .../Objects/Drawables/DrawableRepeatPoint.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs index db8ad98f8a..e1cacfaaff 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; @@ -76,7 +76,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables fadeInStart -= repeatPoint.TimePreempt; for (double pulseStartTime = fadeInStart; pulseStartTime < repeatPoint.StartTime; pulseStartTime += 300) - this.Delay(pulseStartTime - LifetimeStart).ScaleTo(1.3f).ScaleTo(1f, Math.Min(300, repeatPoint.StartTime - pulseStartTime)); + this.Delay(pulseStartTime - LifetimeStart).ScaleTo(1.3f).ScaleTo(1f, Math.Min(300, repeatPoint.StartTime - pulseStartTime), Easing.Out); } protected override void UpdateStateTransforms(ArmedState state) From 46271ccbc89e2a55059cda1070d1599321427bca Mon Sep 17 00:00:00 2001 From: Sebastian Krajewski Date: Sat, 4 Jan 2020 13:01:42 +0100 Subject: [PATCH 043/159] Add slider reverse arrow pulse settings --- .../Configuration/OsuRulesetConfigManager.cs | 5 +- .../Objects/Drawables/DrawableRepeatPoint.cs | 43 +++++++------- .../Drawables/Pieces/ReverseArrowPiece.cs | 58 +++++++++++++++++++ .../UI/OsuSettingsSubsection.cs | 5 ++ .../UI/ReverseArrowPulseMode.cs | 18 ++++++ 5 files changed, 108 insertions(+), 21 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs create mode 100644 osu.Game.Rulesets.Osu/UI/ReverseArrowPulseMode.cs diff --git a/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs b/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs index f76635a932..77b0c728b0 100644 --- a/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs +++ b/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs @@ -3,6 +3,7 @@ using osu.Game.Configuration; using osu.Game.Rulesets.Configuration; +using osu.Game.Rulesets.Osu.UI; namespace osu.Game.Rulesets.Osu.Configuration { @@ -19,6 +20,7 @@ namespace osu.Game.Rulesets.Osu.Configuration Set(OsuRulesetSetting.SnakingInSliders, true); Set(OsuRulesetSetting.SnakingOutSliders, true); Set(OsuRulesetSetting.ShowCursorTrail, true); + Set(OsuRulesetSetting.ReverseArrowPulse, ReverseArrowPulseMode.Synced); } } @@ -26,6 +28,7 @@ namespace osu.Game.Rulesets.Osu.Configuration { SnakingInSliders, SnakingOutSliders, - ShowCursorTrail + ShowCursorTrail, + ReverseArrowPulse, } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs index e1cacfaaff..1f3c5d54bc 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; @@ -6,13 +6,13 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; using osu.Framework.MathUtils; using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Configuration; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; +using osu.Game.Rulesets.Osu.UI; using osu.Game.Rulesets.Scoring; using osuTK; -using osu.Game.Skinning; namespace osu.Game.Rulesets.Osu.Objects.Drawables { @@ -21,9 +21,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables private readonly RepeatPoint repeatPoint; private readonly DrawableSlider drawableSlider; + public readonly Bindable PulseMode = new Bindable(ReverseArrowPulseMode.Synced); + private double animDuration; - private readonly SkinnableDrawable scaleContainer; + private readonly Drawable scaleContainer; + + [Resolved(CanBeNull = true)] + private OsuRulesetConfigManager config { get; set; } public DrawableRepeatPoint(RepeatPoint repeatPoint, DrawableSlider drawableSlider) : base(repeatPoint) @@ -36,16 +41,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables Blending = BlendingParameters.Additive; Origin = Anchor.Centre; - InternalChild = scaleContainer = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.ReverseArrow), _ => new SpriteIcon - { - RelativeSizeAxes = Axes.Both, - Icon = FontAwesome.Solid.ChevronRight, - Size = new Vector2(0.35f) - }, confineMode: ConfineMode.NoScaling) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - }; + InternalChild = scaleContainer = new ReverseArrowPiece(); } private readonly IBindable scaleBindable = new Bindable(); @@ -55,6 +51,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { scaleBindable.BindValueChanged(scale => scaleContainer.Scale = new Vector2(scale.NewValue), true); scaleBindable.BindTo(HitObject.ScaleBindable); + + config?.BindWith(OsuRulesetSetting.ReverseArrowPulse, PulseMode); } protected override void CheckForResult(bool userTriggered, double timeOffset) @@ -69,14 +67,19 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables this.FadeIn(animDuration); - double fadeInStart = repeatPoint.StartTime - 2 * repeatPoint.SpanDuration; + if (PulseMode.Value == ReverseArrowPulseMode.Stable) + { + double fadeInStart = repeatPoint.StartTime - 2 * repeatPoint.SpanDuration; - // We want first repeat arrow to start pulsing during snake in - if (repeatPoint.RepeatIndex == 0) - fadeInStart -= repeatPoint.TimePreempt; + // We want first repeat arrow to start pulsing during snake in + if (repeatPoint.RepeatIndex == 0) + fadeInStart -= repeatPoint.TimePreempt; - for (double pulseStartTime = fadeInStart; pulseStartTime < repeatPoint.StartTime; pulseStartTime += 300) - this.Delay(pulseStartTime - LifetimeStart).ScaleTo(1.3f).ScaleTo(1f, Math.Min(300, repeatPoint.StartTime - pulseStartTime), Easing.Out); + for (double pulseStartTime = fadeInStart; pulseStartTime < repeatPoint.StartTime; pulseStartTime += 300) + this.Delay(pulseStartTime - LifetimeStart).ScaleTo(1.3f).ScaleTo(1f, Math.Min(300, repeatPoint.StartTime - pulseStartTime), Easing.Out); + } + else if (PulseMode.Value == ReverseArrowPulseMode.Off) + this.ScaleTo(0.5f).ScaleTo(1f, animDuration * 2, Easing.OutElasticHalf); } protected override void UpdateStateTransforms(ArmedState state) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs new file mode 100644 index 0000000000..1ec175274e --- /dev/null +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs @@ -0,0 +1,58 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Audio.Track; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osuTK; +using osu.Framework.Graphics.Sprites; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Graphics.Containers; +using osu.Game.Rulesets.Osu.Configuration; +using osu.Game.Rulesets.Osu.UI; +using osu.Game.Skinning; + +namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces +{ + public class ReverseArrowPiece : BeatSyncedContainer + { + public readonly Bindable PulseMode = new Bindable(ReverseArrowPulseMode.Synced); + + [Resolved(CanBeNull = true)] + private OsuRulesetConfigManager config { get; set; } + + public ReverseArrowPiece() + { + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + + Blending = BlendingParameters.Additive; + + Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2); + + InternalChild = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.ReverseArrow), _ => new SpriteIcon + { + RelativeSizeAxes = Axes.Both, + Icon = FontAwesome.Solid.ChevronRight, + Size = new Vector2(0.35f) + }, confineMode: ConfineMode.NoScaling) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }; + } + + protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) + { + if (PulseMode.Value == ReverseArrowPulseMode.Synced) + InternalChild.ScaleTo(1.3f).ScaleTo(1f, timingPoint.BeatLength, Easing.Out); + } + + [BackgroundDependencyLoader] + private void load() + { + config?.BindWith(OsuRulesetSetting.ReverseArrowPulse, PulseMode); + } + } +} diff --git a/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs b/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs index 88adf72551..afde693316 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs @@ -39,6 +39,11 @@ namespace osu.Game.Rulesets.Osu.UI LabelText = "Cursor trail", Bindable = config.GetBindable(OsuRulesetSetting.ShowCursorTrail) }, + new SettingsEnumDropdown + { + LabelText = "Slider reverse arrow pulse", + Bindable = config.GetBindable(OsuRulesetSetting.ReverseArrowPulse) + }, }; } } diff --git a/osu.Game.Rulesets.Osu/UI/ReverseArrowPulseMode.cs b/osu.Game.Rulesets.Osu/UI/ReverseArrowPulseMode.cs new file mode 100644 index 0000000000..d3261e71db --- /dev/null +++ b/osu.Game.Rulesets.Osu/UI/ReverseArrowPulseMode.cs @@ -0,0 +1,18 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.ComponentModel; + +namespace osu.Game.Rulesets.Osu.UI +{ + public enum ReverseArrowPulseMode + { + Off, + + [Description("Match osu!stable")] + Stable, + + [Description("Sync to beatmap")] + Synced + } +} From 319465899824dfde4a6ef3150c86651c3afc98f9 Mon Sep 17 00:00:00 2001 From: Sebastian Krajewski Date: Sat, 4 Jan 2020 13:12:37 +0100 Subject: [PATCH 044/159] Fix repeat point pulsing when it is in fade out state --- .../Objects/Drawables/DrawableRepeatPoint.cs | 2 +- .../Objects/Drawables/Pieces/ReverseArrowPiece.cs | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs index 1f3c5d54bc..6bf2f95f41 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables Blending = BlendingParameters.Additive; Origin = Anchor.Centre; - InternalChild = scaleContainer = new ReverseArrowPiece(); + InternalChild = scaleContainer = new ReverseArrowPiece(repeatPoint); } private readonly IBindable scaleBindable = new Bindable(); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs index 1ec175274e..114cf9d27e 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using osu.Framework.Allocation; using osu.Framework.Audio.Track; using osu.Framework.Bindables; @@ -22,8 +23,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces [Resolved(CanBeNull = true)] private OsuRulesetConfigManager config { get; set; } - public ReverseArrowPiece() + private readonly RepeatPoint repeatPoint; + + public ReverseArrowPiece(RepeatPoint repeatPoint) { + this.repeatPoint = repeatPoint; + Anchor = Anchor.Centre; Origin = Anchor.Centre; @@ -45,8 +50,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) { - if (PulseMode.Value == ReverseArrowPulseMode.Synced) - InternalChild.ScaleTo(1.3f).ScaleTo(1f, timingPoint.BeatLength, Easing.Out); + if (PulseMode.Value == ReverseArrowPulseMode.Synced && Clock.CurrentTime < repeatPoint.StartTime) + InternalChild.ScaleTo(1.3f).ScaleTo(1f, Math.Min(timingPoint.BeatLength, repeatPoint.StartTime - Clock.CurrentTime), Easing.Out); } [BackgroundDependencyLoader] From 3bd3ebad49466e55ade2c3a682a71d27c9e77dda Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sat, 4 Jan 2020 18:26:31 +0100 Subject: [PATCH 045/159] Move placeholders to a dedicated namespace --- osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs | 1 + osu.Game/Online/Leaderboards/Leaderboard.cs | 1 + osu.Game/Online/Leaderboards/RetrievalFailurePlaceholder.cs | 1 + .../Online/{Leaderboards => Placeholders}/MessagePlaceholder.cs | 2 +- osu.Game/Online/{Leaderboards => Placeholders}/Placeholder.cs | 2 +- 5 files changed, 5 insertions(+), 2 deletions(-) rename osu.Game/Online/{Leaderboards => Placeholders}/MessagePlaceholder.cs (95%) rename osu.Game/Online/{Leaderboards => Placeholders}/Placeholder.cs (95%) diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs index 57e297bcd5..2b52deb605 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Leaderboards; +using osu.Game.Online.Placeholders; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Scoring; using osu.Game.Screens.Select.Leaderboards; diff --git a/osu.Game/Online/Leaderboards/Leaderboard.cs b/osu.Game/Online/Leaderboards/Leaderboard.cs index 9c48ebd09b..60c79f6d8f 100644 --- a/osu.Game/Online/Leaderboards/Leaderboard.cs +++ b/osu.Game/Online/Leaderboards/Leaderboard.cs @@ -14,6 +14,7 @@ using osu.Framework.Threading; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; +using osu.Game.Online.Placeholders; using osuTK; using osuTK.Graphics; diff --git a/osu.Game/Online/Leaderboards/RetrievalFailurePlaceholder.cs b/osu.Game/Online/Leaderboards/RetrievalFailurePlaceholder.cs index 801f3f8ff0..15d7dabe65 100644 --- a/osu.Game/Online/Leaderboards/RetrievalFailurePlaceholder.cs +++ b/osu.Game/Online/Leaderboards/RetrievalFailurePlaceholder.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; +using osu.Game.Online.Placeholders; using osuTK; namespace osu.Game.Online.Leaderboards diff --git a/osu.Game/Online/Leaderboards/MessagePlaceholder.cs b/osu.Game/Online/Placeholders/MessagePlaceholder.cs similarity index 95% rename from osu.Game/Online/Leaderboards/MessagePlaceholder.cs rename to osu.Game/Online/Placeholders/MessagePlaceholder.cs index ef425dacd8..7342765ca4 100644 --- a/osu.Game/Online/Leaderboards/MessagePlaceholder.cs +++ b/osu.Game/Online/Placeholders/MessagePlaceholder.cs @@ -4,7 +4,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; -namespace osu.Game.Online.Leaderboards +namespace osu.Game.Online.Placeholders { public class MessagePlaceholder : Placeholder { diff --git a/osu.Game/Online/Leaderboards/Placeholder.cs b/osu.Game/Online/Placeholders/Placeholder.cs similarity index 95% rename from osu.Game/Online/Leaderboards/Placeholder.cs rename to osu.Game/Online/Placeholders/Placeholder.cs index d38110a9d0..f58282bbd9 100644 --- a/osu.Game/Online/Leaderboards/Placeholder.cs +++ b/osu.Game/Online/Placeholders/Placeholder.cs @@ -5,7 +5,7 @@ using System; using osu.Framework.Graphics; using osu.Game.Graphics.Containers; -namespace osu.Game.Online.Leaderboards +namespace osu.Game.Online.Placeholders { public abstract class Placeholder : OsuTextFlowContainer, IEquatable { From 474b8fc8fd441a6cf3f77cf35b8630bcb0b420bb Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sat, 4 Jan 2020 19:25:49 +0100 Subject: [PATCH 046/159] Add LoginPlaceholder --- .../Online/Placeholders/LoginPlaceholder.cs | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 osu.Game/Online/Placeholders/LoginPlaceholder.cs diff --git a/osu.Game/Online/Placeholders/LoginPlaceholder.cs b/osu.Game/Online/Placeholders/LoginPlaceholder.cs new file mode 100644 index 0000000000..f7450b8209 --- /dev/null +++ b/osu.Game/Online/Placeholders/LoginPlaceholder.cs @@ -0,0 +1,44 @@ +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Input.Events; +using osu.Game.Overlays; + +namespace osu.Game.Online.Placeholders +{ + public sealed class LoginPlaceholder : Placeholder + { + [Resolved] + private LoginOverlay login { get; set; } + + public LoginPlaceholder(string action) + { + AddIcon(FontAwesome.Solid.UserLock, cp => + { + cp.Font = cp.Font.With(size: TEXT_SIZE); + cp.Padding = new MarginPadding { Right = 10 }; + }); + + AddText(@"Please sign in to " + action); + } + + protected override bool OnMouseDown(MouseDownEvent e) + { + this.ScaleTo(0.8f, 4000, Easing.OutQuint); + return base.OnMouseDown(e); + } + + protected override bool OnMouseUp(MouseUpEvent e) + { + this.ScaleTo(1, 1000, Easing.OutElastic); + return base.OnMouseUp(e); + } + + protected override bool OnClick(ClickEvent e) + { + login?.Show(); + return base.OnClick(e); + } + + } +} From 5fd5665467e4b7503d4dd52e7fed4e821689f2a8 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sat, 4 Jan 2020 19:59:25 +0100 Subject: [PATCH 047/159] Use implementation on song select leaderboards. --- osu.Game/Online/Leaderboards/Leaderboard.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Online/Leaderboards/Leaderboard.cs b/osu.Game/Online/Leaderboards/Leaderboard.cs index 60c79f6d8f..06a36af618 100644 --- a/osu.Game/Online/Leaderboards/Leaderboard.cs +++ b/osu.Game/Online/Leaderboards/Leaderboard.cs @@ -151,7 +151,7 @@ namespace osu.Game.Online.Leaderboards break; case PlaceholderState.NotLoggedIn: - replacePlaceholder(new MessagePlaceholder(@"Please sign in to view online leaderboards!")); + replacePlaceholder(new LoginPlaceholder(@"view online leaderboards!")); break; case PlaceholderState.NotSupporter: From 3d747835dc7ef94c825ad8154c99ffacdc10b234 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sat, 4 Jan 2020 21:09:40 +0100 Subject: [PATCH 048/159] Fix CI issues --- osu.Game/Online/Placeholders/LoginPlaceholder.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Online/Placeholders/LoginPlaceholder.cs b/osu.Game/Online/Placeholders/LoginPlaceholder.cs index f7450b8209..dc753c6ab7 100644 --- a/osu.Game/Online/Placeholders/LoginPlaceholder.cs +++ b/osu.Game/Online/Placeholders/LoginPlaceholder.cs @@ -1,4 +1,7 @@ -using osu.Framework.Allocation; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; @@ -39,6 +42,5 @@ namespace osu.Game.Online.Placeholders login?.Show(); return base.OnClick(e); } - } } From 21e6351c5354467ad641f5fee2971438b50b2ad6 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sun, 5 Jan 2020 14:33:44 +0100 Subject: [PATCH 049/159] Allow DI for LoginOverlay to resolve to null in non-graphical environments (fix tests) --- osu.Game/Online/Placeholders/LoginPlaceholder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Online/Placeholders/LoginPlaceholder.cs b/osu.Game/Online/Placeholders/LoginPlaceholder.cs index dc753c6ab7..f6e4131930 100644 --- a/osu.Game/Online/Placeholders/LoginPlaceholder.cs +++ b/osu.Game/Online/Placeholders/LoginPlaceholder.cs @@ -11,7 +11,7 @@ namespace osu.Game.Online.Placeholders { public sealed class LoginPlaceholder : Placeholder { - [Resolved] + [Resolved(CanBeNull = true)] private LoginOverlay login { get; set; } public LoginPlaceholder(string action) From ee15967c4a7faeae023fc2a0fe553f2bc64e641f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 6 Jan 2020 17:15:59 +0900 Subject: [PATCH 050/159] Rewrite test scene to be automated --- .../TestSceneDeleteLocalScore.cs | 255 +++++++++--------- 1 file changed, 120 insertions(+), 135 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs index de10eaccca..e896b0fab6 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs @@ -3,20 +3,26 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; +using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Allocation; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Cursor; +using osu.Framework.MathUtils; +using osu.Framework.Platform; +using osu.Framework.Testing; using osu.Game.Beatmaps; -using osu.Game.Online.API; +using osu.Game.Graphics.Cursor; +using osu.Game.Graphics.UserInterface; using osu.Game.Online.Leaderboards; using osu.Game.Overlays; -using osu.Game.Overlays.Dialog; +using osu.Game.Rulesets; using osu.Game.Scoring; using osu.Game.Screens.Select.Leaderboards; +using osu.Game.Tests.Resources; using osu.Game.Users; using osuTK; +using osuTK.Input; namespace osu.Game.Tests.Visual.UserInterface { @@ -32,154 +38,133 @@ namespace osu.Game.Tests.Visual.UserInterface typeof(LeaderboardScore), }; - private readonly FailableLeaderboard leaderboard; + private readonly ContextMenuContainer contextMenuContainer; + private readonly BeatmapLeaderboard leaderboard; + + private RulesetStore rulesetStore; + private BeatmapManager beatmapManager; + private ScoreManager scoreManager; + + private readonly List scores = new List(); + private BeatmapInfo beatmap; [Cached] private readonly DialogOverlay dialogOverlay; public TestSceneDeleteLocalScore() { - Add(dialogOverlay = new DialogOverlay + Children = new Drawable[] { - Depth = -1 - }); - - Add(leaderboard = new FailableLeaderboard - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Size = new Vector2(550f, 450f), - Scope = BeatmapLeaderboardScope.Local, - Beatmap = new BeatmapInfo + contextMenuContainer = new OsuContextMenuContainer { - ID = 1, - Metadata = new BeatmapMetadata + RelativeSizeAxes = Axes.Both, + Child = leaderboard = new BeatmapLeaderboard { - ID = 1, - Title = "TestSong", - Artist = "TestArtist", - Author = new User + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Size = new Vector2(550f, 450f), + Scope = BeatmapLeaderboardScope.Local, + Beatmap = new BeatmapInfo { - Username = "TestAuthor" + ID = 1, + Metadata = new BeatmapMetadata + { + ID = 1, + Title = "TestSong", + Artist = "TestArtist", + Author = new User + { + Username = "TestAuthor" + }, + }, + Version = "Insane" }, - }, - Version = "Insane" + } }, + dialogOverlay = new DialogOverlay() + }; + } + + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) + { + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); + + dependencies.Cache(rulesetStore = new RulesetStore(ContextFactory)); + dependencies.Cache(beatmapManager = new BeatmapManager(LocalStorage, ContextFactory, rulesetStore, null, Audio, dependencies.Get(), Beatmap.Default)); + dependencies.Cache(scoreManager = new ScoreManager(rulesetStore, () => beatmapManager, LocalStorage, null, ContextFactory)); + + beatmap = beatmapManager.Import(TestResources.GetTestBeatmapForImport()).Result.Beatmaps[0]; + + for (int i = 0; i < 50; i++) + { + var score = new ScoreInfo + { + OnlineScoreID = i, + Beatmap = beatmap, + BeatmapInfoID = beatmap.ID, + Accuracy = RNG.NextDouble(), + TotalScore = RNG.Next(1, 1000000), + MaxCombo = RNG.Next(1, 1000), + Rank = ScoreRank.XH, + User = new User { Username = "TestUser" }, + }; + + scores.Add(scoreManager.Import(score).Result); + } + + scores.Sort(Comparer.Create((s1, s2) => s2.TotalScore.CompareTo(s1.TotalScore))); + + return dependencies; + } + + [SetUp] + public void Setup() => Schedule(() => + { + // Due to soft deletions, we can re-use deleted scores between test runs + scoreManager.Undelete(scoreManager.QueryScores(s => s.DeletePending).ToList()); + + leaderboard.Beatmap = beatmap; + leaderboard.RefreshScores(); + }); + + [Test] + public void TestDeleteViaRightClick() + { + // Ensure the leaderboard items have finished showing up + AddStep("finish transforms", () => leaderboard.FinishTransforms(true)); + + AddStep("open menu for top score", () => + { + InputManager.MoveMouseTo(leaderboard.ChildrenOfType().First()); + InputManager.Click(MouseButton.Right); }); - AddStep("Insert Local Scores", reset); + // Ensure the context menu has finished showing + AddStep("finish transforms", () => contextMenuContainer.FinishTransforms(true)); + + AddStep("click delete option", () => + { + InputManager.MoveMouseTo(contextMenuContainer.ChildrenOfType().First(i => i.Item.Text.Value.ToLowerInvariant() == "delete")); + InputManager.Click(MouseButton.Left); + }); + + // Ensure the dialog has finished showing + AddStep("finish transforms", () => dialogOverlay.FinishTransforms(true)); + + AddStep("click delete button", () => + { + InputManager.MoveMouseTo(dialogOverlay.ChildrenOfType().First()); + InputManager.Click(MouseButton.Left); + }); + + AddUntilStep("score removed from leaderboard", () => leaderboard.Scores.All(s => s.OnlineScoreID != scores[0].OnlineScoreID)); } - private void reset() + [Test] + public void TestDeleteViaDatabase() { - leaderboard.InitialLoad = true; - leaderboard.RefreshScores(); - } - - private class FailableLeaderboard : BeatmapLeaderboard - { - private List scoreList; - - private Random rnd; - - public bool InitialLoad; - - public void DeleteScore(ScoreInfo score) - { - scoreList.Remove(score); - RefreshScores(); - } - - public FailableLeaderboard() - { - InitialLoad = true; - } - - public void SetRetrievalState(PlaceholderState state) - { - PlaceholderState = state; - } - - protected override APIRequest FetchScores(Action> scoresCallback) - { - if (InitialLoad) - { - rnd = new Random(); - - scoreList = Enumerable.Range(1, 50).Select(createScore).ToList(); - Scores = scoreList.OrderByDescending(s => s.TotalScore).ToArray(); - - InitialLoad = false; - } - else - { - Scores = scoreList.OrderByDescending(s => s.TotalScore).ToArray(); - } - - return null; - } - - private ScoreInfo createScore(int id) => new ScoreInfo - { - ID = id, - Accuracy = rnd.NextDouble(), - PP = rnd.Next(1, 1000000), - TotalScore = rnd.Next(1, 1000000), - MaxCombo = rnd.Next(1, 1000), - Rank = ScoreRank.XH, - User = new User { Username = "TestUser" }, - }; - - protected override LeaderboardScore CreateDrawableScore(ScoreInfo model, int index) - { - model.Beatmap = Beatmap; - return new TestLeaderboardScore(model, index, this, IsOnlineScope); - } - } - - private class TestLeaderboardScore : LeaderboardScore - { - [Resolved] - private DialogOverlay dialogOverlay { get; set; } - - private readonly FailableLeaderboard leaderboard; - - public TestLeaderboardScore(ScoreInfo score, int rank, FailableLeaderboard leaderboard, bool allowHighlight = true) - : base(score, rank, allowHighlight) - { - this.leaderboard = leaderboard; - } - - protected override void DeleteLocalScore(ScoreInfo score) - { - dialogOverlay?.Push(new TestLocalScoreDeleteDialog(score, leaderboard)); - } - } - - private class TestLocalScoreDeleteDialog : PopupDialog - { - public TestLocalScoreDeleteDialog(ScoreInfo score, FailableLeaderboard leaderboard) - { - Debug.Assert(score != null); - - string accuracy = string.Format(score.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", score.Accuracy); - - BodyText = $@"{score.User}'s {accuracy} {score.Rank} Rank on {score.Beatmap}"; - Icon = FontAwesome.Solid.Eraser; - HeaderText = @"Deleting this local score. Are you sure?"; - Buttons = new PopupDialogButton[] - { - new PopupDialogOkButton - { - Text = @"Yes. Please.", - Action = () => leaderboard.DeleteScore(score) - }, - new PopupDialogCancelButton - { - Text = @"No, I'm still attached.", - }, - }; - } + AddStep("delete top score", () => scoreManager.Delete(scores[0])); + AddUntilStep("score removed from leaderboard", () => leaderboard.Scores.All(s => s.OnlineScoreID != scores[0].OnlineScoreID)); } } } From 4a7f5f98dff7ac42191e664fd98e8f9f67467a6a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 6 Jan 2020 17:20:09 +0900 Subject: [PATCH 051/159] Cleanup methods/events --- .../Online/Leaderboards/LeaderboardScore.cs | 7 +------ .../Select/Leaderboards/BeatmapLeaderboard.cs | 19 +++++++------------ 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index 7e24dc990b..9c7324d913 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -367,11 +367,6 @@ namespace osu.Game.Online.Leaderboards } } - protected virtual void DeleteLocalScore(ScoreInfo score) - { - dialogOverlay?.Push(new LocalScoreDeleteDialog(score)); - } - public MenuItem[] ContextMenuItems { get @@ -379,7 +374,7 @@ namespace osu.Game.Online.Leaderboards List items = new List(); if (score.ID != 0) - items.Add(new OsuMenuItem("Delete", MenuItemType.Destructive, () => DeleteLocalScore(score))); + items.Add(new OsuMenuItem("Delete", MenuItemType.Destructive, () => dialogOverlay?.Push(new LocalScoreDeleteDialog(score)))); return items.ToArray(); } diff --git a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs index 8442e91712..9cf328e900 100644 --- a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs @@ -104,7 +104,7 @@ namespace osu.Game.Screens.Select.Leaderboards ScoreSelected = s => ScoreSelected?.Invoke(s) }); - scoreManager.ItemRemoved += deleteLocalScore; + scoreManager.ItemRemoved += onScoreRemoved; } protected override void Reset() @@ -113,15 +113,7 @@ namespace osu.Game.Screens.Select.Leaderboards TopScore = null; } - protected override void Dispose(bool isDisposing) - { - base.Dispose(isDisposing); - - if (scoreManager != null) - { - scoreManager.ItemRemoved -= deleteLocalScore; - } - } + private void onScoreRemoved(ScoreInfo score) => Schedule(RefreshScores); protected override bool IsOnlineScope => Scope != BeatmapLeaderboardScope.Local; @@ -204,9 +196,12 @@ namespace osu.Game.Screens.Select.Leaderboards }; } - private void deleteLocalScore(ScoreInfo score) + protected override void Dispose(bool isDisposing) { - Schedule(RefreshScores); + base.Dispose(isDisposing); + + if (scoreManager != null) + scoreManager.ItemRemoved -= onScoreRemoved; } } } From 61c269b17b78e5e1b08c58b22a096e9043b4f1d8 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 6 Jan 2020 17:32:24 +0900 Subject: [PATCH 052/159] Leaderboard should not change the model --- .../Select/Leaderboards/BeatmapLeaderboard.cs | 11 +++-------- .../Screens/Select/LocalScoreDeleteDialog.cs | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs index 9cf328e900..e36493c82f 100644 --- a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs @@ -186,15 +186,10 @@ namespace osu.Game.Screens.Select.Leaderboards return req; } - protected override LeaderboardScore CreateDrawableScore(ScoreInfo model, int index) + protected override LeaderboardScore CreateDrawableScore(ScoreInfo model, int index) => new LeaderboardScore(model, index, IsOnlineScope) { - model.Beatmap = beatmap; - - return new LeaderboardScore(model, index, IsOnlineScope) - { - Action = () => ScoreSelected?.Invoke(model) - }; - } + Action = () => ScoreSelected?.Invoke(model) + }; protected override void Dispose(bool isDisposing) { diff --git a/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs b/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs index c1d680fd45..d607706fc3 100644 --- a/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs +++ b/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs @@ -6,21 +6,35 @@ using osu.Game.Overlays.Dialog; using osu.Game.Scoring; using System.Diagnostics; using osu.Framework.Graphics.Sprites; +using osu.Game.Beatmaps; namespace osu.Game.Screens.Select { public class LocalScoreDeleteDialog : PopupDialog { + private readonly ScoreInfo score; + [Resolved] private ScoreManager scoreManager { get; set; } + [Resolved] + private BeatmapManager beatmapManager { get; set; } + public LocalScoreDeleteDialog(ScoreInfo score) { + this.score = score; Debug.Assert(score != null); + } + + [BackgroundDependencyLoader] + private void load() + { + BeatmapInfo beatmap = beatmapManager.QueryBeatmap(b => b.ID == score.BeatmapInfoID); + Debug.Assert(beatmap != null); string accuracy = string.Format(score.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", score.Accuracy); - BodyText = $@"{score.User}'s {accuracy} {score.Rank} Rank on {score.Beatmap}"; + BodyText = $@"{score.User}'s {accuracy} {score.Rank} Rank on {beatmap}"; Icon = FontAwesome.Solid.Eraser; HeaderText = @"Deleting this local score. Are you sure?"; Buttons = new PopupDialogButton[] @@ -28,7 +42,7 @@ namespace osu.Game.Screens.Select new PopupDialogOkButton { Text = @"Yes. Please.", - Action = () => scoreManager.Delete(score) + Action = () => scoreManager?.Delete(score) }, new PopupDialogCancelButton { From 28510674acee6420d4eb28add332b4981939c41f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 6 Jan 2020 17:46:38 +0900 Subject: [PATCH 053/159] Shorten body text --- osu.Game/Screens/Select/LocalScoreDeleteDialog.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs b/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs index d607706fc3..97df40fa6d 100644 --- a/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs +++ b/osu.Game/Screens/Select/LocalScoreDeleteDialog.cs @@ -32,21 +32,21 @@ namespace osu.Game.Screens.Select BeatmapInfo beatmap = beatmapManager.QueryBeatmap(b => b.ID == score.BeatmapInfoID); Debug.Assert(beatmap != null); - string accuracy = string.Format(score.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", score.Accuracy); + string accuracy = string.Format(score.Accuracy == 1 ? "{0:P0}" : "{0:P2}", score.Accuracy); + BodyText = $"{score.User} ({accuracy}, {score.Rank})"; - BodyText = $@"{score.User}'s {accuracy} {score.Rank} Rank on {beatmap}"; - Icon = FontAwesome.Solid.Eraser; - HeaderText = @"Deleting this local score. Are you sure?"; + Icon = FontAwesome.Regular.TrashAlt; + HeaderText = "Confirm deletion of local score"; Buttons = new PopupDialogButton[] { new PopupDialogOkButton { - Text = @"Yes. Please.", + Text = "Yes. Please.", Action = () => scoreManager?.Delete(score) }, new PopupDialogCancelButton { - Text = @"No, I'm still attached.", + Text = "No, I'm still attached.", }, }; } From e433e8b78f3d28494d88b9d9ab47ad2b53ca254c Mon Sep 17 00:00:00 2001 From: Ganendra Afrasya Date: Mon, 6 Jan 2020 17:12:10 +0700 Subject: [PATCH 054/159] Remove unused variable --- osu.Game/Beatmaps/Drawables/DifficultyIcon.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index 7bd40af512..a3128e36c4 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs @@ -48,11 +48,9 @@ namespace osu.Game.Beatmaps.Drawables InternalChild = iconContainer = new Container { Size = new Vector2(20f) }; } - public string TooltipText { get; set; } - public ITooltip GetCustomTooltip() => new DifficultyIconTooltip(); - public object TooltipContent { get; set; } + public object TooltipContent { get; } [BackgroundDependencyLoader] private void load(OsuColour colours) From 7716a96b2848d32d1e49c932d8a25d19a877aa02 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Mon, 6 Jan 2020 23:07:58 +0300 Subject: [PATCH 055/159] Allow scrolling through DimmedLoadingLayer --- .../Graphics/UserInterface/DimmedLoadingLayer.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/osu.Game/Graphics/UserInterface/DimmedLoadingLayer.cs b/osu.Game/Graphics/UserInterface/DimmedLoadingLayer.cs index f2f6dd429b..aca3768540 100644 --- a/osu.Game/Graphics/UserInterface/DimmedLoadingLayer.cs +++ b/osu.Game/Graphics/UserInterface/DimmedLoadingLayer.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Extensions.Color4Extensions; using osuTK; +using osu.Framework.Input.Events; namespace osu.Game.Graphics.UserInterface { @@ -41,5 +42,16 @@ namespace osu.Game.Graphics.UserInterface this.FadeOut(transition_duration, Easing.OutQuint); loading.Hide(); } + + protected override bool Handle(UIEvent e) + { + switch (e) + { + case ScrollEvent _: + return false; + } + + return base.Handle(e); + } } } From 21468eb07011c8774f9de838a5a19d602fe01fc6 Mon Sep 17 00:00:00 2001 From: Sebastian Krajewski Date: Tue, 7 Jan 2020 04:55:05 +0100 Subject: [PATCH 056/159] Remove settings related to reverse arrow --- .../Configuration/OsuRulesetConfigManager.cs | 5 +--- .../Objects/Drawables/DrawableRepeatPoint.cs | 28 +++---------------- .../Drawables/Pieces/ReverseArrowPiece.cs | 17 +---------- .../UI/OsuSettingsSubsection.cs | 5 ---- .../UI/ReverseArrowPulseMode.cs | 18 ------------ 5 files changed, 6 insertions(+), 67 deletions(-) delete mode 100644 osu.Game.Rulesets.Osu/UI/ReverseArrowPulseMode.cs diff --git a/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs b/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs index 77b0c728b0..f76635a932 100644 --- a/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs +++ b/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs @@ -3,7 +3,6 @@ using osu.Game.Configuration; using osu.Game.Rulesets.Configuration; -using osu.Game.Rulesets.Osu.UI; namespace osu.Game.Rulesets.Osu.Configuration { @@ -20,7 +19,6 @@ namespace osu.Game.Rulesets.Osu.Configuration Set(OsuRulesetSetting.SnakingInSliders, true); Set(OsuRulesetSetting.SnakingOutSliders, true); Set(OsuRulesetSetting.ShowCursorTrail, true); - Set(OsuRulesetSetting.ReverseArrowPulse, ReverseArrowPulseMode.Synced); } } @@ -28,7 +26,6 @@ namespace osu.Game.Rulesets.Osu.Configuration { SnakingInSliders, SnakingOutSliders, - ShowCursorTrail, - ReverseArrowPulse, + ShowCursorTrail } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs index 6bf2f95f41..4873160af0 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs @@ -8,9 +8,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.MathUtils; using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.Osu.Configuration; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; -using osu.Game.Rulesets.Osu.UI; using osu.Game.Rulesets.Scoring; using osuTK; @@ -21,15 +19,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables private readonly RepeatPoint repeatPoint; private readonly DrawableSlider drawableSlider; - public readonly Bindable PulseMode = new Bindable(ReverseArrowPulseMode.Synced); - private double animDuration; private readonly Drawable scaleContainer; - [Resolved(CanBeNull = true)] - private OsuRulesetConfigManager config { get; set; } - public DrawableRepeatPoint(RepeatPoint repeatPoint, DrawableSlider drawableSlider) : base(repeatPoint) { @@ -51,8 +44,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { scaleBindable.BindValueChanged(scale => scaleContainer.Scale = new Vector2(scale.NewValue), true); scaleBindable.BindTo(HitObject.ScaleBindable); - - config?.BindWith(OsuRulesetSetting.ReverseArrowPulse, PulseMode); } protected override void CheckForResult(bool userTriggered, double timeOffset) @@ -65,21 +56,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { animDuration = Math.Min(300, repeatPoint.SpanDuration); - this.FadeIn(animDuration); - - if (PulseMode.Value == ReverseArrowPulseMode.Stable) - { - double fadeInStart = repeatPoint.StartTime - 2 * repeatPoint.SpanDuration; - - // We want first repeat arrow to start pulsing during snake in - if (repeatPoint.RepeatIndex == 0) - fadeInStart -= repeatPoint.TimePreempt; - - for (double pulseStartTime = fadeInStart; pulseStartTime < repeatPoint.StartTime; pulseStartTime += 300) - this.Delay(pulseStartTime - LifetimeStart).ScaleTo(1.3f).ScaleTo(1f, Math.Min(300, repeatPoint.StartTime - pulseStartTime), Easing.Out); - } - else if (PulseMode.Value == ReverseArrowPulseMode.Off) - this.ScaleTo(0.5f).ScaleTo(1f, animDuration * 2, Easing.OutElasticHalf); + this.Animate( + d => d.FadeIn(animDuration), + d => d.ScaleTo(0.5f).ScaleTo(1f, animDuration * 2, Easing.OutElasticHalf) + ); } protected override void UpdateStateTransforms(ArmedState state) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs index 114cf9d27e..2b9a3aa197 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs @@ -2,27 +2,18 @@ // See the LICENCE file in the repository root for full licence text. using System; -using osu.Framework.Allocation; using osu.Framework.Audio.Track; -using osu.Framework.Bindables; using osu.Framework.Graphics; using osuTK; using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics.Containers; -using osu.Game.Rulesets.Osu.Configuration; -using osu.Game.Rulesets.Osu.UI; using osu.Game.Skinning; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class ReverseArrowPiece : BeatSyncedContainer { - public readonly Bindable PulseMode = new Bindable(ReverseArrowPulseMode.Synced); - - [Resolved(CanBeNull = true)] - private OsuRulesetConfigManager config { get; set; } - private readonly RepeatPoint repeatPoint; public ReverseArrowPiece(RepeatPoint repeatPoint) @@ -50,14 +41,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) { - if (PulseMode.Value == ReverseArrowPulseMode.Synced && Clock.CurrentTime < repeatPoint.StartTime) + if (Clock.CurrentTime < repeatPoint.StartTime) InternalChild.ScaleTo(1.3f).ScaleTo(1f, Math.Min(timingPoint.BeatLength, repeatPoint.StartTime - Clock.CurrentTime), Easing.Out); } - - [BackgroundDependencyLoader] - private void load() - { - config?.BindWith(OsuRulesetSetting.ReverseArrowPulse, PulseMode); - } } } diff --git a/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs b/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs index afde693316..88adf72551 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs @@ -39,11 +39,6 @@ namespace osu.Game.Rulesets.Osu.UI LabelText = "Cursor trail", Bindable = config.GetBindable(OsuRulesetSetting.ShowCursorTrail) }, - new SettingsEnumDropdown - { - LabelText = "Slider reverse arrow pulse", - Bindable = config.GetBindable(OsuRulesetSetting.ReverseArrowPulse) - }, }; } } diff --git a/osu.Game.Rulesets.Osu/UI/ReverseArrowPulseMode.cs b/osu.Game.Rulesets.Osu/UI/ReverseArrowPulseMode.cs deleted file mode 100644 index d3261e71db..0000000000 --- a/osu.Game.Rulesets.Osu/UI/ReverseArrowPulseMode.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System.ComponentModel; - -namespace osu.Game.Rulesets.Osu.UI -{ - public enum ReverseArrowPulseMode - { - Off, - - [Description("Match osu!stable")] - Stable, - - [Description("Sync to beatmap")] - Synced - } -} From 4a68c791375248441fcb307a0a903aa502c23c2e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 7 Jan 2020 13:06:30 +0900 Subject: [PATCH 057/159] Make tests safer against async loads / transforms --- .../UserInterface/TestSceneDeleteLocalScore.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs index e896b0fab6..289c01fbf3 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs @@ -123,16 +123,26 @@ namespace osu.Game.Tests.Visual.UserInterface // Due to soft deletions, we can re-use deleted scores between test runs scoreManager.Undelete(scoreManager.QueryScores(s => s.DeletePending).ToList()); + leaderboard.Scores = null; + leaderboard.FinishTransforms(true); // After setting scores, we may be waiting for transforms to expire drawables + leaderboard.Beatmap = beatmap; - leaderboard.RefreshScores(); + leaderboard.RefreshScores(); // Required in the case that the beatmap hasn't changed }); + [SetUpSteps] + public void SetupSteps() + { + // Ensure the leaderboard has finished async-loading drawables + AddUntilStep("wait for drawables", () => leaderboard.ChildrenOfType().Any()); + + // Ensure the leaderboard items have finished showing up + AddStep("finish transforms", () => leaderboard.FinishTransforms(true)); + } + [Test] public void TestDeleteViaRightClick() { - // Ensure the leaderboard items have finished showing up - AddStep("finish transforms", () => leaderboard.FinishTransforms(true)); - AddStep("open menu for top score", () => { InputManager.MoveMouseTo(leaderboard.ChildrenOfType().First()); From 7f92cefe1023fbfd2ff98045a70186d70e10e760 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Tue, 7 Jan 2020 19:06:47 +0100 Subject: [PATCH 058/159] Apply review suggestions --- osu.Game/Online/Leaderboards/Leaderboard.cs | 2 +- osu.Game/Online/Placeholders/LoginPlaceholder.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Online/Leaderboards/Leaderboard.cs b/osu.Game/Online/Leaderboards/Leaderboard.cs index 06a36af618..095e552ddd 100644 --- a/osu.Game/Online/Leaderboards/Leaderboard.cs +++ b/osu.Game/Online/Leaderboards/Leaderboard.cs @@ -151,7 +151,7 @@ namespace osu.Game.Online.Leaderboards break; case PlaceholderState.NotLoggedIn: - replacePlaceholder(new LoginPlaceholder(@"view online leaderboards!")); + replacePlaceholder(new LoginPlaceholder(@"Please sign in to view online leaderboards!")); break; case PlaceholderState.NotSupporter: diff --git a/osu.Game/Online/Placeholders/LoginPlaceholder.cs b/osu.Game/Online/Placeholders/LoginPlaceholder.cs index f6e4131930..a613d7344a 100644 --- a/osu.Game/Online/Placeholders/LoginPlaceholder.cs +++ b/osu.Game/Online/Placeholders/LoginPlaceholder.cs @@ -22,7 +22,7 @@ namespace osu.Game.Online.Placeholders cp.Padding = new MarginPadding { Right = 10 }; }); - AddText(@"Please sign in to " + action); + AddText(action); } protected override bool OnMouseDown(MouseDownEvent e) From 2688a855a0ab397e411aa225438ea5cbd9fcac1a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 8 Jan 2020 14:14:46 +0900 Subject: [PATCH 059/159] Downgrade NUnit to fix discovery issues --- .../osu.Game.Rulesets.Catch.Tests.csproj | 2 +- .../osu.Game.Rulesets.Mania.Tests.csproj | 2 +- .../osu.Game.Rulesets.Taiko.Tests.csproj | 2 +- osu.Game.Tests/osu.Game.Tests.csproj | 2 +- osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj index 0b2862e5bb..9559d13328 100644 --- a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj +++ b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj @@ -4,7 +4,7 @@ - + diff --git a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj index 9d362e5819..dea6e6c0fb 100644 --- a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj +++ b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj @@ -4,7 +4,7 @@ - + diff --git a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj index da89b37fbf..d728d65bfd 100644 --- a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj +++ b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj @@ -4,7 +4,7 @@ - + diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index 3f8a548fd5..6c799e5e90 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -5,7 +5,7 @@ - + diff --git a/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj b/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj index 75b88be1ab..7ecfd6ef70 100644 --- a/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj +++ b/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj @@ -7,7 +7,7 @@ - + WinExe From 6dd45e52ef45028104978e785ad79a05995f7654 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 8 Jan 2020 17:22:51 +0900 Subject: [PATCH 060/159] Move text definition inside class --- osu.Game/Online/Leaderboards/Leaderboard.cs | 2 +- osu.Game/Online/Placeholders/LoginPlaceholder.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Online/Leaderboards/Leaderboard.cs b/osu.Game/Online/Leaderboards/Leaderboard.cs index 095e552ddd..55233bef6e 100644 --- a/osu.Game/Online/Leaderboards/Leaderboard.cs +++ b/osu.Game/Online/Leaderboards/Leaderboard.cs @@ -151,7 +151,7 @@ namespace osu.Game.Online.Leaderboards break; case PlaceholderState.NotLoggedIn: - replacePlaceholder(new LoginPlaceholder(@"Please sign in to view online leaderboards!")); + replacePlaceholder(new LoginPlaceholder()); break; case PlaceholderState.NotSupporter: diff --git a/osu.Game/Online/Placeholders/LoginPlaceholder.cs b/osu.Game/Online/Placeholders/LoginPlaceholder.cs index a613d7344a..ffc6623229 100644 --- a/osu.Game/Online/Placeholders/LoginPlaceholder.cs +++ b/osu.Game/Online/Placeholders/LoginPlaceholder.cs @@ -14,7 +14,7 @@ namespace osu.Game.Online.Placeholders [Resolved(CanBeNull = true)] private LoginOverlay login { get; set; } - public LoginPlaceholder(string action) + public LoginPlaceholder() { AddIcon(FontAwesome.Solid.UserLock, cp => { @@ -22,7 +22,7 @@ namespace osu.Game.Online.Placeholders cp.Padding = new MarginPadding { Right = 10 }; }); - AddText(action); + AddText(@"Please sign in to view online leaderboards!"); } protected override bool OnMouseDown(MouseDownEvent e) From c2fc7d5cbdb721887020dabc326bcf4443855da4 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 6 Jan 2020 19:48:28 +0800 Subject: [PATCH 061/159] Add empty benchmark project. --- osu.Desktop.slnf | 1 + osu.Game.Benchmarks/Program.cs | 13 +++++++++++++ osu.Game.Benchmarks/osu.Game.Benchmarks.csproj | 9 +++++++++ osu.sln | 14 ++++++++++++++ 4 files changed, 37 insertions(+) create mode 100644 osu.Game.Benchmarks/Program.cs create mode 100644 osu.Game.Benchmarks/osu.Game.Benchmarks.csproj diff --git a/osu.Desktop.slnf b/osu.Desktop.slnf index e6b6446f72..d2c14d321a 100644 --- a/osu.Desktop.slnf +++ b/osu.Desktop.slnf @@ -3,6 +3,7 @@ "path": "osu.sln", "projects": [ "osu.Desktop\\osu.Desktop.csproj", + "osu.Game.Benchmarks\\osu.Game.Benchmarks.csproj", "osu.Game.Rulesets.Catch.Tests\\osu.Game.Rulesets.Catch.Tests.csproj", "osu.Game.Rulesets.Catch\\osu.Game.Rulesets.Catch.csproj", "osu.Game.Rulesets.Mania.Tests\\osu.Game.Rulesets.Mania.Tests.csproj", diff --git a/osu.Game.Benchmarks/Program.cs b/osu.Game.Benchmarks/Program.cs new file mode 100644 index 0000000000..ebd30c0a7a --- /dev/null +++ b/osu.Game.Benchmarks/Program.cs @@ -0,0 +1,13 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace osu.Game.Benchmarks +{ + public static class Program + { + public static void Main(string[] args) + { + + } + } +} diff --git a/osu.Game.Benchmarks/osu.Game.Benchmarks.csproj b/osu.Game.Benchmarks/osu.Game.Benchmarks.csproj new file mode 100644 index 0000000000..65bfa2be14 --- /dev/null +++ b/osu.Game.Benchmarks/osu.Game.Benchmarks.csproj @@ -0,0 +1,9 @@ + + + + netcoreapp3.1 + Exe + false + + + diff --git a/osu.sln b/osu.sln index 79823848f0..1d64f6ff10 100644 --- a/osu.sln +++ b/osu.sln @@ -65,6 +65,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution osu.TestProject.props = osu.TestProject.props EndProjectSection EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "osu.Game.Benchmarks", "osu.Game.Benchmarks\osu.Game.Benchmarks.csproj", "{93632F2D-2BB4-46C1-A7B8-F8CF2FB27118}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -399,6 +401,18 @@ Global {5CC222DC-5716-4499-B897-DCBDDA4A5CF9}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {5CC222DC-5716-4499-B897-DCBDDA4A5CF9}.Release|iPhoneSimulator.Build.0 = Release|Any CPU {5CC222DC-5716-4499-B897-DCBDDA4A5CF9}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU + {93632F2D-2BB4-46C1-A7B8-F8CF2FB27118}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {93632F2D-2BB4-46C1-A7B8-F8CF2FB27118}.Debug|Any CPU.Build.0 = Debug|Any CPU + {93632F2D-2BB4-46C1-A7B8-F8CF2FB27118}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {93632F2D-2BB4-46C1-A7B8-F8CF2FB27118}.Debug|iPhone.Build.0 = Debug|Any CPU + {93632F2D-2BB4-46C1-A7B8-F8CF2FB27118}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {93632F2D-2BB4-46C1-A7B8-F8CF2FB27118}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {93632F2D-2BB4-46C1-A7B8-F8CF2FB27118}.Release|Any CPU.ActiveCfg = Release|Any CPU + {93632F2D-2BB4-46C1-A7B8-F8CF2FB27118}.Release|Any CPU.Build.0 = Release|Any CPU + {93632F2D-2BB4-46C1-A7B8-F8CF2FB27118}.Release|iPhone.ActiveCfg = Release|Any CPU + {93632F2D-2BB4-46C1-A7B8-F8CF2FB27118}.Release|iPhone.Build.0 = Release|Any CPU + {93632F2D-2BB4-46C1-A7B8-F8CF2FB27118}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {93632F2D-2BB4-46C1-A7B8-F8CF2FB27118}.Release|iPhoneSimulator.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 1b9f8d27372f247ee3213ec7422536a691a470af Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 8 Jan 2020 20:36:00 +0800 Subject: [PATCH 062/159] Add benchmark runner. --- osu.Game.Benchmarks/BenchmarkTest.cs | 23 +++++++++++++++++++ osu.Game.Benchmarks/Program.cs | 6 ++++- .../osu.Game.Benchmarks.csproj | 10 ++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Benchmarks/BenchmarkTest.cs diff --git a/osu.Game.Benchmarks/BenchmarkTest.cs b/osu.Game.Benchmarks/BenchmarkTest.cs new file mode 100644 index 0000000000..34f5edd084 --- /dev/null +++ b/osu.Game.Benchmarks/BenchmarkTest.cs @@ -0,0 +1,23 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using BenchmarkDotNet.Attributes; +using BenchmarkDotNet.Running; +using NUnit.Framework; + +namespace osu.Game.Benchmarks +{ + [TestFixture] + [MemoryDiagnoser] + public abstract class BenchmarkTest + { + [GlobalSetup] + [OneTimeSetUp] + public virtual void SetUp() + { + } + + [Test] + public void RunBenchmark() => BenchmarkRunner.Run(GetType()); + } +} diff --git a/osu.Game.Benchmarks/Program.cs b/osu.Game.Benchmarks/Program.cs index ebd30c0a7a..c55075fea6 100644 --- a/osu.Game.Benchmarks/Program.cs +++ b/osu.Game.Benchmarks/Program.cs @@ -1,13 +1,17 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using BenchmarkDotNet.Running; + namespace osu.Game.Benchmarks { public static class Program { public static void Main(string[] args) { - + BenchmarkSwitcher + .FromAssembly(typeof(Program).Assembly) + .Run(args); } } } diff --git a/osu.Game.Benchmarks/osu.Game.Benchmarks.csproj b/osu.Game.Benchmarks/osu.Game.Benchmarks.csproj index 65bfa2be14..3281fcc855 100644 --- a/osu.Game.Benchmarks/osu.Game.Benchmarks.csproj +++ b/osu.Game.Benchmarks/osu.Game.Benchmarks.csproj @@ -6,4 +6,14 @@ false + + + + + + + + + + From bd22d5b0f44522bf8293cfb9e8f9e69232534a6c Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 8 Jan 2020 21:31:58 +0800 Subject: [PATCH 063/159] Add benchmark launch profiles. --- .../.idea/runConfigurations/Benchmarks.xml | 20 +++++++++++++++++ .vscode/launch.json | 19 ++++++++++++++-- .vscode/tasks.json | 22 +++++++++++++++++-- .../Properties/launchSettings.json | 8 +++++++ 4 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 .idea/.idea.osu.Desktop/.idea/runConfigurations/Benchmarks.xml create mode 100644 osu.Game.Benchmarks/Properties/launchSettings.json diff --git a/.idea/.idea.osu.Desktop/.idea/runConfigurations/Benchmarks.xml b/.idea/.idea.osu.Desktop/.idea/runConfigurations/Benchmarks.xml new file mode 100644 index 0000000000..1815c271b4 --- /dev/null +++ b/.idea/.idea.osu.Desktop/.idea/runConfigurations/Benchmarks.xml @@ -0,0 +1,20 @@ + + + + \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index e7b691909e..6480612b2e 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,6 +1,7 @@ { "version": "0.2.0", - "configurations": [{ + "configurations": [ + { "name": "osu! (Debug)", "type": "coreclr", "request": "launch", @@ -50,7 +51,8 @@ } }, "console": "internalConsole" - }, { + }, + { "name": "osu! (Tests, Release)", "type": "coreclr", "request": "launch", @@ -139,6 +141,19 @@ }, "console": "internalConsole" }, + { + "name": "Benchmark", + "type": "coreclr", + "request": "launch", + "program": "${workspaceRoot}/osu.Game.Benchmarks/bin/Release/netcoreapp3.1/osu.Game.Benchmarks.dll", + "args": [ + "--filter", + "*" + ], + "cwd": "${workspaceRoot}", + "preLaunchTask": "Build benchmarks", + "console": "internalConsole" + }, { "name": "Cake: Debug Script", "type": "coreclr", diff --git a/.vscode/tasks.json b/.vscode/tasks.json index c087800d2a..e638dec767 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -2,7 +2,8 @@ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", - "tasks": [{ + "tasks": [ + { "label": "Build osu! (Debug)", "type": "shell", "command": "dotnet", @@ -78,7 +79,8 @@ ], "group": "build", "problemMatcher": "$msCompile" - }, { + }, + { "label": "Build tournament tests (Release)", "type": "shell", "command": "dotnet", @@ -94,6 +96,22 @@ "group": "build", "problemMatcher": "$msCompile" }, + { + "label": "Build benchmarks", + "type": "shell", + "command": "dotnet", + "args": [ + "build", + "--no-restore", + "osu.Game.Benchmarks", + "/p:Configuration=Release", + "/p:GenerateFullPaths=true", + "/m", + "/verbosity:m" + ], + "group": "build", + "problemMatcher": "$msCompile" + }, { "label": "Restore (netcoreapp3.1)", "type": "shell", diff --git a/osu.Game.Benchmarks/Properties/launchSettings.json b/osu.Game.Benchmarks/Properties/launchSettings.json new file mode 100644 index 0000000000..c1868088f9 --- /dev/null +++ b/osu.Game.Benchmarks/Properties/launchSettings.json @@ -0,0 +1,8 @@ +{ + "profiles": { + "All Benchmarks": { + "commandName": "Project", + "commandLineArgs": "--filter *" + } + } +} \ No newline at end of file From 7f393c61f8679e4a57847a97a07d6988b1b3a2f4 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 8 Jan 2020 21:55:39 +0800 Subject: [PATCH 064/159] Add BDN artifacts to gitignore. --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index e6b5db5904..732b171f69 100644 --- a/.gitignore +++ b/.gitignore @@ -331,3 +331,6 @@ fastlane/report.xml # inspectcode inspectcodereport.xml inspectcode + +# BenchmarkDotNet +/BenchmarkDotNet.Artifacts From 14289523777302fbcb3aa3c524964f9d43a365af Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Wed, 8 Jan 2020 18:59:13 +0300 Subject: [PATCH 065/159] Implement CountryFilter component for RankingsOverlay --- .../Online/TestSceneRankingsCountryFilter.cs | 45 ++++ osu.Game/Overlays/Rankings/CountryFilter.cs | 231 ++++++++++++++++++ 2 files changed, 276 insertions(+) create mode 100644 osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs create mode 100644 osu.Game/Overlays/Rankings/CountryFilter.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs new file mode 100644 index 0000000000..968be62a7c --- /dev/null +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs @@ -0,0 +1,45 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using osu.Framework.Bindables; +using osu.Game.Overlays.Rankings; +using osu.Game.Users; + +namespace osu.Game.Tests.Visual.Online +{ + public class TestSceneRankingsCountryFilter : OsuTestScene + { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(CountryFilter), + }; + + public TestSceneRankingsCountryFilter() + { + var countryBindable = new Bindable(); + CountryFilter filter; + + Add(filter = new CountryFilter + { + Country = { BindTarget = countryBindable } + }); + + var country = new Country + { + FlagName = "BY", + FullName = "Belarus" + }; + var unknownCountry = new Country + { + FlagName = "CK", + FullName = "Cook Islands" + }; + + AddStep("Set country", () => countryBindable.Value = country); + AddStep("Set null country", () => countryBindable.Value = null); + AddStep("Set country with no flag", () => countryBindable.Value = unknownCountry); + } + } +} diff --git a/osu.Game/Overlays/Rankings/CountryFilter.cs b/osu.Game/Overlays/Rankings/CountryFilter.cs new file mode 100644 index 0000000000..4a24a440cc --- /dev/null +++ b/osu.Game/Overlays/Rankings/CountryFilter.cs @@ -0,0 +1,231 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Input.Events; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; +using osu.Game.Users; +using osu.Game.Users.Drawables; +using osuTK; + +namespace osu.Game.Overlays.Rankings +{ + public class CountryFilter : Container + { + private const int duration = 200; + private const int height = 50; + + public readonly Bindable Country = new Bindable(); + + private readonly Box background; + private readonly CountryPill countryPill; + private readonly Container content; + + public CountryFilter() + { + RelativeSizeAxes = Axes.X; + Child = content = new Container + { + RelativeSizeAxes = Axes.X, + Height = height, + Alpha = 0, + Children = new Drawable[] + { + background = new Box + { + RelativeSizeAxes = Axes.Both + }, + new FillFlowContainer + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(10, 0), + Margin = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN }, + Children = new Drawable[] + { + new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Text = @"filtered by country:", + Font = OsuFont.GetFont(size: 14) + }, + countryPill = new CountryPill + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Alpha = 0, + Country = { BindTarget = Country } + } + } + } + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + background.Colour = colours.GreySeafoam; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + Country.BindValueChanged(onCountryChanged, true); + } + + private void onCountryChanged(ValueChangedEvent country) + { + countryPill.ClearTransforms(); + + if (country.NewValue == null) + { + countryPill.Collapse(); + this.ResizeHeightTo(0, duration, Easing.OutQuint); + content.FadeOut(duration, Easing.OutQuint); + return; + } + + this.ResizeHeightTo(height, duration, Easing.OutQuint); + content.FadeIn(duration, Easing.OutQuint).Finally(_ => countryPill.Expand()); + } + + private class CountryPill : CircularContainer + { + private readonly Box background; + private readonly UpdateableFlag flag; + private readonly OsuSpriteText countryName; + + public readonly Bindable Country = new Bindable(); + + public CountryPill() + { + AutoSizeDuration = duration; + AutoSizeEasing = Easing.OutQuint; + Height = 25; + Masking = true; + Children = new Drawable[] + { + background = new Box + { + RelativeSizeAxes = Axes.Both + }, + new FillFlowContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Y, + AutoSizeAxes = Axes.X, + Margin = new MarginPadding { Horizontal = 10 }, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(8, 0), + Children = new Drawable[] + { + new FillFlowContainer + { + RelativeSizeAxes = Axes.Y, + AutoSizeAxes = Axes.X, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(3, 0), + Children = new Drawable[] + { + flag = new UpdateableFlag + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(22, 15) + }, + countryName = new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Font = OsuFont.GetFont(size: 14) + } + } + }, + new CloseButton + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + ClickAction = () => Country.Value = null + } + } + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + background.Colour = colours.GreySeafoamDarker; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + Country.BindValueChanged(onCountryChanged, true); + } + + public void Expand() + { + AutoSizeAxes = Axes.X; + this.FadeIn(duration, Easing.OutQuint); + } + + public void Collapse() + { + AutoSizeAxes = Axes.None; + this.ResizeWidthTo(0, duration, Easing.OutQuint); + this.FadeOut(duration, Easing.OutQuint); + } + + private void onCountryChanged(ValueChangedEvent country) + { + if (country.NewValue == null) + return; + + flag.Country = country.NewValue; + countryName.Text = country.NewValue.FullName; + } + + private class CloseButton : Container + { + public Action ClickAction; + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + AutoSizeAxes = Axes.Both; + Children = new Drawable[] + { + new SpriteIcon + { + Size = new Vector2(8), + Icon = FontAwesome.Solid.Times, + Colour = colours.GreySeafoamLighter, + }, + new HoverClickSounds(), + }; + } + + protected override bool OnClick(ClickEvent e) + { + ClickAction?.Invoke(); + return base.OnClick(e); + } + } + } + } +} From dc64ba8ed81d21aef0c4368f53c5fcfda795161a Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Wed, 8 Jan 2020 19:22:07 +0300 Subject: [PATCH 066/159] Remove unused variable --- osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs index 968be62a7c..9a8ddf9cad 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs @@ -19,9 +19,8 @@ namespace osu.Game.Tests.Visual.Online public TestSceneRankingsCountryFilter() { var countryBindable = new Bindable(); - CountryFilter filter; - Add(filter = new CountryFilter + Add(new CountryFilter { Country = { BindTarget = countryBindable } }); From 1dbae21f981852f878154d73af241d7e44e0073a Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Wed, 8 Jan 2020 19:40:28 +0300 Subject: [PATCH 067/159] Fix crashing test --- osu.Game/Overlays/Rankings/CountryFilter.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Overlays/Rankings/CountryFilter.cs b/osu.Game/Overlays/Rankings/CountryFilter.cs index 4a24a440cc..008214a9a4 100644 --- a/osu.Game/Overlays/Rankings/CountryFilter.cs +++ b/osu.Game/Overlays/Rankings/CountryFilter.cs @@ -86,6 +86,7 @@ namespace osu.Game.Overlays.Rankings private void onCountryChanged(ValueChangedEvent country) { + content.ClearTransforms(); countryPill.ClearTransforms(); if (country.NewValue == null) From a3f7d3c4454ba53e61ef521a23d069c4ec74ebb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 8 Jan 2020 19:55:35 +0100 Subject: [PATCH 068/159] Add failing test Add test case demonstrating the lack of update of the metadata display's mods upon setting the Mods property in PlayerLoader. --- .../Visual/Gameplay/TestScenePlayerLoader.cs | 14 +++++++++++++ osu.Game/Screens/Play/PlayerLoader.cs | 20 ++++++++++--------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs index f68f4b8b83..fd3037341b 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs @@ -146,6 +146,18 @@ namespace osu.Game.Tests.Visual.Gameplay AddAssert("player mods applied", () => playerMod2.Applied); } + [Test] + public void TestModDisplayChanges() + { + var testMod = new TestMod(); + + AddStep("load player", () => ResetPlayer(true)); + + AddUntilStep("wait for loader to become current", () => loader.IsCurrentScreen()); + AddStep("set test mod in loader", () => loader.Mods.Value = new[] { testMod }); + AddAssert("test mod is displayed", () => (TestMod)loader.DisplayedMods.Single() == testMod); + } + [Test] public void TestMutedNotificationMasterVolume() => addVolumeSteps("master volume", () => audioManager.Volume.Value = 0, null, () => audioManager.Volume.IsDefault); @@ -221,6 +233,8 @@ namespace osu.Game.Tests.Visual.Gameplay public new Task DisposalTask => base.DisposalTask; + public IReadOnlyList DisplayedMods => MetadataInfo.Mods; + public TestPlayerLoader(Func createPlayer) : base(createPlayer) { diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 64fcc48004..f200c8e0ae 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -44,7 +44,7 @@ namespace osu.Game.Screens.Play private LogoTrackingContainer content; - private BeatmapMetadataDisplay info; + protected BeatmapMetadataDisplay MetadataInfo; private bool hideOverlays; public override bool HideOverlaysOnEnter => hideOverlays; @@ -96,7 +96,7 @@ namespace osu.Game.Screens.Play RelativeSizeAxes = Axes.Both, }).WithChildren(new Drawable[] { - info = new BeatmapMetadataDisplay(Beatmap.Value, Mods.Value, content.LogoFacade) + MetadataInfo = new BeatmapMetadataDisplay(Beatmap.Value, Mods.Value, content.LogoFacade) { Alpha = 0, Anchor = Anchor.Centre, @@ -138,7 +138,7 @@ namespace osu.Game.Screens.Play contentIn(); - info.Delay(750).FadeIn(500); + MetadataInfo.Delay(750).FadeIn(500); this.Delay(1800).Schedule(pushWhenLoaded); if (!muteWarningShownOnce.Value) @@ -158,7 +158,7 @@ namespace osu.Game.Screens.Play contentIn(); - info.Loading = true; + MetadataInfo.Loading = true; //we will only be resumed if the player has requested a re-run (see ValidForResume setting above) loadNewPlayer(); @@ -174,7 +174,7 @@ namespace osu.Game.Screens.Play player.RestartCount = restartCount; player.RestartRequested = restartRequested; - LoadTask = LoadComponentAsync(player, _ => info.Loading = false); + LoadTask = LoadComponentAsync(player, _ => MetadataInfo.Loading = false); } private void contentIn() @@ -350,7 +350,7 @@ namespace osu.Game.Screens.Play } } - private class BeatmapMetadataDisplay : Container + protected class BeatmapMetadataDisplay : Container { private class MetadataLine : Container { @@ -379,11 +379,12 @@ namespace osu.Game.Screens.Play } private readonly WorkingBeatmap beatmap; - private readonly IReadOnlyList mods; private readonly Drawable facade; private LoadingAnimation loading; private Sprite backgroundSprite; + public IReadOnlyList Mods { get; } + public bool Loading { set @@ -404,8 +405,9 @@ namespace osu.Game.Screens.Play public BeatmapMetadataDisplay(WorkingBeatmap beatmap, IReadOnlyList mods, Drawable facade) { this.beatmap = beatmap; - this.mods = mods; this.facade = facade; + + Mods = mods; } [BackgroundDependencyLoader] @@ -492,7 +494,7 @@ namespace osu.Game.Screens.Play Origin = Anchor.TopCentre, AutoSizeAxes = Axes.Both, Margin = new MarginPadding { Top = 20 }, - Current = { Value = mods } + Current = { Value = Mods } } }, } From f0fe3bc804738cb518c5234566cfbf511df1b8a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 8 Jan 2020 20:10:43 +0100 Subject: [PATCH 069/159] Pass bindable to BeatmapMetadataDisplay It was reported that mods selected in song select would show up during loading of replays which were recorded under a different set of mods. This was caused by BeatmapMetadataDisplay accepting a plain read-only value of the Mods bindable in PlayerLoader.load(), therefore making the mod value assignment in ReplayPlayerLoader.OnEntering() have no effect on that component. To resolve this issue, make BeatmapMetadataDisplay accept the higher-level bindable, bind to it locally and pass it down the hierarchy to ModDisplay. --- .../Visual/Gameplay/TestScenePlayerLoader.cs | 2 +- osu.Game/Screens/Play/PlayerLoader.cs | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs index fd3037341b..587281ef11 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs @@ -233,7 +233,7 @@ namespace osu.Game.Tests.Visual.Gameplay public new Task DisposalTask => base.DisposalTask; - public IReadOnlyList DisplayedMods => MetadataInfo.Mods; + public IReadOnlyList DisplayedMods => MetadataInfo.Mods.Value; public TestPlayerLoader(Func createPlayer) : base(createPlayer) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index f200c8e0ae..f37faac988 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -96,7 +96,7 @@ namespace osu.Game.Screens.Play RelativeSizeAxes = Axes.Both, }).WithChildren(new Drawable[] { - MetadataInfo = new BeatmapMetadataDisplay(Beatmap.Value, Mods.Value, content.LogoFacade) + MetadataInfo = new BeatmapMetadataDisplay(Beatmap.Value, Mods, content.LogoFacade) { Alpha = 0, Anchor = Anchor.Centre, @@ -379,11 +379,12 @@ namespace osu.Game.Screens.Play } private readonly WorkingBeatmap beatmap; + private readonly Bindable> mods; private readonly Drawable facade; private LoadingAnimation loading; private Sprite backgroundSprite; - public IReadOnlyList Mods { get; } + public IBindable> Mods => mods; public bool Loading { @@ -402,12 +403,13 @@ namespace osu.Game.Screens.Play } } - public BeatmapMetadataDisplay(WorkingBeatmap beatmap, IReadOnlyList mods, Drawable facade) + public BeatmapMetadataDisplay(WorkingBeatmap beatmap, Bindable> mods, Drawable facade) { this.beatmap = beatmap; this.facade = facade; - Mods = mods; + this.mods = new Bindable>(); + this.mods.BindTo(mods); } [BackgroundDependencyLoader] @@ -494,7 +496,7 @@ namespace osu.Game.Screens.Play Origin = Anchor.TopCentre, AutoSizeAxes = Axes.Both, Margin = new MarginPadding { Top = 20 }, - Current = { Value = Mods } + Current = mods } }, } From 34d8740ec430215a5bcf7caff3ace0669de7b265 Mon Sep 17 00:00:00 2001 From: Berkan Diler Date: Wed, 8 Jan 2020 20:21:13 +0100 Subject: [PATCH 070/159] Remove remaining usage of osuTK.MathHelper --- .../Objects/Drawables/DrawableRepeatPoint.cs | 3 ++- .../Objects/Drawables/Pieces/SnakingSliderBody.cs | 6 +++++- .../Objects/Drawables/Pieces/SpinnerDisc.cs | 3 ++- osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs | 3 ++- osu.Game/Graphics/Cursor/MenuCursor.cs | 3 ++- osu.Game/Screens/Menu/LogoVisualisation.cs | 5 +++-- 6 files changed, 16 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs index b81d94a673..94fa0272f8 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs @@ -13,6 +13,7 @@ using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using osu.Game.Rulesets.Scoring; using osuTK; using osu.Game.Skinning; +using osu.Framework.Utils; namespace osu.Game.Rulesets.Osu.Objects.Drawables { @@ -121,7 +122,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables break; } - float aimRotation = MathHelper.RadiansToDegrees(MathF.Atan2(aimRotationVector.Y - Position.Y, aimRotationVector.X - Position.X)); + float aimRotation = MathUtils.RadiansToDegrees(MathF.Atan2(aimRotationVector.Y - Position.Y, aimRotationVector.X - Position.X)); while (Math.Abs(aimRotation - Rotation) > 180) aimRotation += aimRotation < Rotation ? 360 : -360; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs index 8a8668d6af..765b3ef456 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs @@ -125,7 +125,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces private void setRange(double p0, double p1) { if (p0 > p1) - MathHelper.Swap(ref p0, ref p1); + { + double temp = p0; + p0 = p1; + p1 = temp; + } if (SnakedStart == p0 && SnakedEnd == p1) return; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index c45e98cc76..e3dd2b1b4f 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -8,6 +8,7 @@ using osu.Framework.Input.Events; using osu.Game.Graphics; using osuTK; using osuTK.Graphics; +using osu.Framework.Utils; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { @@ -93,7 +94,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { base.Update(); - var thisAngle = -(float)MathHelper.RadiansToDegrees(Math.Atan2(mousePosition.X - DrawSize.X / 2, mousePosition.Y - DrawSize.Y / 2)); + var thisAngle = -MathUtils.RadiansToDegrees(MathF.Atan2(mousePosition.X - DrawSize.X / 2, mousePosition.Y - DrawSize.Y / 2)); bool validAndTracking = tracking && spinner.StartTime <= Time.Current && spinner.EndTime > Time.Current; diff --git a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs index b1b27278fe..c46634e72f 100644 --- a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics; using osu.Game.IO; using osu.Game.Storyboards; using osu.Game.Beatmaps.Legacy; +using osu.Framework.Utils; namespace osu.Game.Beatmaps.Formats { @@ -190,7 +191,7 @@ namespace osu.Game.Beatmaps.Formats { var startValue = float.Parse(split[4], CultureInfo.InvariantCulture); var endValue = split.Length > 5 ? float.Parse(split[5], CultureInfo.InvariantCulture) : startValue; - timelineGroup?.Rotation.Add(easing, startTime, endTime, MathHelper.RadiansToDegrees(startValue), MathHelper.RadiansToDegrees(endValue)); + timelineGroup?.Rotation.Add(easing, startTime, endTime, MathUtils.RadiansToDegrees(startValue), MathUtils.RadiansToDegrees(endValue)); break; } diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 5a83d8e4ce..170ea63059 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -14,6 +14,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics.Textures; using osu.Framework.Input.Events; using osuTK.Input; +using osu.Framework.Utils; namespace osu.Game.Graphics.Cursor { @@ -55,7 +56,7 @@ namespace osu.Game.Graphics.Cursor if (dragRotationState == DragRotationState.Rotating && distance > 0) { Vector2 offset = e.MousePosition - positionMouseDown; - float degrees = (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, offset.Y)) + 24.3f; + float degrees = MathUtils.RadiansToDegrees(MathF.Atan2(-offset.X, offset.Y)) + 24.3f; // Always rotate in the direction of least distance float diff = (degrees - activeCursor.Rotation) % 360; diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs index 1a625f8d83..8fc07f5989 100644 --- a/osu.Game/Screens/Menu/LogoVisualisation.cs +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -19,6 +19,7 @@ using System; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Utils; namespace osu.Game.Screens.Menu { @@ -205,13 +206,13 @@ namespace osu.Game.Screens.Menu if (audioData[i] < amplitude_dead_zone) continue; - float rotation = MathHelper.DegreesToRadians(i / (float)bars_per_visualiser * 360 + j * 360 / visualiser_rounds); + float rotation = MathUtils.DegreesToRadians(i / (float)bars_per_visualiser * 360 + j * 360 / visualiser_rounds); float rotationCos = MathF.Cos(rotation); float rotationSin = MathF.Sin(rotation); //taking the cos and sin to the 0..1 range var barPosition = new Vector2(rotationCos / 2 + 0.5f, rotationSin / 2 + 0.5f) * size; - var barSize = new Vector2(size * (float)Math.Sqrt(2 * (1 - Math.Cos(MathHelper.DegreesToRadians(360f / bars_per_visualiser)))) / 2f, bar_length * audioData[i]); + var barSize = new Vector2(size * MathF.Sqrt(2 * (1 - MathF.Cos(MathUtils.DegreesToRadians(360f / bars_per_visualiser)))) / 2f, bar_length * audioData[i]); //The distance between the position and the sides of the bar. var bottomOffset = new Vector2(-rotationSin * barSize.X / 2, rotationCos * barSize.X / 2); //The distance between the bottom side of the bar and the top side. From ed2bf5154ddf87ac94702d5fa1284495701d2af4 Mon Sep 17 00:00:00 2001 From: Berkan Diler Date: Wed, 8 Jan 2020 20:46:17 +0100 Subject: [PATCH 071/159] Use tuple deconstruction to swap values --- .../Objects/Drawables/Pieces/SnakingSliderBody.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs index 765b3ef456..e24fa865ad 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs @@ -125,11 +125,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces private void setRange(double p0, double p1) { if (p0 > p1) - { - double temp = p0; - p0 = p1; - p1 = temp; - } + (p0, p1) = (p1, p0); if (SnakedStart == p0 && SnakedEnd == p1) return; From 6cb763a019b3ecc34d47d683390a5b476ee94334 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Thu, 9 Jan 2020 00:06:28 +0300 Subject: [PATCH 072/159] Improve animations --- osu.Game/Overlays/Rankings/CountryFilter.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Rankings/CountryFilter.cs b/osu.Game/Overlays/Rankings/CountryFilter.cs index 008214a9a4..5452bc9327 100644 --- a/osu.Game/Overlays/Rankings/CountryFilter.cs +++ b/osu.Game/Overlays/Rankings/CountryFilter.cs @@ -86,9 +86,6 @@ namespace osu.Game.Overlays.Rankings private void onCountryChanged(ValueChangedEvent country) { - content.ClearTransforms(); - countryPill.ClearTransforms(); - if (country.NewValue == null) { countryPill.Collapse(); @@ -98,7 +95,8 @@ namespace osu.Game.Overlays.Rankings } this.ResizeHeightTo(height, duration, Easing.OutQuint); - content.FadeIn(duration, Easing.OutQuint).Finally(_ => countryPill.Expand()); + content.FadeIn(duration, Easing.OutQuint); + countryPill.Expand(); } private class CountryPill : CircularContainer @@ -181,12 +179,14 @@ namespace osu.Game.Overlays.Rankings public void Expand() { + ClearTransforms(); AutoSizeAxes = Axes.X; this.FadeIn(duration, Easing.OutQuint); } public void Collapse() { + ClearTransforms(); AutoSizeAxes = Axes.None; this.ResizeWidthTo(0, duration, Easing.OutQuint); this.FadeOut(duration, Easing.OutQuint); From 29c4ae68d91e8bb06f6197eb7da2ee24dc2725bb Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Thu, 9 Jan 2020 00:14:29 +0300 Subject: [PATCH 073/159] Add some content to test scene for better visual representation --- .../Online/TestSceneRankingsCountryFilter.cs | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs index 9a8ddf9cad..360bb81715 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs @@ -4,8 +4,13 @@ using System; using System.Collections.Generic; using osu.Framework.Bindables; +using osu.Framework.Graphics.Containers; using osu.Game.Overlays.Rankings; using osu.Game.Users; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Shapes; +using osuTK.Graphics; +using osu.Game.Graphics.Sprites; namespace osu.Game.Tests.Visual.Online { @@ -20,9 +25,35 @@ namespace osu.Game.Tests.Visual.Online { var countryBindable = new Bindable(); - Add(new CountryFilter + AddRange(new Drawable[] { - Country = { BindTarget = countryBindable } + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Gray, + }, + new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + new CountryFilter + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Country = { BindTarget = countryBindable } + }, + new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Text = "Some content", + Margin = new MarginPadding { Vertical = 20 } + } + } + } }); var country = new Country From 0d9fb065da462b36074c9b292cc50c001b39236a Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Thu, 9 Jan 2020 00:27:22 +0300 Subject: [PATCH 074/159] Move CountryPill to it's own class --- .../Online/TestSceneRankingsCountryFilter.cs | 1 + osu.Game/Overlays/Rankings/CountryFilter.cs | 135 ---------------- osu.Game/Overlays/Rankings/CountryPill.cs | 149 ++++++++++++++++++ 3 files changed, 150 insertions(+), 135 deletions(-) create mode 100644 osu.Game/Overlays/Rankings/CountryPill.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs index 360bb81715..3d38710b59 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs @@ -19,6 +19,7 @@ namespace osu.Game.Tests.Visual.Online public override IReadOnlyList RequiredTypes => new[] { typeof(CountryFilter), + typeof(CountryPill) }; public TestSceneRankingsCountryFilter() diff --git a/osu.Game/Overlays/Rankings/CountryFilter.cs b/osu.Game/Overlays/Rankings/CountryFilter.cs index 5452bc9327..7cd56100db 100644 --- a/osu.Game/Overlays/Rankings/CountryFilter.cs +++ b/osu.Game/Overlays/Rankings/CountryFilter.cs @@ -1,19 +1,14 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; -using osu.Game.Graphics.UserInterface; using osu.Game.Users; -using osu.Game.Users.Drawables; using osuTK; namespace osu.Game.Overlays.Rankings @@ -98,135 +93,5 @@ namespace osu.Game.Overlays.Rankings content.FadeIn(duration, Easing.OutQuint); countryPill.Expand(); } - - private class CountryPill : CircularContainer - { - private readonly Box background; - private readonly UpdateableFlag flag; - private readonly OsuSpriteText countryName; - - public readonly Bindable Country = new Bindable(); - - public CountryPill() - { - AutoSizeDuration = duration; - AutoSizeEasing = Easing.OutQuint; - Height = 25; - Masking = true; - Children = new Drawable[] - { - background = new Box - { - RelativeSizeAxes = Axes.Both - }, - new FillFlowContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Y, - AutoSizeAxes = Axes.X, - Margin = new MarginPadding { Horizontal = 10 }, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(8, 0), - Children = new Drawable[] - { - new FillFlowContainer - { - RelativeSizeAxes = Axes.Y, - AutoSizeAxes = Axes.X, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(3, 0), - Children = new Drawable[] - { - flag = new UpdateableFlag - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(22, 15) - }, - countryName = new OsuSpriteText - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Font = OsuFont.GetFont(size: 14) - } - } - }, - new CloseButton - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - ClickAction = () => Country.Value = null - } - } - } - }; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - background.Colour = colours.GreySeafoamDarker; - } - - protected override void LoadComplete() - { - base.LoadComplete(); - Country.BindValueChanged(onCountryChanged, true); - } - - public void Expand() - { - ClearTransforms(); - AutoSizeAxes = Axes.X; - this.FadeIn(duration, Easing.OutQuint); - } - - public void Collapse() - { - ClearTransforms(); - AutoSizeAxes = Axes.None; - this.ResizeWidthTo(0, duration, Easing.OutQuint); - this.FadeOut(duration, Easing.OutQuint); - } - - private void onCountryChanged(ValueChangedEvent country) - { - if (country.NewValue == null) - return; - - flag.Country = country.NewValue; - countryName.Text = country.NewValue.FullName; - } - - private class CloseButton : Container - { - public Action ClickAction; - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - AutoSizeAxes = Axes.Both; - Children = new Drawable[] - { - new SpriteIcon - { - Size = new Vector2(8), - Icon = FontAwesome.Solid.Times, - Colour = colours.GreySeafoamLighter, - }, - new HoverClickSounds(), - }; - } - - protected override bool OnClick(ClickEvent e) - { - ClickAction?.Invoke(); - return base.OnClick(e); - } - } - } } } diff --git a/osu.Game/Overlays/Rankings/CountryPill.cs b/osu.Game/Overlays/Rankings/CountryPill.cs new file mode 100644 index 0000000000..65fce3b909 --- /dev/null +++ b/osu.Game/Overlays/Rankings/CountryPill.cs @@ -0,0 +1,149 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Collections.Generic; +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; +using osu.Game.Users; +using osu.Game.Users.Drawables; +using osuTK; +using osuTK.Graphics; + +namespace osu.Game.Overlays.Rankings +{ + public class CountryPill : CircularContainer + { + private const int duration = 200; + + private readonly Box background; + private readonly UpdateableFlag flag; + private readonly OsuSpriteText countryName; + + public readonly Bindable Country = new Bindable(); + + public CountryPill() + { + AutoSizeDuration = duration; + AutoSizeEasing = Easing.OutQuint; + Height = 25; + Masking = true; + Children = new Drawable[] + { + background = new Box + { + RelativeSizeAxes = Axes.Both + }, + new FillFlowContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Y, + AutoSizeAxes = Axes.X, + Margin = new MarginPadding { Horizontal = 10 }, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(8, 0), + Children = new Drawable[] + { + new FillFlowContainer + { + RelativeSizeAxes = Axes.Y, + AutoSizeAxes = Axes.X, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(3, 0), + Children = new Drawable[] + { + flag = new UpdateableFlag + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(22, 15) + }, + countryName = new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Font = OsuFont.GetFont(size: 14) + } + } + }, + new CloseButton + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Action = () => Country.Value = null + } + } + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + background.Colour = colours.GreySeafoamDarker; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + Country.BindValueChanged(onCountryChanged, true); + } + + public void Expand() + { + ClearTransforms(); + AutoSizeAxes = Axes.X; + this.FadeIn(duration, Easing.OutQuint); + } + + public void Collapse() + { + ClearTransforms(); + AutoSizeAxes = Axes.None; + this.ResizeWidthTo(0, duration, Easing.OutQuint); + this.FadeOut(duration, Easing.OutQuint); + } + + private void onCountryChanged(ValueChangedEvent country) + { + if (country.NewValue == null) + return; + + flag.Country = country.NewValue; + countryName.Text = country.NewValue.FullName; + } + + private class CloseButton : OsuHoverContainer + { + private readonly SpriteIcon icon; + + protected override IEnumerable EffectTargets => new[] { icon }; + + public CloseButton() + { + AutoSizeAxes = Axes.Both; + Add(icon = new SpriteIcon + { + Size = new Vector2(8), + Icon = FontAwesome.Solid.Times + }); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + IdleColour = colours.GreySeafoamLighter; + HoverColour = Color4.White; + } + } + } +} From 91735ff367f42a114b04776a728c010d190288ea Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 9 Jan 2020 13:43:44 +0900 Subject: [PATCH 075/159] Update MathUtils namespace usages --- osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs | 2 +- osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs | 2 +- osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs | 2 +- .../Replays/CatchFramedReplayInputHandler.cs | 2 +- osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 2 +- osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs | 2 +- osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs | 2 +- .../Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs | 2 +- osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs | 2 +- osu.Game.Rulesets.Mania/UI/HitExplosion.cs | 2 +- osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs | 2 +- osu.Game.Rulesets.Osu.Tests/TestSceneOsuDistanceSnapGrid.cs | 2 +- osu.Game.Rulesets.Osu.Tests/TestSceneShaking.cs | 2 +- .../TestSceneSliderSelectionBlueprint.cs | 2 +- osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs | 2 +- .../Objects/Drawables/Pieces/SpinnerSpmCounter.cs | 2 +- osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs | 2 +- osu.Game.Rulesets.Osu/Replays/OsuFramedReplayInputHandler.cs | 2 +- osu.Game.Rulesets.Osu/Skinning/LegacySliderBody.cs | 2 +- osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs | 2 +- osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoPlayfield.cs | 2 +- osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs | 2 +- osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs | 2 +- .../Visual/Editor/TestSceneZoomableScrollContainer.cs | 2 +- osu.Game.Tests/Visual/Gameplay/TestSceneBarHitErrorMeter.cs | 2 +- .../Visual/Gameplay/TestSceneDrawableScrollingRuleset.cs | 2 +- osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs | 2 +- osu.Game.Tests/Visual/Gameplay/TestSceneKeyCounter.cs | 2 +- osu.Game.Tests/Visual/Gameplay/TestSceneLeadIn.cs | 2 +- osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs | 2 +- osu.Game.Tests/Visual/Gameplay/TestSceneScoreCounter.cs | 2 +- osu.Game.Tests/Visual/Gameplay/TestSceneSongProgress.cs | 2 +- osu.Game.Tests/Visual/Multiplayer/TestSceneMatchBeatmapPanel.cs | 2 +- .../Visual/Online/TestSceneBeatmapSetOverlayDetails.cs | 2 +- .../Visual/Online/TestSceneBeatmapSetOverlaySuccessRate.cs | 2 +- osu.Game.Tests/Visual/Online/TestSceneChannelTabControl.cs | 2 +- osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs | 2 +- osu.Game.Tests/Visual/Online/TestSceneTotalCommentsCounter.cs | 2 +- osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs | 2 +- osu.Game.Tests/Visual/UserInterface/TestSceneCursors.cs | 2 +- .../Visual/UserInterface/TestSceneLogoTrackingContainer.cs | 2 +- .../Visual/UserInterface/TestSceneNotificationOverlay.cs | 2 +- .../Visual/UserInterface/TestSceneNowPlayingOverlay.cs | 2 +- .../Visual/UserInterface/TestSceneToolbarRulesetSelector.cs | 2 +- .../Components/TestSceneMatchScoreDisplay.cs | 2 +- .../Screens/Drawings/Components/VisualiserContainer.cs | 2 +- osu.Game/Graphics/Backgrounds/Triangles.cs | 2 +- osu.Game/Graphics/Containers/LogoTrackingContainer.cs | 2 +- osu.Game/Graphics/Containers/ParallaxContainer.cs | 2 +- osu.Game/Graphics/UserInterface/OsuTabControl.cs | 2 +- osu.Game/Graphics/UserInterface/StarCounter.cs | 2 +- osu.Game/Overlays/AccountCreation/ScreenEntry.cs | 2 +- osu.Game/Overlays/MedalOverlay.cs | 2 +- osu.Game/Overlays/MusicController.cs | 2 +- osu.Game/Overlays/Volume/VolumeMeter.cs | 2 +- osu.Game/Rulesets/Objects/BarLineGenerator.cs | 2 +- osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs | 2 +- osu.Game/Rulesets/Objects/SliderPath.cs | 2 +- osu.Game/Rulesets/Scoring/HealthProcessor.cs | 2 +- osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs | 2 +- .../Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs | 2 +- osu.Game/Screens/Edit/EditorClock.cs | 2 +- osu.Game/Screens/Loader.cs | 2 +- osu.Game/Screens/Menu/IntroScreen.cs | 2 +- osu.Game/Screens/Menu/IntroTriangles.cs | 2 +- osu.Game/Screens/Menu/OsuLogo.cs | 2 +- osu.Game/Screens/Play/FailAnimation.cs | 2 +- osu.Game/Screens/Play/HUD/HoldForMenuButton.cs | 2 +- osu.Game/Screens/Play/SkipOverlay.cs | 2 +- osu.Game/Screens/Play/SongProgressBar.cs | 2 +- osu.Game/Screens/Select/BeatmapCarousel.cs | 2 +- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 2 +- osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs | 2 +- osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs | 2 +- osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs | 2 +- 77 files changed, 77 insertions(+), 77 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs b/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs index 493ac7ae39..f4749be370 100644 --- a/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using Newtonsoft.Json; using NUnit.Framework; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Rulesets.Catch.Mods; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.UI; diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs index 958cd19d50..53a018c9f4 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces; using osuTK; using osuTK.Graphics; diff --git a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs index 6c8515eb90..4649dcae90 100644 --- a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs +++ b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs @@ -3,7 +3,7 @@ using System; using System.Linq; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Replays; using osu.Game.Rulesets.Catch.Beatmaps; diff --git a/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs b/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs index 22532bc9ec..f122588a2b 100644 --- a/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs +++ b/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; using osu.Framework.Input.StateChanges; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Replays; using osu.Game.Rulesets.Replays; diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index 2d6ce02e45..0c8c483048 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -7,7 +7,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Bindings; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Judgements; using osu.Game.Rulesets.Catch.Objects; diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs b/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs index 12865385b6..d0ff1fab43 100644 --- a/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using NUnit.Framework; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Objects; diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index 1a77a4944b..d904474815 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -5,7 +5,7 @@ using osu.Game.Rulesets.Mania.Objects; using System; using System.Linq; using System.Collections.Generic; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index 9565ac8994..315ef96e49 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.MathUtils; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs index 9275371a61..b12d3a7a70 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs @@ -4,7 +4,7 @@ using System.Linq; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics.Sprites; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Rulesets.Mania.Beatmaps; diff --git a/osu.Game.Rulesets.Mania/UI/HitExplosion.cs b/osu.Game.Rulesets.Mania/UI/HitExplosion.cs index ccbff226a9..35de47e208 100644 --- a/osu.Game.Rulesets.Mania/UI/HitExplosion.cs +++ b/osu.Game.Rulesets.Mania/UI/HitExplosion.cs @@ -5,7 +5,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; using osuTK; using osuTK.Graphics; diff --git a/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs b/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs index 450f7de6d2..cd3daf18a9 100644 --- a/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using NUnit.Framework; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Tests.Beatmaps; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneOsuDistanceSnapGrid.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneOsuDistanceSnapGrid.cs index c9b3d08a22..4af4d5f966 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneOsuDistanceSnapGrid.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneOsuDistanceSnapGrid.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu.Beatmaps; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneShaking.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneShaking.cs index 863d0eda09..d692be89b2 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneShaking.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneShaking.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Diagnostics; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSelectionBlueprint.cs index 013920684c..5dd2bd18a8 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSelectionBlueprint.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using NUnit.Framework; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Objects; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs index bd9d948782..5cf571d961 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs @@ -4,7 +4,7 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Framework.Testing; using osu.Framework.Timing; using osu.Game.Beatmaps; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs index 778c2f7d43..ac20407ed2 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs @@ -8,7 +8,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Input; using osu.Framework.Input.Events; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs index b81d94a673..2571ef3a70 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs @@ -7,7 +7,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs index 97a7b98c5b..80ab03c45c 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; diff --git a/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs b/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs index 2686ba4fd2..4cb2cd6539 100644 --- a/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs +++ b/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osuTK; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Rulesets.Osu.Objects; using System; diff --git a/osu.Game.Rulesets.Osu/Replays/OsuFramedReplayInputHandler.cs b/osu.Game.Rulesets.Osu/Replays/OsuFramedReplayInputHandler.cs index c6ac1dd346..b42e9ac187 100644 --- a/osu.Game.Rulesets.Osu/Replays/OsuFramedReplayInputHandler.cs +++ b/osu.Game.Rulesets.Osu/Replays/OsuFramedReplayInputHandler.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; using osu.Framework.Input.StateChanges; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Replays; using osu.Game.Rulesets.Replays; using osuTK; diff --git a/osu.Game.Rulesets.Osu/Skinning/LegacySliderBody.cs b/osu.Game.Rulesets.Osu/Skinning/LegacySliderBody.cs index d41135ca69..21df49d80b 100644 --- a/osu.Game.Rulesets.Osu/Skinning/LegacySliderBody.cs +++ b/osu.Game.Rulesets.Osu/Skinning/LegacySliderBody.cs @@ -3,7 +3,7 @@ using System; using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using osuTK.Graphics; diff --git a/osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs b/osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs index 28f5d4d301..f23fd6d3f9 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using NUnit.Framework; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Tests.Beatmaps; diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoPlayfield.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoPlayfield.cs index b2c8c7feda..c01eef5252 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoPlayfield.cs @@ -7,7 +7,7 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Judgements; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs index 338fd9e20f..5806c90115 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs @@ -4,7 +4,7 @@ using System; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Graphics; using osu.Game.Rulesets.Objects.Drawables; using osuTK.Graphics; diff --git a/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs b/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs index eec52669ff..244e37f017 100644 --- a/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs +++ b/osu.Game.Tests/Gameplay/TestSceneDrainingHealthProcessor.cs @@ -4,7 +4,7 @@ using NUnit.Framework; using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Framework.Testing; using osu.Framework.Timing; using osu.Game.Beatmaps; diff --git a/osu.Game.Tests/Visual/Editor/TestSceneZoomableScrollContainer.cs b/osu.Game.Tests/Visual/Editor/TestSceneZoomableScrollContainer.cs index da8702209c..fd248abbc9 100644 --- a/osu.Game.Tests/Visual/Editor/TestSceneZoomableScrollContainer.cs +++ b/osu.Game.Tests/Visual/Editor/TestSceneZoomableScrollContainer.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Shapes; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Framework.Testing; using osu.Game.Graphics; using osu.Game.Graphics.Cursor; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneBarHitErrorMeter.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneBarHitErrorMeter.cs index e3688c276f..72fc6d8bd2 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneBarHitErrorMeter.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneBarHitErrorMeter.cs @@ -6,7 +6,7 @@ using osu.Game.Rulesets.Objects; using System; using System.Collections.Generic; using osu.Game.Rulesets.Judgements; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneDrawableScrollingRuleset.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneDrawableScrollingRuleset.cs index 36235a4418..46f62b9541 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneDrawableScrollingRuleset.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneDrawableScrollingRuleset.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs index 5336c720a1..78c3b22fb9 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs @@ -7,7 +7,7 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Track; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Rulesets; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneKeyCounter.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneKeyCounter.cs index ad747e88e1..e7b3e007fc 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneKeyCounter.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneKeyCounter.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Screens.Play; using osuTK.Input; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneLeadIn.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneLeadIn.cs index 0150c6ea74..563d6be0da 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneLeadIn.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneLeadIn.cs @@ -5,7 +5,7 @@ using System.Diagnostics; using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Osu; diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs index f68f4b8b83..a1eb416043 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs @@ -12,7 +12,7 @@ using osu.Framework.Audio; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Framework.Screens; using osu.Game.Configuration; using osu.Game.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneScoreCounter.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneScoreCounter.cs index 080a287b48..ffd6f55b53 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneScoreCounter.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneScoreCounter.cs @@ -4,7 +4,7 @@ using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Play.HUD; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSongProgress.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSongProgress.cs index af21007efe..9a217ae416 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSongProgress.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSongProgress.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Framework.Timing; using osu.Game.Rulesets.Objects; using osu.Game.Screens.Play; diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchBeatmapPanel.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchBeatmapPanel.cs index 68ad0b42b4..1e3e06ce7a 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchBeatmapPanel.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchBeatmapPanel.cs @@ -7,7 +7,7 @@ using osu.Game.Beatmaps; using osu.Game.Online.Multiplayer; using osu.Game.Screens.Multi.Match.Components; using osu.Framework.Graphics; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Audio; using osu.Framework.Allocation; diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlayDetails.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlayDetails.cs index 96c0c59695..990e0a166b 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlayDetails.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlayDetails.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Overlays.BeatmapSet; using osu.Game.Screens.Select.Details; diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlaySuccessRate.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlaySuccessRate.cs index 80fad44593..2b572c1f6c 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlaySuccessRate.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlaySuccessRate.cs @@ -8,7 +8,7 @@ using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Overlays.BeatmapSet; using osu.Game.Screens.Select.Details; diff --git a/osu.Game.Tests/Visual/Online/TestSceneChannelTabControl.cs b/osu.Game.Tests/Visual/Online/TestSceneChannelTabControl.cs index 16e47c5df9..c98b65ded7 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChannelTabControl.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChannelTabControl.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Graphics.Sprites; using osu.Game.Online.Chat; using osu.Game.Overlays.Chat.Tabs; diff --git a/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs index b19f2dbf31..1b136d9e41 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.BeatmapSet.Scores; using osu.Game.Rulesets.Osu.Mods; diff --git a/osu.Game.Tests/Visual/Online/TestSceneTotalCommentsCounter.cs b/osu.Game.Tests/Visual/Online/TestSceneTotalCommentsCounter.cs index 4702d24125..f14c75084f 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneTotalCommentsCounter.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneTotalCommentsCounter.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Bindables; using osu.Game.Overlays.Comments; -using osu.Framework.MathUtils; +using osu.Framework.Utils; namespace osu.Game.Tests.Visual.Online { diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs index 00fa95bedc..eb812f5d5a 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs @@ -11,7 +11,7 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Bindables; using osu.Framework.Extensions; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Framework.Platform; using osu.Framework.Screens; using osu.Game.Beatmaps; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneCursors.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneCursors.cs index e95f4c09c6..d1dde4664a 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneCursors.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneCursors.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Graphics.Cursor; using osu.Game.Graphics.Sprites; using osuTK; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneLogoTrackingContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneLogoTrackingContainer.cs index 54876dbbda..4e394b5ed8 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneLogoTrackingContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneLogoTrackingContainer.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Framework.Testing; using osu.Game.Graphics.Containers; using osu.Game.Screens.Menu; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneNotificationOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneNotificationOverlay.cs index 35e5f9719c..f8ace73168 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneNotificationOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneNotificationOverlay.cs @@ -8,7 +8,7 @@ using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Graphics.Sprites; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs index 330ccecd54..2ea9aec50a 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs @@ -4,7 +4,7 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Overlays; using osu.Game.Rulesets.Osu; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs index 0da256855a..e6589fa823 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics; using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Rulesets; namespace osu.Game.Tests.Visual.UserInterface diff --git a/osu.Game.Tournament.Tests/Components/TestSceneMatchScoreDisplay.cs b/osu.Game.Tournament.Tests/Components/TestSceneMatchScoreDisplay.cs index 72d9eb0e07..77119f7a60 100644 --- a/osu.Game.Tournament.Tests/Components/TestSceneMatchScoreDisplay.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneMatchScoreDisplay.cs @@ -3,7 +3,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Tournament.IPC; using osu.Game.Tournament.Screens.Gameplay.Components; diff --git a/osu.Game.Tournament/Screens/Drawings/Components/VisualiserContainer.cs b/osu.Game.Tournament/Screens/Drawings/Components/VisualiserContainer.cs index 1cd942b987..f21f5c9460 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/VisualiserContainer.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/VisualiserContainer.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.MathUtils; +using osu.Framework.Utils; namespace osu.Game.Tournament.Screens.Drawings.Components { diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index af492bacc9..b9c7b26e3e 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osuTK; using osuTK.Graphics; using System; diff --git a/osu.Game/Graphics/Containers/LogoTrackingContainer.cs b/osu.Game/Graphics/Containers/LogoTrackingContainer.cs index 23015e8bf5..dadd7d5240 100644 --- a/osu.Game/Graphics/Containers/LogoTrackingContainer.cs +++ b/osu.Game/Graphics/Containers/LogoTrackingContainer.cs @@ -4,7 +4,7 @@ using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Screens.Menu; using osuTK; diff --git a/osu.Game/Graphics/Containers/ParallaxContainer.cs b/osu.Game/Graphics/Containers/ParallaxContainer.cs index bf743b90ed..4cd3934cde 100644 --- a/osu.Game/Graphics/Containers/ParallaxContainer.cs +++ b/osu.Game/Graphics/Containers/ParallaxContainer.cs @@ -9,7 +9,7 @@ using osuTK; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Configuration; -using osu.Framework.MathUtils; +using osu.Framework.Utils; namespace osu.Game.Graphics.Containers { diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index ed8904db7e..6a7998d5fb 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -15,7 +15,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Graphics.Sprites; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Graphics/UserInterface/StarCounter.cs b/osu.Game/Graphics/UserInterface/StarCounter.cs index 3ee572602b..586cd2ce84 100644 --- a/osu.Game/Graphics/UserInterface/StarCounter.cs +++ b/osu.Game/Graphics/UserInterface/StarCounter.cs @@ -4,7 +4,7 @@ using osuTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using System; using System.Linq; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs index e530ff5489..7067e02cd2 100644 --- a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs +++ b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs @@ -9,7 +9,7 @@ using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Framework.Platform; using osu.Framework.Screens; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 15aec1f17c..aa28b0659d 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -21,7 +21,7 @@ using osu.Framework.Graphics.Shapes; using System; using osu.Framework.Graphics.Effects; using osu.Framework.Input.Events; -using osu.Framework.MathUtils; +using osu.Framework.Utils; namespace osu.Game.Overlays { diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 270e90dca5..3c0f6468bc 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -8,7 +8,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Input.Bindings; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Framework.Threading; using osu.Game.Beatmaps; using osu.Game.Input.Bindings; diff --git a/osu.Game/Overlays/Volume/VolumeMeter.cs b/osu.Game/Overlays/Volume/VolumeMeter.cs index da696e0fdd..7effd290e6 100644 --- a/osu.Game/Overlays/Volume/VolumeMeter.cs +++ b/osu.Game/Overlays/Volume/VolumeMeter.cs @@ -12,7 +12,7 @@ using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osuTK; diff --git a/osu.Game/Rulesets/Objects/BarLineGenerator.cs b/osu.Game/Rulesets/Objects/BarLineGenerator.cs index 99672240e2..5588e9c0b7 100644 --- a/osu.Game/Rulesets/Objects/BarLineGenerator.cs +++ b/osu.Game/Rulesets/Objects/BarLineGenerator.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 3eab4555d1..1fc51d2ce8 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -10,7 +10,7 @@ using osu.Game.Beatmaps.Formats; using osu.Game.Audio; using System.Linq; using JetBrains.Annotations; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Beatmaps.Legacy; namespace osu.Game.Rulesets.Objects.Legacy diff --git a/osu.Game/Rulesets/Objects/SliderPath.cs b/osu.Game/Rulesets/Objects/SliderPath.cs index 293138097f..62a5b6f0b5 100644 --- a/osu.Game/Rulesets/Objects/SliderPath.cs +++ b/osu.Game/Rulesets/Objects/SliderPath.cs @@ -7,7 +7,7 @@ using System.Linq; using Newtonsoft.Json; using osu.Framework.Bindables; using osu.Framework.Caching; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Rulesets.Objects.Types; using osuTK; diff --git a/osu.Game/Rulesets/Scoring/HealthProcessor.cs b/osu.Game/Rulesets/Scoring/HealthProcessor.cs index 0c6b3f67b4..45edc0f4a3 100644 --- a/osu.Game/Rulesets/Scoring/HealthProcessor.cs +++ b/osu.Game/Rulesets/Scoring/HealthProcessor.cs @@ -3,7 +3,7 @@ using System; using osu.Framework.Bindables; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Rulesets.Judgements; namespace osu.Game.Rulesets.Scoring diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs index 095985e9d1..980a127cf4 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs @@ -4,7 +4,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Framework.Threading; using osu.Game.Beatmaps; using osu.Game.Configuration; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs index 54922fec5e..9aa527667b 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Transforms; using osu.Framework.Input.Events; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Graphics.Containers; using osuTK; diff --git a/osu.Game/Screens/Edit/EditorClock.cs b/osu.Game/Screens/Edit/EditorClock.cs index 93a5f19121..e5e47507f3 100644 --- a/osu.Game/Screens/Edit/EditorClock.cs +++ b/osu.Game/Screens/Edit/EditorClock.cs @@ -3,7 +3,7 @@ using System; using System.Linq; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; diff --git a/osu.Game/Screens/Loader.cs b/osu.Game/Screens/Loader.cs index 41ee01be20..289413c65a 100644 --- a/osu.Game/Screens/Loader.cs +++ b/osu.Game/Screens/Loader.cs @@ -6,7 +6,7 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Shaders; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Screens.Menu; using osuTK; using osu.Framework.Screens; diff --git a/osu.Game/Screens/Menu/IntroScreen.cs b/osu.Game/Screens/Menu/IntroScreen.cs index df83e98494..26455b1dbd 100644 --- a/osu.Game/Screens/Menu/IntroScreen.cs +++ b/osu.Game/Screens/Menu/IntroScreen.cs @@ -7,7 +7,7 @@ using osu.Framework.Audio.Sample; using osu.Framework.Audio.Track; using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Configuration; diff --git a/osu.Game/Screens/Menu/IntroTriangles.cs b/osu.Game/Screens/Menu/IntroTriangles.cs index c86f1393a4..50cfe23481 100644 --- a/osu.Game/Screens/Menu/IntroTriangles.cs +++ b/osu.Game/Screens/Menu/IntroTriangles.cs @@ -13,7 +13,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Video; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Framework.Timing; using osu.Game.Graphics; using osu.Game.Graphics.Containers; diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 534400e720..33b6ee8025 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -12,7 +12,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Input.Events; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; diff --git a/osu.Game/Screens/Play/FailAnimation.cs b/osu.Game/Screens/Play/FailAnimation.cs index a3caffb620..54c644c999 100644 --- a/osu.Game/Screens/Play/FailAnimation.cs +++ b/osu.Game/Screens/Play/FailAnimation.cs @@ -10,7 +10,7 @@ using osu.Framework.Allocation; using osu.Framework.Audio.Sample; using osu.Framework.Audio.Track; using osu.Framework.Graphics; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects.Drawables; using osuTK; diff --git a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs index 640224c057..7946e6d322 100644 --- a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs +++ b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs @@ -12,7 +12,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Containers; diff --git a/osu.Game/Screens/Play/SkipOverlay.cs b/osu.Game/Screens/Play/SkipOverlay.cs index 1a5ed20953..772d326c7f 100644 --- a/osu.Game/Screens/Play/SkipOverlay.cs +++ b/osu.Game/Screens/Play/SkipOverlay.cs @@ -19,7 +19,7 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.Containers; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Input.Bindings; namespace osu.Game.Screens.Play diff --git a/osu.Game/Screens/Play/SongProgressBar.cs b/osu.Game/Screens/Play/SongProgressBar.cs index cdf495e257..9df36c9c2b 100644 --- a/osu.Game/Screens/Play/SongProgressBar.cs +++ b/osu.Game/Screens/Play/SongProgressBar.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Framework.Threading; namespace osu.Game.Screens.Play diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 4acc619753..bf2382c4ae 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -9,7 +9,7 @@ using System.Collections.Generic; using System.Linq; using osu.Game.Configuration; using osuTK.Input; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index d54c13c7db..451708c1cf 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -13,7 +13,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs index 6118191302..121491d6ca 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Graphics; using osuTK; using osuTK.Graphics; diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs index a076bb54df..ced3b9c1b6 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs @@ -8,7 +8,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Animations; using osu.Framework.Graphics.Textures; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Beatmaps; namespace osu.Game.Storyboards.Drawables diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs index ac795b3349..c0da0e9c0e 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs @@ -8,7 +8,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.MathUtils; +using osu.Framework.Utils; using osu.Game.Beatmaps; namespace osu.Game.Storyboards.Drawables From dde843268466c82ee02dcb369e7c4afaaf787f90 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 9 Jan 2020 13:43:57 +0900 Subject: [PATCH 076/159] Fix exception through due to multiple binds --- osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 1ab3a5b533..3ced9ee753 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -49,9 +49,12 @@ namespace osu.Game.Screens.Backgrounds Beatmap = beatmap; InternalChild = dimmable = CreateFadeContainer(); + dimmable.EnableUserDim.BindTo(EnableUserDim); dimmable.IsBreakTime.BindTo(IsBreakTime); dimmable.BlurAmount.BindTo(BlurAmount); + + StoryboardReplacesBackground.BindTo(dimmable.StoryboardReplacesBackground); } [BackgroundDependencyLoader] @@ -99,7 +102,6 @@ namespace osu.Game.Screens.Backgrounds b.Depth = newDepth; dimmable.Background = Background = b; - StoryboardReplacesBackground.BindTo(dimmable.StoryboardReplacesBackground); } public override bool Equals(BackgroundScreen other) From b2db2ee259f1661c2a6576a4aa247bff27b642fe Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 9 Jan 2020 15:35:54 +0900 Subject: [PATCH 077/159] Update package version --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index e1e6f2e478..a78148f36e 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -54,6 +54,6 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index b497133e62..77d41566ca 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -23,7 +23,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index edd35b0774..b551a1442f 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -74,7 +74,7 @@ - + @@ -82,7 +82,7 @@ - + From 26c80e35fbdeb7af8ecdb144628b863e3b1d25ee Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 9 Jan 2020 17:17:08 +0800 Subject: [PATCH 078/159] Fix missing namespace --- osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs index 289c01fbf3..d2ac1bf079 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs @@ -15,6 +15,7 @@ using osu.Game.Beatmaps; using osu.Game.Graphics.Cursor; using osu.Game.Graphics.UserInterface; using osu.Game.Online.Leaderboards; +using osu.Game.Online.Placeholders; using osu.Game.Overlays; using osu.Game.Rulesets; using osu.Game.Scoring; From ffa0cf2d44174c870c5c0dc2173b73e9ba496a89 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 9 Jan 2020 17:28:48 +0800 Subject: [PATCH 079/159] Add comment detailing why this is requried --- osu.Game/Graphics/UserInterface/DimmedLoadingLayer.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Graphics/UserInterface/DimmedLoadingLayer.cs b/osu.Game/Graphics/UserInterface/DimmedLoadingLayer.cs index aca3768540..bdc3cd4c49 100644 --- a/osu.Game/Graphics/UserInterface/DimmedLoadingLayer.cs +++ b/osu.Game/Graphics/UserInterface/DimmedLoadingLayer.cs @@ -47,6 +47,7 @@ namespace osu.Game.Graphics.UserInterface { switch (e) { + // blocking scroll can cause weird behaviour when this layer is used within a ScrollContainer. case ScrollEvent _: return false; } From 6a2bcbcef81a986f3f9823ae29957206c0b306b3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 9 Jan 2020 18:47:00 +0900 Subject: [PATCH 080/159] Bump version --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index a78148f36e..fde58ec489 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -54,6 +54,6 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 77d41566ca..04d0b580da 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -23,7 +23,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index b551a1442f..50aabd636a 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -74,7 +74,7 @@ - + @@ -82,7 +82,7 @@ - + From 87645f6a41c443f5c78a9fb16a338130be52df3d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jan 2020 01:13:42 +0800 Subject: [PATCH 081/159] Remove excess namespace specification --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs index 662fd15183..96b18f2d80 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs @@ -13,7 +13,6 @@ using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using osu.Game.Rulesets.Scoring; using osuTK; using osu.Game.Skinning; -using osu.Framework.Utils; namespace osu.Game.Rulesets.Osu.Objects.Drawables { From 14829837c467c07c2eae8445e9e1c7dfce262006 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 10 Jan 2020 01:38:03 +0800 Subject: [PATCH 082/159] Update namespace specifications --- .../Visual/UserInterface/TestSceneDeleteLocalScore.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs index d2ac1bf079..1e5e26e4c5 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs @@ -8,9 +8,9 @@ using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics.Cursor; -using osu.Framework.MathUtils; using osu.Framework.Platform; using osu.Framework.Testing; +using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Graphics.Cursor; using osu.Game.Graphics.UserInterface; From 20f426cda0348a8ad4f45cd7b75b0d3ce8a91951 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 8 Jan 2020 22:06:18 +0800 Subject: [PATCH 083/159] Add beatmap parsing as sample benchmark. --- .../BenchmarkBeatmapParsing.cs | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 osu.Game.Benchmarks/BenchmarkBeatmapParsing.cs diff --git a/osu.Game.Benchmarks/BenchmarkBeatmapParsing.cs b/osu.Game.Benchmarks/BenchmarkBeatmapParsing.cs new file mode 100644 index 0000000000..394fd75488 --- /dev/null +++ b/osu.Game.Benchmarks/BenchmarkBeatmapParsing.cs @@ -0,0 +1,37 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.IO; +using BenchmarkDotNet.Attributes; +using osu.Framework.IO.Stores; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.Formats; +using osu.Game.IO; +using osu.Game.IO.Archives; +using osu.Game.Resources; + +namespace osu.Game.Benchmarks +{ + public class BenchmarkBeatmapParsing : BenchmarkTest + { + private readonly MemoryStream beatmapStream = new MemoryStream(); + + public override void SetUp() + { + using (var resources = new DllResourceStore(OsuResources.ResourceAssembly)) + using (var archive = resources.GetStream("Beatmaps/241526 Soleily - Renatus.osz")) + using (var reader = new ZipArchiveReader(archive)) + reader.GetStream("Soleily - Renatus (Gamu) [Insane].osu").CopyTo(beatmapStream); + } + + [Benchmark] + public Beatmap BenchmarkBundledBeatmap() + { + beatmapStream.Seek(0, SeekOrigin.Begin); + var reader = new LineBufferedReader(beatmapStream); // no disposal + + var decoder = Decoder.GetDecoder(reader); + return decoder.Decode(reader); + } + } +} From c4131e01da7341984450a11d8e5349f02e2c0d58 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 10 Jan 2020 20:20:44 +0800 Subject: [PATCH 084/159] Downgrade NUnit for now. --- osu.Game.Benchmarks/osu.Game.Benchmarks.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Benchmarks/osu.Game.Benchmarks.csproj b/osu.Game.Benchmarks/osu.Game.Benchmarks.csproj index 3281fcc855..f2e1c0ec3b 100644 --- a/osu.Game.Benchmarks/osu.Game.Benchmarks.csproj +++ b/osu.Game.Benchmarks/osu.Game.Benchmarks.csproj @@ -9,7 +9,7 @@ - + From bd175118e9a5075c396a4dfb578729f6d1a7ff89 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 11 Jan 2020 04:16:07 +0800 Subject: [PATCH 085/159] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index fde58ec489..f3838644d1 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -54,6 +54,6 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 04d0b580da..4fc9e47119 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -23,7 +23,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 50aabd636a..760600e6d4 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -74,7 +74,7 @@ - + @@ -82,7 +82,7 @@ - + From 19033e0ef85fba4086d303825718de15affc268c Mon Sep 17 00:00:00 2001 From: Joehu Date: Fri, 10 Jan 2020 19:25:33 -0800 Subject: [PATCH 086/159] Fix user status dropdown having no padding around items --- osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index 27796c1e32..e485aa5ea9 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -323,8 +323,6 @@ namespace osu.Game.Overlays.Settings.Sections.General Colour = Color4.Black.Opacity(0.25f), Radius = 4, }; - - ItemsContainer.Padding = new MarginPadding(); } [BackgroundDependencyLoader] From 820f9f2273f98995c2da7c40427e43b3d0ca0ae8 Mon Sep 17 00:00:00 2001 From: Joehu Date: Fri, 10 Jan 2020 20:16:46 -0800 Subject: [PATCH 087/159] Fix default button absorbing drag scroll on settings --- osu.Game/Overlays/Settings/SettingsItem.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index 35f28ab1b2..55e1937d83 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -163,10 +163,6 @@ namespace osu.Game.Overlays.Settings public string TooltipText => "Revert to default"; - protected override bool OnMouseDown(MouseDownEvent e) => true; - - protected override bool OnMouseUp(MouseUpEvent e) => true; - protected override bool OnClick(ClickEvent e) { if (bindable != null && !bindable.Disabled) From 76c70a76229a956c186d304c9232a604015148e8 Mon Sep 17 00:00:00 2001 From: mcendu Date: Sat, 11 Jan 2020 21:19:46 +0800 Subject: [PATCH 088/159] Move hit target bar height def to defaulthittarget --- osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs index ee2cec1bbd..90e78c3899 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs @@ -18,8 +18,6 @@ namespace osu.Game.Rulesets.Mania.UI.Components { public class ColumnHitObjectArea : CompositeDrawable, IHasAccentColour { - private const float hit_target_bar_height = 2; - private readonly IBindable direction = new Bindable(); private readonly Drawable hitTarget; @@ -67,6 +65,8 @@ namespace osu.Game.Rulesets.Mania.UI.Components private class DefaultHitTarget : CompositeDrawable, IHasAccentColour { + private const float hit_target_bar_height = 2; + private readonly IBindable direction = new Bindable(); private readonly Container hitTargetLine; From ec95cbd0affc9e9c91817459740f46f4ba964a4d Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sat, 11 Jan 2020 16:03:00 +0100 Subject: [PATCH 089/159] Don't update rich presence if the rpc client isn't initialized. --- osu.Desktop/DiscordRichPresence.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Desktop/DiscordRichPresence.cs b/osu.Desktop/DiscordRichPresence.cs index 80bb82c769..08cc0e7f5f 100644 --- a/osu.Desktop/DiscordRichPresence.cs +++ b/osu.Desktop/DiscordRichPresence.cs @@ -75,6 +75,9 @@ namespace osu.Desktop private void updateStatus() { + if (!client.IsInitialized) + return; + if (status.Value is UserStatusOffline) { client.ClearPresence(); From cd679707eddc4aa2a4ff911e4da1221526bc3a2a Mon Sep 17 00:00:00 2001 From: Craftplacer Date: Sat, 11 Jan 2020 17:16:11 +0100 Subject: [PATCH 090/159] Prevent channel duplicates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Bartłomiej Dach --- osu.Game/Online/Chat/ChannelManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 19c3be0d7b..33b0c0e9e1 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -447,7 +447,7 @@ namespace osu.Game.Online.Chat public void MarkChannelAsRead(Message message) { - var channel = JoinedChannels.First(c => c.Id == message.ChannelId); + var channel = JoinedChannels.Single(c => c.Id == message.ChannelId); var req = new MarkChannelAsReadRequest(channel, message); req.Success += () => channel.LastReadId = message.Id; req.Failure += e => Logger.Error(e, "Failed to mark channel as read"); From 50e357a79930b0980fb67fddafc21c65712a0c49 Mon Sep 17 00:00:00 2001 From: Craftplacer Date: Sat, 11 Jan 2020 17:42:02 +0100 Subject: [PATCH 091/159] Change method parameters, add detailed error message and method docs --- osu.Game/Online/Chat/ChannelManager.cs | 16 +++++++++++++--- osu.Game/Overlays/ChatOverlay.cs | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 33b0c0e9e1..9f263477d0 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -445,12 +445,22 @@ namespace osu.Game.Online.Chat return tcs.Task; } - public void MarkChannelAsRead(Message message) + /// + /// Marks the as read + /// (see for more information) + /// + /// The channel that will be marked as read + /// The message where it will be read up to. If was provided, the latest message of the will be read. + public void MarkChannelAsRead(Channel channel, Message message = null) { - var channel = JoinedChannels.Single(c => c.Id == message.ChannelId); + if (message == null) + message = channel.Messages.Last(); + var req = new MarkChannelAsReadRequest(channel, message); + req.Success += () => channel.LastReadId = message.Id; - req.Failure += e => Logger.Error(e, "Failed to mark channel as read"); + req.Failure += e => Logger.Error(e, $"Failed to mark channel {channel.ToString()} up to '{message.ToString()}' as read"); + api.Queue(req); } diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index b64d3a1893..45d311df28 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -282,7 +282,7 @@ namespace osu.Game.Overlays // mark channel as read when channel switched if (e.NewValue.Messages.Any()) - channelManager.MarkChannelAsRead(e.NewValue.Messages.Last()); + channelManager.MarkChannelAsRead(e.NewValue); } private float startDragChatHeight; From d9c57baa89cab9430f3a9577666d0a8708096444 Mon Sep 17 00:00:00 2001 From: Craftplacer Date: Sat, 11 Jan 2020 17:48:03 +0100 Subject: [PATCH 092/159] Add test case for mismatch of channels --- osu.Game/Online/Chat/ChannelManager.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 9f263477d0..b30d1ffa60 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using osu.Framework.Allocation; @@ -455,6 +456,8 @@ namespace osu.Game.Online.Chat { if (message == null) message = channel.Messages.Last(); + else + Debug.Assert(channel.Id == message.Id, "Provided channel and message owner channel aren't equal."); var req = new MarkChannelAsReadRequest(channel, message); From f8a11e50b677c4f3172efbbeae05eee81e713608 Mon Sep 17 00:00:00 2001 From: Craftplacer Date: Sat, 11 Jan 2020 18:00:34 +0100 Subject: [PATCH 093/159] Remove redundant ToString() calls as string interpolation does this automatically.. --- osu.Game/Online/Chat/ChannelManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index b30d1ffa60..5aab43dbd9 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -462,7 +462,7 @@ namespace osu.Game.Online.Chat var req = new MarkChannelAsReadRequest(channel, message); req.Success += () => channel.LastReadId = message.Id; - req.Failure += e => Logger.Error(e, $"Failed to mark channel {channel.ToString()} up to '{message.ToString()}' as read"); + req.Failure += e => Logger.Error(e, $"Failed to mark channel {channel} up to '{message}' as read"); api.Queue(req); } From 2ea1367a881cab6e5e9eed787971a6f5ca22f989 Mon Sep 17 00:00:00 2001 From: Craftplacer Date: Sat, 11 Jan 2020 19:47:35 +0100 Subject: [PATCH 094/159] Remove message parameter and make it mark the entire channel as read --- osu.Game/Online/Chat/ChannelManager.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 5aab43dbd9..4071be0aaf 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -448,17 +448,11 @@ namespace osu.Game.Online.Chat /// /// Marks the as read - /// (see for more information) /// /// The channel that will be marked as read - /// The message where it will be read up to. If was provided, the latest message of the will be read. - public void MarkChannelAsRead(Channel channel, Message message = null) + public void MarkChannelAsRead(Channel channel) { - if (message == null) - message = channel.Messages.Last(); - else - Debug.Assert(channel.Id == message.Id, "Provided channel and message owner channel aren't equal."); - + var message = channel.Messages.Last(); var req = new MarkChannelAsReadRequest(channel, message); req.Success += () => channel.LastReadId = message.Id; From ccaf4e48a169644bafbfeafe006e9c71d57a5beb Mon Sep 17 00:00:00 2001 From: Craftplacer Date: Sat, 11 Jan 2020 20:04:58 +0100 Subject: [PATCH 095/159] Remove using directive --- osu.Game/Online/Chat/ChannelManager.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 4071be0aaf..35a48b7ec8 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using osu.Framework.Allocation; From f43602518a6b013bdcb0e8cd9bc3309463f4d53c Mon Sep 17 00:00:00 2001 From: Joehu Date: Sat, 11 Jan 2020 11:43:51 -0800 Subject: [PATCH 096/159] Add global action for toggling now playing overlay --- osu.Game/Input/Bindings/GlobalActionContainer.cs | 4 ++++ osu.Game/OsuGame.cs | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs index e37567c72c..7763577a14 100644 --- a/osu.Game/Input/Bindings/GlobalActionContainer.cs +++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs @@ -24,6 +24,7 @@ namespace osu.Game.Input.Bindings public IEnumerable GlobalKeyBindings => new[] { + new KeyBinding(InputKey.F6, GlobalAction.ToggleNowPlaying), new KeyBinding(InputKey.F8, GlobalAction.ToggleChat), new KeyBinding(InputKey.F9, GlobalAction.ToggleSocial), new KeyBinding(InputKey.F10, GlobalAction.ToggleGameplayMouseButtons), @@ -137,5 +138,8 @@ namespace osu.Game.Input.Bindings [Description("Play / pause")] MusicPlay, + + [Description("Toggle now playing overlay")] + ToggleNowPlaying, } } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 84aba4af52..9df854d178 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -61,6 +61,8 @@ namespace osu.Game private NotificationOverlay notifications; + private NowPlayingOverlay nowPlaying; + private DirectOverlay direct; private SocialOverlay social; @@ -624,7 +626,7 @@ namespace osu.Game Origin = Anchor.TopRight, }, rightFloatingOverlayContent.Add, true); - loadComponentSingleFile(new NowPlayingOverlay + loadComponentSingleFile(nowPlaying = new NowPlayingOverlay { GetToolbarHeight = () => ToolbarOffset, Anchor = Anchor.TopRight, @@ -822,6 +824,10 @@ namespace osu.Game switch (action) { + case GlobalAction.ToggleNowPlaying: + nowPlaying.ToggleVisibility(); + return true; + case GlobalAction.ToggleChat: chatOverlay.ToggleVisibility(); return true; From f1b4fbb844082a910481373c74114b59519ad62c Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sun, 12 Jan 2020 17:38:15 +0300 Subject: [PATCH 097/159] Make gradient in NewsArticleCover be effected by hover --- osu.Game/Overlays/News/NewsArticleCover.cs | 23 +++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/News/NewsArticleCover.cs b/osu.Game/Overlays/News/NewsArticleCover.cs index e484309a18..f61b30b381 100644 --- a/osu.Game/Overlays/News/NewsArticleCover.cs +++ b/osu.Game/Overlays/News/NewsArticleCover.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osuTK.Graphics; @@ -19,6 +20,10 @@ namespace osu.Game.Overlays.News { public class NewsArticleCover : Container { + private const int hover_duration = 300; + + private readonly Box gradient; + public NewsArticleCover(ArticleInfo info) { RelativeSizeAxes = Axes.X; @@ -47,11 +52,11 @@ namespace osu.Game.Overlays.News Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, }, - new Box + gradient = new Box { RelativeSizeAxes = Axes.Both, - Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0.1f), Color4.Black.Opacity(0.6f)), - Alpha = 1f, + Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0.1f), Color4.Black.Opacity(0.7f)), + Alpha = 0 }, new DateContainer(info.Time) { @@ -90,6 +95,18 @@ namespace osu.Game.Overlays.News bg.OnLoadComplete += d => d.FadeIn(250, Easing.In); } + protected override bool OnHover(HoverEvent e) + { + gradient.FadeIn(hover_duration, Easing.OutQuint); + return base.OnHover(e); + } + + protected override void OnHoverLost(HoverLostEvent e) + { + base.OnHoverLost(e); + gradient.FadeOut(hover_duration, Easing.OutQuint); + } + [LongRunningLoad] private class NewsBackground : Sprite { From 8cc2d70df0fb725e09891caf912adb335841e31d Mon Sep 17 00:00:00 2001 From: Craftplacer Date: Sun, 12 Jan 2020 16:24:14 +0100 Subject: [PATCH 098/159] Reduce API calls by checking what message was last marked as read --- osu.Game/Online/Chat/ChannelManager.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 35a48b7ec8..b741bd9433 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -451,6 +451,9 @@ namespace osu.Game.Online.Chat /// The channel that will be marked as read public void MarkChannelAsRead(Channel channel) { + if (channel.LastMessageId == channel.LastReadId) + return; + var message = channel.Messages.Last(); var req = new MarkChannelAsReadRequest(channel, message); From aa2645502cf182cc8241814f89ad0a39f6b4cbf3 Mon Sep 17 00:00:00 2001 From: TheWildTree Date: Sun, 12 Jan 2020 20:43:48 +0100 Subject: [PATCH 099/159] Fix adjusted value always being 0 --- osu.Game/Screens/Select/Details/AdvancedStats.cs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/osu.Game/Screens/Select/Details/AdvancedStats.cs b/osu.Game/Screens/Select/Details/AdvancedStats.cs index a147527f6c..52a5b101d4 100644 --- a/osu.Game/Screens/Select/Details/AdvancedStats.cs +++ b/osu.Game/Screens/Select/Details/AdvancedStats.cs @@ -118,17 +118,9 @@ namespace osu.Game.Screens.Select.Details mod.ApplyToDifficulty(adjustedDifficulty); } - //mania specific - if ((Beatmap?.Ruleset?.ID ?? 0) == 3) - { - firstValue.Title = "Key Amount"; - firstValue.Value = ((int)MathF.Round(baseDifficulty?.CircleSize ?? 0), (int)MathF.Round(adjustedDifficulty?.CircleSize ?? 0)); - } - else - { - firstValue.Title = "Circle Size"; - firstValue.Value = (baseDifficulty?.CircleSize ?? 0, adjustedDifficulty?.CircleSize); - } + // Account for mania differences + firstValue.Title = (Beatmap?.Ruleset?.ID ?? 0) == 3 ? "Key Amount" : "Circle Size"; + firstValue.Value = (baseDifficulty?.CircleSize ?? 0, adjustedDifficulty?.CircleSize); starDifficulty.Value = ((float)(Beatmap?.StarDifficulty ?? 0), null); From b5ac707c6cf9be7671adbaa95677ad43ce7d9379 Mon Sep 17 00:00:00 2001 From: TheWildTree Date: Sun, 12 Jan 2020 21:09:48 +0100 Subject: [PATCH 100/159] Remove unnecessary directive --- osu.Game/Screens/Select/Details/AdvancedStats.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Select/Details/AdvancedStats.cs b/osu.Game/Screens/Select/Details/AdvancedStats.cs index 52a5b101d4..b7f60a8370 100644 --- a/osu.Game/Screens/Select/Details/AdvancedStats.cs +++ b/osu.Game/Screens/Select/Details/AdvancedStats.cs @@ -10,7 +10,6 @@ using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; -using System; using osu.Game.Beatmaps; using osu.Framework.Bindables; using System.Collections.Generic; From c190c68659236e0e5b2d57945b7a52ee7d936a7f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 13 Jan 2020 12:22:44 +0900 Subject: [PATCH 101/159] Add safety for channel with no messages --- osu.Game/Online/Chat/ChannelManager.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index b741bd9433..4b5ec1cad0 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -454,7 +454,11 @@ namespace osu.Game.Online.Chat if (channel.LastMessageId == channel.LastReadId) return; - var message = channel.Messages.Last(); + var message = channel.Messages.LastOrDefault(); + + if (message == null) + return; + var req = new MarkChannelAsReadRequest(channel, message); req.Success += () => channel.LastReadId = message.Id; From af167eb719964794663983e32f2fbac80ba4f693 Mon Sep 17 00:00:00 2001 From: recapitalverb <41869184+recapitalverb@users.noreply.github.com> Date: Mon, 13 Jan 2020 23:28:26 +0700 Subject: [PATCH 102/159] Remove duplicate condition in TournamentFont --- osu.Game.Tournament/TournamentFont.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tournament/TournamentFont.cs b/osu.Game.Tournament/TournamentFont.cs index f9e60ff2bc..32f0264562 100644 --- a/osu.Game.Tournament/TournamentFont.cs +++ b/osu.Game.Tournament/TournamentFont.cs @@ -61,7 +61,7 @@ namespace osu.Game.Tournament string weightString = weight.ToString(); // Only exo has an explicit "regular" weight, other fonts do not - if (weight == FontWeight.Regular && family != GetFamilyString(TournamentTypeface.Aquatico) && family != GetFamilyString(TournamentTypeface.Aquatico)) + if (weight == FontWeight.Regular && family != GetFamilyString(TournamentTypeface.Aquatico)) weightString = string.Empty; return weightString; From 619fe29871b7e2797b9e0c15003842bb70e4059f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jan 2020 01:39:45 +0900 Subject: [PATCH 103/159] Make reverse arrow animate faster via divisor specification Adds MinimumBeatLength to BeatSyncedContainer to make sure things don't get out of hand. --- .../Objects/Drawables/Pieces/ReverseArrowPiece.cs | 3 +++ osu.Game/Graphics/Containers/BeatSyncedContainer.cs | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs index 2b9a3aa197..2c6e5b7c18 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs @@ -20,6 +20,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { this.repeatPoint = repeatPoint; + Divisor = 2; + MinimumBeatLength = 200; + Anchor = Anchor.Centre; Origin = Anchor.Centre; diff --git a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs index b9ef279f5c..be9aefa359 100644 --- a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs +++ b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs @@ -38,6 +38,11 @@ namespace osu.Game.Graphics.Containers /// public int Divisor { get; set; } = 1; + /// + /// An optional minimum beat length. Any beat length below this will be multiplied by two until valid. + /// + public double MinimumBeatLength { get; set; } + /// /// Default length of a beat in milliseconds. Used whenever there is no beatmap or track playing. /// @@ -89,6 +94,9 @@ namespace osu.Game.Graphics.Containers double beatLength = timingPoint.BeatLength / Divisor; + while (beatLength < MinimumBeatLength) + beatLength *= 2; + int beatIndex = (int)((currentTrackTime - timingPoint.Time) / beatLength) - (effectPoint.OmitFirstBarLine ? 1 : 0); // The beats before the start of the first control point are off by 1, this should do the trick From c5085aea24ae4b08890baac8e894ce208d71af7e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jan 2020 01:45:10 +0900 Subject: [PATCH 104/159] Use Child, not InternalChild --- .../Objects/Drawables/Pieces/ReverseArrowPiece.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs index 2c6e5b7c18..ee7cdefa13 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2); - InternalChild = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.ReverseArrow), _ => new SpriteIcon + Child = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.ReverseArrow), _ => new SpriteIcon { RelativeSizeAxes = Axes.Both, Icon = FontAwesome.Solid.ChevronRight, @@ -45,7 +45,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) { if (Clock.CurrentTime < repeatPoint.StartTime) - InternalChild.ScaleTo(1.3f).ScaleTo(1f, Math.Min(timingPoint.BeatLength, repeatPoint.StartTime - Clock.CurrentTime), Easing.Out); + Child.ScaleTo(1.3f).ScaleTo(1f, Math.Min(timingPoint.BeatLength, repeatPoint.StartTime - Clock.CurrentTime), Easing.Out); } } } From 210d06b75ed27209d6d8721a8d3b131004a57bb5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jan 2020 01:45:32 +0900 Subject: [PATCH 105/159] Remove default value --- .../Objects/Drawables/Pieces/ReverseArrowPiece.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs index ee7cdefa13..37bbfbe806 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs @@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces RelativeSizeAxes = Axes.Both, Icon = FontAwesome.Solid.ChevronRight, Size = new Vector2(0.35f) - }, confineMode: ConfineMode.NoScaling) + }) { Anchor = Anchor.Centre, Origin = Anchor.Centre, From ab4f31639d9e2ccfd8ac4cc61091c024aa0c6827 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jan 2020 01:47:44 +0900 Subject: [PATCH 106/159] Remove weird time clause --- .../Objects/Drawables/Pieces/ReverseArrowPiece.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs index 37bbfbe806..0403fe8196 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs @@ -45,7 +45,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) { if (Clock.CurrentTime < repeatPoint.StartTime) - Child.ScaleTo(1.3f).ScaleTo(1f, Math.Min(timingPoint.BeatLength, repeatPoint.StartTime - Clock.CurrentTime), Easing.Out); + Child.ScaleTo(1.3f).ScaleTo(1f, timingPoint.BeatLength, Easing.Out); } } } From fe09e34f1bf8a9ed9d7479c0792ac871ae3b5020 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jan 2020 01:48:20 +0900 Subject: [PATCH 107/159] Remove limiting clause --- .../Objects/Drawables/Pieces/ReverseArrowPiece.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs index 0403fe8196..08dd97b0d8 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs @@ -42,10 +42,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces }; } - protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) - { - if (Clock.CurrentTime < repeatPoint.StartTime) - Child.ScaleTo(1.3f).ScaleTo(1f, timingPoint.BeatLength, Easing.Out); - } + protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) => + Child.ScaleTo(1.3f).ScaleTo(1f, timingPoint.BeatLength, Easing.Out); } } From c196e83e75f495f533f82e867d7d8cd3e9165738 Mon Sep 17 00:00:00 2001 From: Joehu Date: Mon, 13 Jan 2020 20:48:39 -0800 Subject: [PATCH 108/159] Allow changing volume in song select with arrow keys when pressing alt --- osu.Game/Screens/Select/BeatmapCarousel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index bf2382c4ae..da01ac5f95 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -436,7 +436,7 @@ namespace osu.Game.Screens.Select break; } - if (direction == 0) + if (direction == 0 || e.AltPressed) return base.OnKeyDown(e); SelectNext(direction, skipDifficulties); From 20466d79df37e8671badf7bd12f7dc66b0bcea10 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Jan 2020 14:18:28 +0900 Subject: [PATCH 109/159] Update netcore version --- .idea/.idea.osu.Desktop/.idea/runConfigurations/osu_SDL.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.idea/.idea.osu.Desktop/.idea/runConfigurations/osu_SDL.xml b/.idea/.idea.osu.Desktop/.idea/runConfigurations/osu_SDL.xml index 1fd10e0e1a..d85a0ae44c 100644 --- a/.idea/.idea.osu.Desktop/.idea/runConfigurations/osu_SDL.xml +++ b/.idea/.idea.osu.Desktop/.idea/runConfigurations/osu_SDL.xml @@ -1,6 +1,6 @@ -