From d7fc9043812b99dc09d843ea94c17da50e8c2f47 Mon Sep 17 00:00:00 2001 From: Ganendra Afrasya Date: Fri, 11 Oct 2019 00:12:36 +0700 Subject: [PATCH 01/38] 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 02/38] 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 03/38] 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 04/38] 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 05/38] 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 06/38] 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 07/38] 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 08/38] 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 09/38] 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 10/38] 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 11/38] 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 12/38] 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 89fa1be2c8d1fc38cf86dbd9dc3522c5687c151f Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 25 Dec 2019 22:55:14 +0300 Subject: [PATCH 13/38] Fix download manager potentially not handling cancel requests --- osu.Game/Database/DownloadableArchiveModelManager.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/osu.Game/Database/DownloadableArchiveModelManager.cs b/osu.Game/Database/DownloadableArchiveModelManager.cs index 5f688c149d..71bf195a8d 100644 --- a/osu.Game/Database/DownloadableArchiveModelManager.cs +++ b/osu.Game/Database/DownloadableArchiveModelManager.cs @@ -92,8 +92,6 @@ namespace osu.Game.Database notification.CancelRequested += () => { request.Cancel(); - currentDownloads.Remove(request); - notification.State = ProgressNotificationState.Cancelled; return true; }; @@ -109,11 +107,11 @@ namespace osu.Game.Database { DownloadFailed?.Invoke(request); - if (error is OperationCanceledException) return; - - notification.State = ProgressNotificationState.Cancelled; - Logger.Error(error, $"{HumanisedModelName.Titleize()} download failed!"); currentDownloads.Remove(request); + notification.State = ProgressNotificationState.Cancelled; + + if (!(error is OperationCanceledException)) + Logger.Error(error, $"{HumanisedModelName.Titleize()} download failed!"); } } From 099b044f04c556aefe50db9ab9a40fe9dee06c12 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 27 Dec 2019 06:37:36 +0300 Subject: [PATCH 14/38] Add headless test ensuring correct cancelling download behaviour --- .../Online/TestSceneBeatmapDownloading.cs | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 osu.Game.Tests/Online/TestSceneBeatmapDownloading.cs diff --git a/osu.Game.Tests/Online/TestSceneBeatmapDownloading.cs b/osu.Game.Tests/Online/TestSceneBeatmapDownloading.cs new file mode 100644 index 0000000000..1572b813c0 --- /dev/null +++ b/osu.Game.Tests/Online/TestSceneBeatmapDownloading.cs @@ -0,0 +1,44 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Testing; +using osu.Game.Beatmaps; +using osu.Game.Overlays.Notifications; +using osu.Game.Tests.Visual; + +namespace osu.Game.Tests.Online +{ + [HeadlessTest] + public class TestSceneBeatmapManager : OsuTestScene + { + private BeatmapManager beatmaps; + private ProgressNotification recentNotification; + + private static readonly BeatmapSetInfo test_model = new BeatmapSetInfo { OnlineBeatmapSetID = 1 }; + + [BackgroundDependencyLoader] + private void load(BeatmapManager beatmaps) + { + this.beatmaps = beatmaps; + + beatmaps.PostNotification = n => recentNotification = n as ProgressNotification; + } + + [TestCase(true)] + [TestCase(false)] + public void TestCancelDownloadFromRequest(bool closeFromRequest) + { + AddStep("download beatmap", () => beatmaps.Download(test_model)); + + if (closeFromRequest) + AddStep("cancel download from request", () => beatmaps.GetExistingDownload(test_model).Cancel()); + else + AddStep("cancel download from notification", () => recentNotification.Close()); + + AddUntilStep("is removed from download list", () => beatmaps.GetExistingDownload(test_model) == null); + AddAssert("is notification cancelled", () => recentNotification.State == ProgressNotificationState.Cancelled); + } + } +} From e030266e9575f3d24be45cc8fc3b61d88a32b182 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 27 Dec 2019 06:40:01 +0300 Subject: [PATCH 15/38] Fix test name --- osu.Game.Tests/Online/TestSceneBeatmapDownloading.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Online/TestSceneBeatmapDownloading.cs b/osu.Game.Tests/Online/TestSceneBeatmapDownloading.cs index 1572b813c0..7887002e1f 100644 --- a/osu.Game.Tests/Online/TestSceneBeatmapDownloading.cs +++ b/osu.Game.Tests/Online/TestSceneBeatmapDownloading.cs @@ -28,7 +28,7 @@ namespace osu.Game.Tests.Online [TestCase(true)] [TestCase(false)] - public void TestCancelDownloadFromRequest(bool closeFromRequest) + public void TestCancelDownloadRequest(bool closeFromRequest) { AddStep("download beatmap", () => beatmaps.Download(test_model)); From f03f310bde651aee3a608fc0b1928dbee2ae93c0 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 27 Dec 2019 06:43:43 +0300 Subject: [PATCH 16/38] Match file name --- ...{TestSceneBeatmapDownloading.cs => TestSceneBeatmapManager.cs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename osu.Game.Tests/Online/{TestSceneBeatmapDownloading.cs => TestSceneBeatmapManager.cs} (100%) diff --git a/osu.Game.Tests/Online/TestSceneBeatmapDownloading.cs b/osu.Game.Tests/Online/TestSceneBeatmapManager.cs similarity index 100% rename from osu.Game.Tests/Online/TestSceneBeatmapDownloading.cs rename to osu.Game.Tests/Online/TestSceneBeatmapManager.cs From e8bcb52612d13667ef93842d570384c225297e43 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sat, 28 Dec 2019 18:07:55 +0300 Subject: [PATCH 17/38] Set UserAgent for API requests --- osu.Game/Online/API/APIRequest.cs | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/osu.Game/Online/API/APIRequest.cs b/osu.Game/Online/API/APIRequest.cs index fcbd4d314a..0956c749a2 100644 --- a/osu.Game/Online/API/APIRequest.cs +++ b/osu.Game/Online/API/APIRequest.cs @@ -14,7 +14,7 @@ namespace osu.Game.Online.API /// Type of the response (used for deserialisation). public abstract class APIRequest : APIRequest { - protected override WebRequest CreateWebRequest() => new JsonWebRequest(Uri); + protected override WebRequest CreateWebRequest() => new OsuJsonWebRequest(Uri); public T Result => ((JsonWebRequest)WebRequest).ResponseObject; @@ -30,6 +30,16 @@ namespace osu.Game.Online.API /// This will be scheduled to the API's internal scheduler (run on update thread automatically). /// public new event APISuccessHandler Success; + + private class OsuJsonWebRequest : JsonWebRequest + { + public OsuJsonWebRequest(string uri) + : base(uri) + { + } + + protected override string UserAgent => "osu!"; + } } /// @@ -39,7 +49,7 @@ namespace osu.Game.Online.API { protected abstract string Target { get; } - protected virtual WebRequest CreateWebRequest() => new WebRequest(Uri); + protected virtual WebRequest CreateWebRequest() => new OsuWebRequest(Uri); protected virtual string Uri => $@"{API.Endpoint}/api/v2/{Target}"; @@ -152,6 +162,16 @@ namespace osu.Game.Online.API [JsonProperty("error")] public string ErrorMessage { get; set; } } + + private class OsuWebRequest : WebRequest + { + public OsuWebRequest(string uri) + : base(uri) + { + } + + protected override string UserAgent => "osu!"; + } } public class APIException : InvalidOperationException From cb2b89a2c9197fa56aca6d86c0f3429a14bef27a Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sun, 29 Dec 2019 03:01:14 +0300 Subject: [PATCH 18/38] Fix crashing TextSceneMedalOverlay --- osu.Game/Overlays/MedalOverlay.cs | 4 ++-- osu.Game/Overlays/MedalSplash/DrawableMedal.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 1f15c773f4..5da573e81a 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -155,12 +155,12 @@ namespace osu.Game.Overlays Radius = 50, }; - disc.Add(drawableMedal = new DrawableMedal(medal) + LoadComponentAsync(drawableMedal = new DrawableMedal(medal) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.Both, - }); + }, disc.Add); } protected override void LoadComplete() diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index a9b4bed334..3cf7befb45 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -51,7 +51,7 @@ namespace osu.Game.Overlays.MedalSplash { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Scale = new Vector2(0.81f), + Scale = new Vector2(0.41f), }, medalGlow = new Sprite { From e9b57de76f245adc7a0dfc4d11384c07e9c65a6d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 3 Jan 2020 17:23:17 +0900 Subject: [PATCH 19/38] 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 0b41d5cda4..e1e6f2e478 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 565608b40f..b497133e62 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 60355b8592..edd35b0774 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -74,7 +74,7 @@ - + @@ -82,7 +82,7 @@ - + From 9fb29cc7a7ffc7a7db1a42e59d871f3799c9b2e9 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sat, 4 Jan 2020 18:45:34 +0300 Subject: [PATCH 20/38] Move medal loading to LoadComplete --- osu.Game/Overlays/MedalOverlay.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 5da573e81a..f7070bbaec 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -154,19 +154,22 @@ namespace osu.Game.Overlays Colour = colours.Blue.Opacity(0.5f), Radius = 50, }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); LoadComponentAsync(drawableMedal = new DrawableMedal(medal) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.Both, - }, disc.Add); - } - - protected override void LoadComplete() - { - base.LoadComplete(); - Show(); + }, loaded => + { + disc.Add(loaded); + Show(); + }); } protected override void Update() From 3bd3ebad49466e55ade2c3a682a71d27c9e77dda Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sat, 4 Jan 2020 18:26:31 +0100 Subject: [PATCH 21/38] 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 22/38] 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 23/38] 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 24/38] 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 25/38] 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 f70f25098b2b64999708d1771dce0189e4a4f029 Mon Sep 17 00:00:00 2001 From: Sebastian Krajewski Date: Mon, 6 Jan 2020 00:32:13 +0100 Subject: [PATCH 26/38] Change visible triangles colour when dark or light colour is changed --- osu.Game/Graphics/Backgrounds/Triangles.cs | 46 ++++++++++++++++++++-- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index 6d88808150..cbb50f7ddb 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -29,8 +29,29 @@ namespace osu.Game.Graphics.Backgrounds /// private const float edge_smoothness = 1; - public Color4 ColourLight = Color4.White; - public Color4 ColourDark = Color4.Black; + private Color4 colourLight = Color4.White; + + public Color4 ColourLight + { + get => colourLight; + set + { + colourLight = value; + updateColours(); + } + } + + private Color4 colourDark = Color4.Black; + + public Color4 ColourDark + { + get => colourDark; + set + { + colourDark = value; + updateColours(); + } + } /// /// Whether we want to expire triangles as they exit our draw area completely. @@ -151,7 +172,8 @@ namespace osu.Game.Graphics.Backgrounds TriangleParticle particle = CreateTriangle(); particle.Position = new Vector2(RNG.NextSingle(), randomY ? RNG.NextSingle() : 1); - particle.Colour = CreateTriangleShade(); + particle.ColourShade = RNG.NextSingle(); + particle.Colour = CreateTriangleShade(particle.ColourShade); return particle; } @@ -177,7 +199,17 @@ namespace osu.Game.Graphics.Backgrounds /// Creates a shade of colour for the triangles. /// /// The colour. - protected virtual Color4 CreateTriangleShade() => Interpolation.ValueAt(RNG.NextSingle(), ColourDark, ColourLight, 0, 1); + protected virtual Color4 CreateTriangleShade(float shade) => Interpolation.ValueAt(shade, colourDark, colourLight, 0, 1); + + private void updateColours() + { + for (int i = 0; i < parts.Count; i++) + { + TriangleParticle newParticle = parts[i]; + newParticle.Colour = CreateTriangleShade(newParticle.ColourShade); + parts[i] = newParticle; + } + } protected override DrawNode CreateDrawNode() => new TrianglesDrawNode(this); @@ -264,6 +296,12 @@ namespace osu.Game.Graphics.Backgrounds /// public Vector2 Position; + /// + /// The colour shade of the triangle. + /// This is needed for colour recalculation of visible triangles when or is changed. + /// + public float ColourShade; + /// /// The colour of the triangle. /// From d1f3cb3dbdc928317d21242374d1a6d0ec2f1152 Mon Sep 17 00:00:00 2001 From: Sebastian Krajewski Date: Mon, 6 Jan 2020 01:53:29 +0100 Subject: [PATCH 27/38] Premature checks to avoid unnecessary updates --- osu.Game/Graphics/Backgrounds/Triangles.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index cbb50f7ddb..af492bacc9 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -36,6 +36,8 @@ namespace osu.Game.Graphics.Backgrounds get => colourLight; set { + if (colourLight == value) return; + colourLight = value; updateColours(); } @@ -48,6 +50,8 @@ namespace osu.Game.Graphics.Backgrounds get => colourDark; set { + if (colourDark == value) return; + colourDark = value; updateColours(); } From e433e8b78f3d28494d88b9d9ab47ad2b53ca254c Mon Sep 17 00:00:00 2001 From: Ganendra Afrasya Date: Mon, 6 Jan 2020 17:12:10 +0700 Subject: [PATCH 28/38] 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 de4c62788c88bb9ced4e976c9a32ccafba3f4266 Mon Sep 17 00:00:00 2001 From: Sebastian Krajewski Date: Mon, 6 Jan 2020 12:51:38 +0100 Subject: [PATCH 29/38] Move colour generation to TriangleParticle --- osu.Game/Graphics/Backgrounds/Triangles.cs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index af492bacc9..0eb5e90d3e 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -176,8 +176,7 @@ namespace osu.Game.Graphics.Backgrounds TriangleParticle particle = CreateTriangle(); particle.Position = new Vector2(RNG.NextSingle(), randomY ? RNG.NextSingle() : 1); - particle.ColourShade = RNG.NextSingle(); - particle.Colour = CreateTriangleShade(particle.ColourShade); + particle.UpdateColour(colourDark, colourLight); return particle; } @@ -199,18 +198,12 @@ namespace osu.Game.Graphics.Backgrounds return new TriangleParticle { Scale = scale }; } - /// - /// Creates a shade of colour for the triangles. - /// - /// The colour. - protected virtual Color4 CreateTriangleShade(float shade) => Interpolation.ValueAt(shade, colourDark, colourLight, 0, 1); - private void updateColours() { for (int i = 0; i < parts.Count; i++) { TriangleParticle newParticle = parts[i]; - newParticle.Colour = CreateTriangleShade(newParticle.ColourShade); + newParticle.UpdateColour(colourDark, colourLight); parts[i] = newParticle; } } @@ -293,7 +286,7 @@ namespace osu.Game.Graphics.Backgrounds } } - protected struct TriangleParticle : IComparable + protected class TriangleParticle : IComparable { /// /// The position of the top vertex of the triangle. @@ -304,7 +297,7 @@ namespace osu.Game.Graphics.Backgrounds /// The colour shade of the triangle. /// This is needed for colour recalculation of visible triangles when or is changed. /// - public float ColourShade; + private readonly float colourShade = RNG.NextSingle(); /// /// The colour of the triangle. @@ -316,6 +309,11 @@ namespace osu.Game.Graphics.Backgrounds /// public float Scale; + public void UpdateColour(Color4 colourDark, Color4 colourLight) + { + Colour = Interpolation.ValueAt(colourShade, colourDark, colourLight, 0, 1); + } + /// /// Compares two s. This is a reverse comparer because when the /// triangles are added to the particles list, they should be drawn from largest to smallest From 0b9cc8ed1b4e2f15ceb11228a51a7f27afce5e67 Mon Sep 17 00:00:00 2001 From: Sebastian Krajewski Date: Mon, 6 Jan 2020 12:51:38 +0100 Subject: [PATCH 30/38] Revert "Move colour generation to TriangleParticle" This reverts commit de4c62788c88bb9ced4e976c9a32ccafba3f4266. --- osu.Game/Graphics/Backgrounds/Triangles.cs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index 0eb5e90d3e..af492bacc9 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -176,7 +176,8 @@ namespace osu.Game.Graphics.Backgrounds TriangleParticle particle = CreateTriangle(); particle.Position = new Vector2(RNG.NextSingle(), randomY ? RNG.NextSingle() : 1); - particle.UpdateColour(colourDark, colourLight); + particle.ColourShade = RNG.NextSingle(); + particle.Colour = CreateTriangleShade(particle.ColourShade); return particle; } @@ -198,12 +199,18 @@ namespace osu.Game.Graphics.Backgrounds return new TriangleParticle { Scale = scale }; } + /// + /// Creates a shade of colour for the triangles. + /// + /// The colour. + protected virtual Color4 CreateTriangleShade(float shade) => Interpolation.ValueAt(shade, colourDark, colourLight, 0, 1); + private void updateColours() { for (int i = 0; i < parts.Count; i++) { TriangleParticle newParticle = parts[i]; - newParticle.UpdateColour(colourDark, colourLight); + newParticle.Colour = CreateTriangleShade(newParticle.ColourShade); parts[i] = newParticle; } } @@ -286,7 +293,7 @@ namespace osu.Game.Graphics.Backgrounds } } - protected class TriangleParticle : IComparable + protected struct TriangleParticle : IComparable { /// /// The position of the top vertex of the triangle. @@ -297,7 +304,7 @@ namespace osu.Game.Graphics.Backgrounds /// The colour shade of the triangle. /// This is needed for colour recalculation of visible triangles when or is changed. /// - private readonly float colourShade = RNG.NextSingle(); + public float ColourShade; /// /// The colour of the triangle. @@ -309,11 +316,6 @@ namespace osu.Game.Graphics.Backgrounds /// public float Scale; - public void UpdateColour(Color4 colourDark, Color4 colourLight) - { - Colour = Interpolation.ValueAt(colourShade, colourDark, colourLight, 0, 1); - } - /// /// Compares two s. This is a reverse comparer because when the /// triangles are added to the particles list, they should be drawn from largest to smallest From 3ca4d1a28c7cb1fdbefa15f46a469712fe74e0a1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jan 2020 11:47:00 +0900 Subject: [PATCH 31/38] Split out tests --- .../Online/TestSceneBeatmapManager.cs | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Online/TestSceneBeatmapManager.cs b/osu.Game.Tests/Online/TestSceneBeatmapManager.cs index 7887002e1f..0ae0186770 100644 --- a/osu.Game.Tests/Online/TestSceneBeatmapManager.cs +++ b/osu.Game.Tests/Online/TestSceneBeatmapManager.cs @@ -26,16 +26,23 @@ namespace osu.Game.Tests.Online beatmaps.PostNotification = n => recentNotification = n as ProgressNotification; } - [TestCase(true)] - [TestCase(false)] - public void TestCancelDownloadRequest(bool closeFromRequest) + [Test] + public void TestCancelDownloadFromRequest() { AddStep("download beatmap", () => beatmaps.Download(test_model)); - if (closeFromRequest) - AddStep("cancel download from request", () => beatmaps.GetExistingDownload(test_model).Cancel()); - else - AddStep("cancel download from notification", () => recentNotification.Close()); + AddStep("cancel download from request", () => beatmaps.GetExistingDownload(test_model).Cancel()); + + AddUntilStep("is removed from download list", () => beatmaps.GetExistingDownload(test_model) == null); + AddAssert("is notification cancelled", () => recentNotification.State == ProgressNotificationState.Cancelled); + } + + [Test] + public void TestCancelDownloadFromNotification() + { + AddStep("download beatmap", () => beatmaps.Download(test_model)); + + AddStep("cancel download from notification", () => recentNotification.Close()); AddUntilStep("is removed from download list", () => beatmaps.GetExistingDownload(test_model) == null); AddAssert("is notification cancelled", () => recentNotification.State == ProgressNotificationState.Cancelled); From fd925526e2b320f4b055506312113b9f9a62d569 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jan 2020 13:39:30 +0900 Subject: [PATCH 32/38] Fix medal overlay display --- osu.Game/Overlays/MedalOverlay.cs | 174 ++++++++++++++++-------------- 1 file changed, 91 insertions(+), 83 deletions(-) diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index f7070bbaec..15aec1f17c 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -41,105 +41,114 @@ namespace osu.Game.Overlays private SampleChannel getSample; + private readonly Container content; + public MedalOverlay(Medal medal) { this.medal = medal; RelativeSizeAxes = Axes.Both; - Children = new Drawable[] + Child = content = new Container { - background = new Box + Alpha = 0, + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black.Opacity(60), - }, - outerSpin = new Sprite - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(DISC_SIZE + 500), - Alpha = 0f, - }, - backgroundStrip = new Container - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.X, - Height = border_width, - Alpha = 0f, - Children = new[] + background = new Box { - new Container + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black.Opacity(60), + }, + outerSpin = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(DISC_SIZE + 500), + Alpha = 0f, + }, + backgroundStrip = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.X, + Height = border_width, + Alpha = 0f, + Children = new[] { - RelativeSizeAxes = Axes.Both, - Anchor = Anchor.Centre, - Origin = Anchor.CentreRight, - Width = 0.5f, - Padding = new MarginPadding { Right = DISC_SIZE / 2 }, - Children = new[] + new Container { - leftStrip = new BackgroundStrip(0f, 1f) + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.CentreRight, + Width = 0.5f, + Padding = new MarginPadding { Right = DISC_SIZE / 2 }, + Children = new[] { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, + leftStrip = new BackgroundStrip(0f, 1f) + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + }, + }, + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.CentreLeft, + Width = 0.5f, + Padding = new MarginPadding { Left = DISC_SIZE / 2 }, + Children = new[] + { + rightStrip = new BackgroundStrip(1f, 0f), }, }, }, - new Container + }, + particleContainer = new Container + { + RelativeSizeAxes = Axes.Both, + Alpha = 0f, + }, + disc = new CircularContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Alpha = 0f, + Masking = true, + AlwaysPresent = true, + BorderColour = Color4.White, + BorderThickness = border_width, + Size = new Vector2(DISC_SIZE), + Scale = new Vector2(0.8f), + Children = new Drawable[] { - RelativeSizeAxes = Axes.Both, - Anchor = Anchor.Centre, - Origin = Anchor.CentreLeft, - Width = 0.5f, - Padding = new MarginPadding { Left = DISC_SIZE / 2 }, - Children = new[] + new Box { - rightStrip = new BackgroundStrip(1f, 0f), + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"05262f"), + }, + new Triangles + { + RelativeSizeAxes = Axes.Both, + TriangleScale = 2, + ColourDark = OsuColour.FromHex(@"04222b"), + ColourLight = OsuColour.FromHex(@"052933"), + }, + innerSpin = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Size = new Vector2(1.05f), + Alpha = 0.25f, }, }, }, - }, - particleContainer = new Container - { - RelativeSizeAxes = Axes.Both, - Alpha = 0f, - }, - disc = new CircularContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Alpha = 0f, - Masking = true, - AlwaysPresent = true, - BorderColour = Color4.White, - BorderThickness = border_width, - Size = new Vector2(DISC_SIZE), - Scale = new Vector2(0.8f), - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.FromHex(@"05262f"), - }, - new Triangles - { - RelativeSizeAxes = Axes.Both, - TriangleScale = 2, - ColourDark = OsuColour.FromHex(@"04222b"), - ColourLight = OsuColour.FromHex(@"052933"), - }, - innerSpin = new Sprite - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Size = new Vector2(1.05f), - Alpha = 0.25f, - }, - }, - }, + } }; + + Show(); } [BackgroundDependencyLoader] @@ -168,7 +177,7 @@ namespace osu.Game.Overlays }, loaded => { disc.Add(loaded); - Show(); + startAnimation(); }); } @@ -193,11 +202,10 @@ namespace osu.Game.Overlays private const double initial_duration = 400; private const double step_duration = 900; - protected override void PopIn() + private void startAnimation() { - base.PopIn(); + content.Show(); - this.FadeIn(200); background.FlashColour(Color4.White.Opacity(0.25f), 400); getSample.Play(); From 97b5d71ee4dd86619f116f9e86bd33b7c7de72db Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 7 Jan 2020 15:09:30 +0900 Subject: [PATCH 33/38] Adjust catch HP increase values --- .../Judgements/CatchBananaJudgement.cs | 2 +- .../Judgements/CatchDropletJudgement.cs | 12 ------------ osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs | 12 ------------ .../Judgements/CatchTinyDropletJudgement.cs | 2 +- 4 files changed, 2 insertions(+), 26 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs index 374dd50c11..fc030877f1 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Catch.Judgements return 0; case HitResult.Perfect: - return 0.008; + return 0.01; } } diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchDropletJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchDropletJudgement.cs index f1399bb5c0..e87ecba749 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchDropletJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchDropletJudgement.cs @@ -18,17 +18,5 @@ namespace osu.Game.Rulesets.Catch.Judgements return 30; } } - - protected override double HealthIncreaseFor(HitResult result) - { - switch (result) - { - default: - return base.HealthIncreaseFor(result); - - case HitResult.Perfect: - return 0.007; - } - } } } diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs index 8fd9ac92ba..2149ed9712 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs @@ -23,18 +23,6 @@ namespace osu.Game.Rulesets.Catch.Judgements } } - protected override double HealthIncreaseFor(HitResult result) - { - switch (result) - { - default: - return -0.02; - - case HitResult.Perfect: - return 0.01; - } - } - /// /// Whether fruit on the platter should explode or drop. /// Note that this is only checked if the owning object is also diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchTinyDropletJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchTinyDropletJudgement.cs index 3829b5e94f..d607b49ea4 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchTinyDropletJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchTinyDropletJudgement.cs @@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Catch.Judgements return 0; case HitResult.Perfect: - return 0.004; + return 0.02; } } } From dfa6575f75d375d7f4cb09c9206308263fe19d13 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 7 Jan 2020 15:24:33 +0900 Subject: [PATCH 34/38] Adjust mania HP increase values --- .../Judgements/HoldNoteTickJudgement.cs | 6 ++--- .../Judgements/ManiaJudgement.cs | 27 ------------------- 2 files changed, 3 insertions(+), 30 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs b/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs index b9c6e3a7f7..00b839f8ec 100644 --- a/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs +++ b/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs @@ -15,11 +15,11 @@ namespace osu.Game.Rulesets.Mania.Judgements { switch (result) { - case HitResult.Miss: + default: return 0; - default: - return 0.040; + case HitResult.Perfect: + return 0.01; } } } diff --git a/osu.Game.Rulesets.Mania/Judgements/ManiaJudgement.cs b/osu.Game.Rulesets.Mania/Judgements/ManiaJudgement.cs index 0e4c811945..c2f8fb8678 100644 --- a/osu.Game.Rulesets.Mania/Judgements/ManiaJudgement.cs +++ b/osu.Game.Rulesets.Mania/Judgements/ManiaJudgement.cs @@ -29,32 +29,5 @@ namespace osu.Game.Rulesets.Mania.Judgements return 300; } } - - protected override double HealthIncreaseFor(HitResult result) - { - switch (result) - { - case HitResult.Miss: - return -0.125; - - case HitResult.Meh: - return 0.005; - - case HitResult.Ok: - return 0.010; - - case HitResult.Good: - return 0.035; - - case HitResult.Great: - return 0.055; - - case HitResult.Perfect: - return 0.065; - - default: - return 0; - } - } } } From e33de0c2e423e2ae7a44c19797c40096f7ec6c7f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Jan 2020 15:14:09 +0800 Subject: [PATCH 35/38] Fix ScrollContainer crashes --- osu.Game/Graphics/Containers/OsuScrollContainer.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Graphics/Containers/OsuScrollContainer.cs b/osu.Game/Graphics/Containers/OsuScrollContainer.cs index ab72276ad0..cfd459da5e 100644 --- a/osu.Game/Graphics/Containers/OsuScrollContainer.cs +++ b/osu.Game/Graphics/Containers/OsuScrollContainer.cs @@ -123,8 +123,6 @@ namespace osu.Game.Graphics.Containers Masking = true; Child = box = new Box { RelativeSizeAxes = Axes.Both }; - - ResizeTo(1); } [BackgroundDependencyLoader] From 7f92cefe1023fbfd2ff98045a70186d70e10e760 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Tue, 7 Jan 2020 19:06:47 +0100 Subject: [PATCH 36/38] 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 37/38] 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 38/38] 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)