From 15f73a3dfb3dcc838809dd48813c40cfd8d6a784 Mon Sep 17 00:00:00 2001 From: Michael Bui Date: Fri, 6 Sep 2024 21:52:42 +1200 Subject: [PATCH 01/31] show participation count in tooltip --- .../Header/Components/DailyChallengeStatsTooltip.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsTooltip.cs b/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsTooltip.cs index 64a8d67c5b..5d89406c34 100644 --- a/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsTooltip.cs +++ b/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsTooltip.cs @@ -26,6 +26,7 @@ namespace osu.Game.Overlays.Profile.Header.Components { private StreakPiece currentDaily = null!; private StreakPiece currentWeekly = null!; + private StreakPiece totalParticipation = null!; private StatisticsPiece bestDaily = null!; private StatisticsPiece bestWeekly = null!; private StatisticsPiece topTen = null!; @@ -70,7 +71,7 @@ namespace osu.Game.Overlays.Profile.Header.Components { topBackground = new Box { - RelativeSizeAxes = Axes.Both, + RelativeSizeAxes = Axes.None, }, new FillFlowContainer { @@ -78,8 +79,9 @@ namespace osu.Game.Overlays.Profile.Header.Components Direction = FillDirection.Horizontal, Padding = new MarginPadding(15f), Spacing = new Vector2(30f), - Children = new[] + Children = new Drawable[] { + totalParticipation = new StreakPiece(UsersStrings.ShowDailyChallengePlaycount), currentDaily = new StreakPiece(UsersStrings.ShowDailyChallengeDailyStreakCurrent), currentWeekly = new StreakPiece(UsersStrings.ShowDailyChallengeWeeklyStreakCurrent), } @@ -113,6 +115,9 @@ namespace osu.Game.Overlays.Profile.Header.Components background.Colour = colourProvider.Background4; topBackground.Colour = colourProvider.Background5; + totalParticipation.Value = DailyChallengeStatsDisplayStrings.UnitDay(statistics.PlayCount.ToLocalisableString(@"N0")); + totalParticipation.ValueColour = colourProvider.Content2; + currentDaily.Value = DailyChallengeStatsDisplayStrings.UnitDay(content.Statistics.DailyStreakCurrent.ToLocalisableString(@"N0")); currentDaily.ValueColour = colours.ForRankingTier(TierForDaily(statistics.DailyStreakCurrent)); From f59895aa3444eca3a167d2c3b315bb054626d091 Mon Sep 17 00:00:00 2001 From: Michael Bui Date: Fri, 6 Sep 2024 21:54:41 +1200 Subject: [PATCH 02/31] take out drawable --- .../Profile/Header/Components/DailyChallengeStatsTooltip.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsTooltip.cs b/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsTooltip.cs index 5d89406c34..df52fea158 100644 --- a/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsTooltip.cs +++ b/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsTooltip.cs @@ -79,7 +79,7 @@ namespace osu.Game.Overlays.Profile.Header.Components Direction = FillDirection.Horizontal, Padding = new MarginPadding(15f), Spacing = new Vector2(30f), - Children = new Drawable[] + Children = new[] { totalParticipation = new StreakPiece(UsersStrings.ShowDailyChallengePlaycount), currentDaily = new StreakPiece(UsersStrings.ShowDailyChallengeDailyStreakCurrent), From 34a9d60c190c2caf0a20c35508f8e592af6c414f Mon Sep 17 00:00:00 2001 From: Michael Bui Date: Fri, 6 Sep 2024 22:02:35 +1200 Subject: [PATCH 03/31] revert back to axes.both --- .../Profile/Header/Components/DailyChallengeStatsTooltip.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsTooltip.cs b/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsTooltip.cs index df52fea158..93ec3b941a 100644 --- a/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsTooltip.cs +++ b/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsTooltip.cs @@ -71,7 +71,7 @@ namespace osu.Game.Overlays.Profile.Header.Components { topBackground = new Box { - RelativeSizeAxes = Axes.None, + RelativeSizeAxes = Axes.Both, }, new FillFlowContainer { From ab8771900a44a2a3f01fd5494091866f3ebe7443 Mon Sep 17 00:00:00 2001 From: Michael Bui Date: Fri, 6 Sep 2024 22:04:10 +1200 Subject: [PATCH 04/31] change colour --- .../Profile/Header/Components/DailyChallengeStatsTooltip.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsTooltip.cs b/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsTooltip.cs index 93ec3b941a..bc389c5569 100644 --- a/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsTooltip.cs +++ b/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsTooltip.cs @@ -116,7 +116,7 @@ namespace osu.Game.Overlays.Profile.Header.Components topBackground.Colour = colourProvider.Background5; totalParticipation.Value = DailyChallengeStatsDisplayStrings.UnitDay(statistics.PlayCount.ToLocalisableString(@"N0")); - totalParticipation.ValueColour = colourProvider.Content2; + totalParticipation.ValueColour = colours.ForRankingTier(TierForDaily(statistics.PlayCount)); currentDaily.Value = DailyChallengeStatsDisplayStrings.UnitDay(content.Statistics.DailyStreakCurrent.ToLocalisableString(@"N0")); currentDaily.ValueColour = colours.ForRankingTier(TierForDaily(statistics.DailyStreakCurrent)); From 362b4bbc566ee0a32391d81f4936ef16a9b8744f Mon Sep 17 00:00:00 2001 From: Michael Bui Date: Fri, 6 Sep 2024 23:01:05 +1200 Subject: [PATCH 05/31] Hide daily challenge stats if there are no plays --- .../Profile/Header/Components/DailyChallengeStatsDisplay.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsDisplay.cs b/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsDisplay.cs index 41fd2be591..80487b19c6 100644 --- a/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsDisplay.cs +++ b/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsDisplay.cs @@ -107,6 +107,12 @@ namespace osu.Game.Overlays.Profile.Header.Components APIUserDailyChallengeStatistics stats = User.Value.User.DailyChallengeStatistics; + if (stats.PlayCount == 0) + { + Hide(); + return; + } + dailyPlayCount.Text = DailyChallengeStatsDisplayStrings.UnitDay(stats.PlayCount.ToLocalisableString("N0")); dailyPlayCount.Colour = colours.ForRankingTier(TierForPlayCount(stats.PlayCount)); From a31ea24c6d2ebe7937e2148f6ba754cace417e9d Mon Sep 17 00:00:00 2001 From: Michael Bui Date: Fri, 6 Sep 2024 23:05:04 +1200 Subject: [PATCH 06/31] show stats on all rulesets --- .../Profile/Header/Components/DailyChallengeStatsDisplay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsDisplay.cs b/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsDisplay.cs index 80487b19c6..cdc460e1a8 100644 --- a/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsDisplay.cs +++ b/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsDisplay.cs @@ -99,7 +99,7 @@ namespace osu.Game.Overlays.Profile.Header.Components private void updateDisplay() { - if (User.Value == null || User.Value.Ruleset.OnlineID != 0) + if (User.Value == null) { Hide(); return; From 7e53df5226667d6b7c1ba13bc9898a066e722ddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 Sep 2024 13:01:50 +0200 Subject: [PATCH 07/31] Add failing test coverage --- .../TestScenePlayerScoreSubmission.cs | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerScoreSubmission.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerScoreSubmission.cs index 5e22e47572..c382f0828b 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerScoreSubmission.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerScoreSubmission.cs @@ -8,7 +8,9 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using NUnit.Framework; +using osu.Framework.Graphics.Containers; using osu.Framework.Screens; +using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Online.API; using osu.Game.Online.Rooms; @@ -26,6 +28,7 @@ using osu.Game.Scoring; using osu.Game.Screens.Play; using osu.Game.Screens.Ranking; using osu.Game.Tests.Beatmaps; +using osuTK.Input; namespace osu.Game.Tests.Visual.Gameplay { @@ -177,6 +180,30 @@ namespace osu.Game.Tests.Visual.Gameplay AddAssert("ensure no submission", () => Player.SubmittedScore == null); } + [Test] + public void TestEmptyFailStillImports() + { + prepareTestAPI(true); + + createPlayerTest(true); + + AddUntilStep("wait for token request", () => Player.TokenCreationRequested); + + AddUntilStep("wait for fail", () => Player.GameplayState.HasFailed); + AddUntilStep("wait for fail overlay", () => Player.FailOverlay.State.Value, () => Is.EqualTo(Visibility.Visible)); + + AddStep("attempt import", () => + { + InputManager.MoveMouseTo(Player.ChildrenOfType().Single()); + InputManager.Click(MouseButton.Left); + }); + AddUntilStep("wait for import to start", () => Player.ScoreImportStarted); + AddStep("allow import", () => Player.AllowImportCompletion.Release()); + + AddUntilStep("import completed", () => Player.ImportedScore, () => Is.Not.Null); + AddAssert("ensure no submission", () => Player.SubmittedScore, () => Is.Null); + } + [Test] public void TestSubmissionOnFail() { @@ -378,6 +405,8 @@ namespace osu.Game.Tests.Visual.Gameplay public SemaphoreSlim AllowImportCompletion { get; } public Score ImportedScore { get; private set; } + public new FailOverlay FailOverlay => base.FailOverlay; + public FakeImportingPlayer(bool allowPause = true, bool showResults = true, bool pauseOnFocusLost = false) : base(allowPause, showResults, pauseOnFocusLost) { From 4e9ad1388fb0de72c6197faa9ad6d56fb1a87087 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 Sep 2024 13:16:27 +0200 Subject: [PATCH 08/31] Fix stall when attempting to import replay after hitting nothing --- osu.Game/Screens/Play/SubmittingPlayer.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Play/SubmittingPlayer.cs b/osu.Game/Screens/Play/SubmittingPlayer.cs index 6c5f7fab9e..aea3bf6d5c 100644 --- a/osu.Game/Screens/Play/SubmittingPlayer.cs +++ b/osu.Game/Screens/Play/SubmittingPlayer.cs @@ -274,6 +274,16 @@ namespace osu.Game.Screens.Play return Task.CompletedTask; } + // if the user never hit anything, this score should not be counted in any way. + if (!score.ScoreInfo.Statistics.Any(s => s.Key.IsHit() && s.Value > 0)) + { + Logger.Log("No hits registered, skipping score submission"); + return Task.CompletedTask; + } + + // mind the timing of this. + // once `scoreSubmissionSource` is created, it is presumed that submission is taking place in the background, + // so all exceptional circumstances that would disallow submission must be handled above. lock (scoreSubmissionLock) { if (scoreSubmissionSource != null) @@ -282,10 +292,6 @@ namespace osu.Game.Screens.Play scoreSubmissionSource = new TaskCompletionSource(); } - // if the user never hit anything, this score should not be counted in any way. - if (!score.ScoreInfo.Statistics.Any(s => s.Key.IsHit() && s.Value > 0)) - return Task.CompletedTask; - Logger.Log($"Beginning score submission (token:{token.Value})..."); var request = CreateSubmissionRequest(score, token.Value); From 575da0992fa2f07792368b294cb1430684ea2a44 Mon Sep 17 00:00:00 2001 From: smallketchup82 Date: Fri, 6 Sep 2024 16:16:40 -0400 Subject: [PATCH 09/31] Fix file associations not updating & uninstalling --- osu.Desktop/Program.cs | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 5103663815..5100eef3d9 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -168,12 +168,30 @@ namespace osu.Desktop private static void setupVelopack() { - VelopackApp - .Build() - .WithFirstRun(v => + var app = VelopackApp.Build(); + + app.WithFirstRun(_ => + { + if (OperatingSystem.IsWindows()) + WindowsAssociationManager.InstallAssociations(); + }); + + if (OperatingSystem.IsWindows()) + { + app.WithAfterUpdateFastCallback(_ => { - if (OperatingSystem.IsWindows()) WindowsAssociationManager.InstallAssociations(); - }).Run(); + if (OperatingSystem.IsWindows()) + WindowsAssociationManager.UpdateAssociations(); + }); + + app.WithBeforeUninstallFastCallback(_ => + { + if (OperatingSystem.IsWindows()) + WindowsAssociationManager.UninstallAssociations(); + }); + } + + app.Run(); } } } From ed044d5b85d80b1cdf03555e0be1530ffd166626 Mon Sep 17 00:00:00 2001 From: schiavoanto Date: Fri, 6 Sep 2024 22:58:18 +0200 Subject: [PATCH 10/31] Fix proposal for #29736 --- osu.Game/Screens/Ranking/CollectionPopover.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Ranking/CollectionPopover.cs b/osu.Game/Screens/Ranking/CollectionPopover.cs index 6617ac334f..ffc448d7a9 100644 --- a/osu.Game/Screens/Ranking/CollectionPopover.cs +++ b/osu.Game/Screens/Ranking/CollectionPopover.cs @@ -39,6 +39,7 @@ namespace osu.Game.Screens.Ranking new OsuMenu(Direction.Vertical, true) { Items = items, + MaxHeight = 375, }, }; } From 581f190856274ad1c521fb8ae32a503ebeed78ef Mon Sep 17 00:00:00 2001 From: Ianlucht Date: Fri, 6 Sep 2024 16:31:48 -0600 Subject: [PATCH 11/31] fixed issues with search by adding the double quotation marks in the BeatmapSetHeaderContents links. --- osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs b/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs index 168056ea58..d9747d1f44 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs @@ -242,7 +242,7 @@ namespace osu.Game.Overlays.BeatmapSet title.Clear(); artist.Clear(); - title.AddLink(titleText, LinkAction.SearchBeatmapSet, titleText); + title.AddLink(titleText, LinkAction.SearchBeatmapSet, "title=\"\"" + titleText + "\"\""); title.AddArbitraryDrawable(Empty().With(d => d.Width = 5)); title.AddArbitraryDrawable(externalLink = new ExternalLinkButton()); @@ -259,7 +259,7 @@ namespace osu.Game.Overlays.BeatmapSet title.AddArbitraryDrawable(new SpotlightBeatmapBadge()); } - artist.AddLink(artistText, LinkAction.SearchBeatmapSet, artistText); + artist.AddLink(artistText, LinkAction.SearchBeatmapSet, "artist=\"\"" + artistText + "\"\""); if (setInfo.NewValue.TrackId != null) { From 3b81ad4cbffe88ff0ca16a0f26e74fc3c30b7c5b Mon Sep 17 00:00:00 2001 From: Bruno Heredia <111712756+Bruno5430@users.noreply.github.com> Date: Sat, 7 Sep 2024 01:42:47 -0300 Subject: [PATCH 12/31] Fix scroll speed slider defaulting to 0.01 --- osu.Game/Screens/Edit/Timing/EffectSection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Timing/EffectSection.cs b/osu.Game/Screens/Edit/Timing/EffectSection.cs index a4b9f37dff..f9ef460232 100644 --- a/osu.Game/Screens/Edit/Timing/EffectSection.cs +++ b/osu.Game/Screens/Edit/Timing/EffectSection.cs @@ -56,7 +56,7 @@ namespace osu.Game.Screens.Edit.Timing isRebinding = true; kiai.Current = newEffectPoint.KiaiModeBindable; - scrollSpeedSlider.Current = new BindableDouble + scrollSpeedSlider.Current = new BindableDouble(1) { MinValue = 0.01, MaxValue = 10, From 41d32ab2ca0a79772e1ba8a3e21ba14fe863f30a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 7 Sep 2024 13:54:12 +0900 Subject: [PATCH 13/31] Fix display length not resetting to default because default was wrong Closes https://github.com/ppy/osu/issues/29757. --- osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs b/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs index 8a8b78b645..580c7e6bd8 100644 --- a/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs +++ b/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs @@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Osu.Configuration SetDefault(OsuRulesetSetting.ReplayFrameMarkersEnabled, false); SetDefault(OsuRulesetSetting.ReplayCursorPathEnabled, false); SetDefault(OsuRulesetSetting.ReplayCursorHideEnabled, false); - SetDefault(OsuRulesetSetting.ReplayAnalysisDisplayLength, 750); + SetDefault(OsuRulesetSetting.ReplayAnalysisDisplayLength, 800); } } From 9b189fd244f10613f616b077d1f83b6e1396cf85 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 7 Sep 2024 13:58:17 +0900 Subject: [PATCH 14/31] Fix windows check weirdness --- osu.Desktop/Program.cs | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 5100eef3d9..e78c2ca636 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -3,6 +3,7 @@ using System; using System.IO; +using System.Runtime.Versioning; using osu.Desktop.LegacyIpc; using osu.Desktop.Windows; using osu.Framework; @@ -170,28 +171,18 @@ namespace osu.Desktop { var app = VelopackApp.Build(); - app.WithFirstRun(_ => - { - if (OperatingSystem.IsWindows()) - WindowsAssociationManager.InstallAssociations(); - }); - if (OperatingSystem.IsWindows()) - { - app.WithAfterUpdateFastCallback(_ => - { - if (OperatingSystem.IsWindows()) - WindowsAssociationManager.UpdateAssociations(); - }); - - app.WithBeforeUninstallFastCallback(_ => - { - if (OperatingSystem.IsWindows()) - WindowsAssociationManager.UninstallAssociations(); - }); - } + configureWindows(app); app.Run(); } + + [SupportedOSPlatform("windows")] + private static void configureWindows(VelopackApp app) + { + app.WithFirstRun(_ => WindowsAssociationManager.InstallAssociations()); + app.WithAfterUpdateFastCallback(_ => WindowsAssociationManager.UpdateAssociations()); + app.WithBeforeUninstallFastCallback(_ => WindowsAssociationManager.UninstallAssociations()); + } } } From ac6cce5911d78a4321b679c1d93213954865a5a3 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Sat, 7 Sep 2024 17:40:33 +0900 Subject: [PATCH 15/31] Refactor to string interpolation --- osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs b/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs index d9747d1f44..f9e0c6c380 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs @@ -242,7 +242,7 @@ namespace osu.Game.Overlays.BeatmapSet title.Clear(); artist.Clear(); - title.AddLink(titleText, LinkAction.SearchBeatmapSet, "title=\"\"" + titleText + "\"\""); + title.AddLink(titleText, LinkAction.SearchBeatmapSet, $@"title=""""{titleText}"""""); title.AddArbitraryDrawable(Empty().With(d => d.Width = 5)); title.AddArbitraryDrawable(externalLink = new ExternalLinkButton()); @@ -259,7 +259,7 @@ namespace osu.Game.Overlays.BeatmapSet title.AddArbitraryDrawable(new SpotlightBeatmapBadge()); } - artist.AddLink(artistText, LinkAction.SearchBeatmapSet, "artist=\"\"" + artistText + "\"\""); + artist.AddLink(artistText, LinkAction.SearchBeatmapSet, $@"artist=""""{artistText}"""""); if (setInfo.NewValue.TrackId != null) { From 10ef5a6d6dec110525cf59f7c9e14a0d11709c37 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 7 Sep 2024 21:46:43 +0900 Subject: [PATCH 16/31] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 5f3dd2f6f4..7b45b9dec4 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -10,7 +10,7 @@ true - + diff --git a/osu.iOS.props b/osu.iOS.props index 9d9b42a163..1d76deddac 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -17,6 +17,6 @@ -all - + From 3e3ee3757c7688046b77fe4ee947d8ebf7e68dbe Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 7 Sep 2024 22:13:54 +0900 Subject: [PATCH 17/31] Add failing test case for difficulty splitting --- .../Visual/SongSelect/TestSceneBeatmapCarousel.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs index ec072a3dd2..fbed577ed2 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs @@ -520,6 +520,18 @@ namespace osu.Game.Tests.Visual.SongSelect waitForSelection(set_count); } + [Solo] + [Test] + public void TestDifficultiesSplitOutOnLoad() + { + loadBeatmaps(new List { TestResources.CreateTestBeatmapSetInfo(diff_count) }, () => new FilterCriteria + { + Sort = SortMode.Difficulty, + }); + + checkVisibleItemCount(false, 3); + } + [Test] public void TestAddRemoveDifficultySort() { From 4c6eb895309c33653bf0e2798ec41920e3567c7e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 7 Sep 2024 22:05:33 +0900 Subject: [PATCH 18/31] Fix beatmap difficulties not being split out on first load Closes https://github.com/ppy/osu/issues/29728. --- osu.Game/Screens/Select/BeatmapCarousel.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index a6a6a2f585..2486b26f25 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -137,6 +137,8 @@ namespace osu.Game.Screens.Select private void loadNewRoot() { + beatmapsSplitOut = activeCriteria.SplitOutDifficulties; + // Ensure no changes are made to the list while we are initialising items. // We'll catch up on changes via subscriptions anyway. BeatmapSetInfo[] loadableSets = detachedBeatmapSets!.ToArray(); @@ -726,7 +728,6 @@ namespace osu.Game.Screens.Select if (activeCriteria.SplitOutDifficulties != beatmapsSplitOut) { - beatmapsSplitOut = activeCriteria.SplitOutDifficulties; loadNewRoot(); return; } From 32de8e9b2da88e2edbcb06ae8434c15a342dc3fe Mon Sep 17 00:00:00 2001 From: schiavoanto Date: Sat, 7 Sep 2024 16:15:00 +0200 Subject: [PATCH 19/31] Fixed ControlPointTable items being blocked by buttons --- osu.Game/Screens/Edit/Timing/ControlPointTable.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Edit/Timing/ControlPointTable.cs b/osu.Game/Screens/Edit/Timing/ControlPointTable.cs index 501d8c0e41..c0b9ccb2be 100644 --- a/osu.Game/Screens/Edit/Timing/ControlPointTable.cs +++ b/osu.Game/Screens/Edit/Timing/ControlPointTable.cs @@ -53,6 +53,7 @@ namespace osu.Game.Screens.Edit.Timing private void load(OverlayColourProvider colours) { RelativeSizeAxes = Axes.Both; + Padding = new() { Bottom = 50 }; InternalChildren = new Drawable[] { From 2bc6547d49e3578c8bbb5590dafcaf93781eccf5 Mon Sep 17 00:00:00 2001 From: schiavoanto Date: Sat, 7 Sep 2024 16:23:23 +0200 Subject: [PATCH 20/31] Code quality fix: added type --- osu.Game/Screens/Edit/Timing/ControlPointTable.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Timing/ControlPointTable.cs b/osu.Game/Screens/Edit/Timing/ControlPointTable.cs index c0b9ccb2be..dd0cf2116e 100644 --- a/osu.Game/Screens/Edit/Timing/ControlPointTable.cs +++ b/osu.Game/Screens/Edit/Timing/ControlPointTable.cs @@ -53,7 +53,7 @@ namespace osu.Game.Screens.Edit.Timing private void load(OverlayColourProvider colours) { RelativeSizeAxes = Axes.Both; - Padding = new() { Bottom = 50 }; + Padding = new MarginPadding { Bottom = 50 }; InternalChildren = new Drawable[] { From 958bfde51d49f526d928a5976a6c0c4f21250bbb Mon Sep 17 00:00:00 2001 From: Ianlucht <90893791+Ianlucht@users.noreply.github.com> Date: Sat, 7 Sep 2024 13:46:42 -0600 Subject: [PATCH 21/31] added DailyChallengeIntro to notification --- .../DailyChallenge/NewDailyChallengeNotification.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/DailyChallenge/NewDailyChallengeNotification.cs b/osu.Game/Screens/OnlinePlay/DailyChallenge/NewDailyChallengeNotification.cs index ea19828a21..e305de0aaf 100644 --- a/osu.Game/Screens/OnlinePlay/DailyChallenge/NewDailyChallengeNotification.cs +++ b/osu.Game/Screens/OnlinePlay/DailyChallenge/NewDailyChallengeNotification.cs @@ -5,12 +5,14 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Screens; using osu.Game.Beatmaps.Drawables.Cards; +using osu.Game.Configuration; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Rooms; using osu.Game.Overlays.Notifications; using osu.Game.Screens.Menu; using osu.Game.Localisation; + namespace osu.Game.Screens.OnlinePlay.DailyChallenge { public partial class NewDailyChallengeNotification : SimpleNotification @@ -24,14 +26,18 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge this.room = room; } + [BackgroundDependencyLoader] - private void load(OsuGame? game) + private void load(OsuGame? game, SessionStatics statics) { Text = DailyChallengeStrings.ChallengeLiveNotification; Content.Add(card = new BeatmapCardNano((APIBeatmapSet)room.Playlist.Single().Beatmap.BeatmapSet!)); Activated = () => { - game?.PerformFromScreen(s => s.Push(new DailyChallenge(room)), [typeof(MainMenu)]); + if(statics.Get(Static.DailyChallengeIntroPlayed)) + game?.PerformFromScreen(s => s.Push(new DailyChallenge(room)), [typeof(MainMenu)]); + else + game?.PerformFromScreen(s => s.Push(new DailyChallengeIntro(room)), [typeof(MainMenu)]); return true; }; } From 170737b68f76d9269a81b7c91125c7518933f0b2 Mon Sep 17 00:00:00 2001 From: Ianlucht <90893791+Ianlucht@users.noreply.github.com> Date: Sat, 7 Sep 2024 13:48:14 -0600 Subject: [PATCH 22/31] added DailyChallengeIntro to notification --- .../OnlinePlay/DailyChallenge/NewDailyChallengeNotification.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/OnlinePlay/DailyChallenge/NewDailyChallengeNotification.cs b/osu.Game/Screens/OnlinePlay/DailyChallenge/NewDailyChallengeNotification.cs index e305de0aaf..8e4337274f 100644 --- a/osu.Game/Screens/OnlinePlay/DailyChallenge/NewDailyChallengeNotification.cs +++ b/osu.Game/Screens/OnlinePlay/DailyChallenge/NewDailyChallengeNotification.cs @@ -12,7 +12,6 @@ using osu.Game.Overlays.Notifications; using osu.Game.Screens.Menu; using osu.Game.Localisation; - namespace osu.Game.Screens.OnlinePlay.DailyChallenge { public partial class NewDailyChallengeNotification : SimpleNotification @@ -38,6 +37,7 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge game?.PerformFromScreen(s => s.Push(new DailyChallenge(room)), [typeof(MainMenu)]); else game?.PerformFromScreen(s => s.Push(new DailyChallengeIntro(room)), [typeof(MainMenu)]); + return true; }; } From e6f81abc3bcaaa82540931d30ed42485165231e8 Mon Sep 17 00:00:00 2001 From: Ianlucht <90893791+Ianlucht@users.noreply.github.com> Date: Sat, 7 Sep 2024 13:57:12 -0600 Subject: [PATCH 23/31] cleaned up whitespace --- .../OnlinePlay/DailyChallenge/NewDailyChallengeNotification.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/OnlinePlay/DailyChallenge/NewDailyChallengeNotification.cs b/osu.Game/Screens/OnlinePlay/DailyChallenge/NewDailyChallengeNotification.cs index 8e4337274f..35191f4ffa 100644 --- a/osu.Game/Screens/OnlinePlay/DailyChallenge/NewDailyChallengeNotification.cs +++ b/osu.Game/Screens/OnlinePlay/DailyChallenge/NewDailyChallengeNotification.cs @@ -25,7 +25,6 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge this.room = room; } - [BackgroundDependencyLoader] private void load(OsuGame? game, SessionStatics statics) { From cd94d6e2bcad42b630930621fa95bb3c54761e40 Mon Sep 17 00:00:00 2001 From: Ianlucht <90893791+Ianlucht@users.noreply.github.com> Date: Sat, 7 Sep 2024 14:01:38 -0600 Subject: [PATCH 24/31] fixed if statement format --- .../OnlinePlay/DailyChallenge/NewDailyChallengeNotification.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/OnlinePlay/DailyChallenge/NewDailyChallengeNotification.cs b/osu.Game/Screens/OnlinePlay/DailyChallenge/NewDailyChallengeNotification.cs index 35191f4ffa..7ae6992bec 100644 --- a/osu.Game/Screens/OnlinePlay/DailyChallenge/NewDailyChallengeNotification.cs +++ b/osu.Game/Screens/OnlinePlay/DailyChallenge/NewDailyChallengeNotification.cs @@ -32,7 +32,7 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge Content.Add(card = new BeatmapCardNano((APIBeatmapSet)room.Playlist.Single().Beatmap.BeatmapSet!)); Activated = () => { - if(statics.Get(Static.DailyChallengeIntroPlayed)) + if (statics.Get(Static.DailyChallengeIntroPlayed)) game?.PerformFromScreen(s => s.Push(new DailyChallenge(room)), [typeof(MainMenu)]); else game?.PerformFromScreen(s => s.Push(new DailyChallengeIntro(room)), [typeof(MainMenu)]); From 7f814d3106b67158c16a336de7e01910dee4ba7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 8 Sep 2024 14:16:37 +0200 Subject: [PATCH 25/31] Fix incorrect tiers being used for tooltip total participation display Compare: https://github.com/ppy/osu-web/pull/11457/commits/95e4561a54353016f25c3fc859b176038b82088a --- .../Online/TestSceneUserProfileDailyChallenge.cs | 4 ++-- .../Header/Components/DailyChallengeStatsDisplay.cs | 9 +-------- .../Header/Components/DailyChallengeStatsTooltip.cs | 11 +++++++++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileDailyChallenge.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileDailyChallenge.cs index d7f5f65769..9db30380f6 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileDailyChallenge.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileDailyChallenge.cs @@ -66,8 +66,8 @@ namespace osu.Game.Tests.Visual.Online [Test] public void TestPlayCountRankingTier() { - AddAssert("1 before silver", () => DailyChallengeStatsDisplay.TierForPlayCount(30) == RankingTier.Bronze); - AddAssert("first silver", () => DailyChallengeStatsDisplay.TierForPlayCount(31) == RankingTier.Silver); + AddAssert("1 before silver", () => DailyChallengeStatsTooltip.TierForPlayCount(30) == RankingTier.Bronze); + AddAssert("first silver", () => DailyChallengeStatsTooltip.TierForPlayCount(31) == RankingTier.Silver); } } } diff --git a/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsDisplay.cs b/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsDisplay.cs index cdc460e1a8..3e86b2268f 100644 --- a/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsDisplay.cs +++ b/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsDisplay.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 osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.LocalisationExtensions; @@ -14,7 +13,6 @@ using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Localisation; using osu.Game.Online.API.Requests.Responses; -using osu.Game.Scoring; namespace osu.Game.Overlays.Profile.Header.Components { @@ -114,18 +112,13 @@ namespace osu.Game.Overlays.Profile.Header.Components } dailyPlayCount.Text = DailyChallengeStatsDisplayStrings.UnitDay(stats.PlayCount.ToLocalisableString("N0")); - dailyPlayCount.Colour = colours.ForRankingTier(TierForPlayCount(stats.PlayCount)); + dailyPlayCount.Colour = colours.ForRankingTier(DailyChallengeStatsTooltip.TierForPlayCount(stats.PlayCount)); TooltipContent = new DailyChallengeTooltipData(colourProvider, stats); Show(); } - // Rounding up is needed here to ensure the overlay shows the same colour as osu-web for the play count. - // This is because, for example, 31 / 3 > 10 in JavaScript because floats are used, while here it would - // get truncated to 10 with an integer division and show a lower tier. - public static RankingTier TierForPlayCount(int playCount) => DailyChallengeStatsTooltip.TierForDaily((int)Math.Ceiling(playCount / 3.0d)); - public ITooltip GetCustomTooltip() => new DailyChallengeStatsTooltip(); } } diff --git a/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsTooltip.cs b/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsTooltip.cs index bc389c5569..24e531bd87 100644 --- a/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsTooltip.cs +++ b/osu.Game/Overlays/Profile/Header/Components/DailyChallengeStatsTooltip.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.Extensions.Color4Extensions; using osu.Framework.Extensions.LocalisationExtensions; @@ -116,7 +117,7 @@ namespace osu.Game.Overlays.Profile.Header.Components topBackground.Colour = colourProvider.Background5; totalParticipation.Value = DailyChallengeStatsDisplayStrings.UnitDay(statistics.PlayCount.ToLocalisableString(@"N0")); - totalParticipation.ValueColour = colours.ForRankingTier(TierForDaily(statistics.PlayCount)); + totalParticipation.ValueColour = colours.ForRankingTier(TierForPlayCount(statistics.PlayCount)); currentDaily.Value = DailyChallengeStatsDisplayStrings.UnitDay(content.Statistics.DailyStreakCurrent.ToLocalisableString(@"N0")); currentDaily.ValueColour = colours.ForRankingTier(TierForDaily(statistics.DailyStreakCurrent)); @@ -137,7 +138,13 @@ namespace osu.Game.Overlays.Profile.Header.Components topFifty.ValueColour = colourProvider.Content2; } - // reference: https://github.com/ppy/osu-web/blob/8206e0e91eeea80ccf92f0586561346dd40e085e/resources/js/profile-page/daily-challenge.tsx#L13-L43 + // reference: https://github.com/ppy/osu-web/blob/adf1e94754ba9625b85eba795f4a310caf169eec/resources/js/profile-page/daily-challenge.tsx#L13-L47 + + // Rounding up is needed here to ensure the overlay shows the same colour as osu-web for the play count. + // This is because, for example, 31 / 3 > 10 in JavaScript because floats are used, while here it would + // get truncated to 10 with an integer division and show a lower tier. + public static RankingTier TierForPlayCount(int playCount) => TierForDaily((int)Math.Ceiling(playCount / 3.0d)); + public static RankingTier TierForDaily(int daily) { if (daily > 360) From cf23c6668c3281e5644721665e68ec1265e26868 Mon Sep 17 00:00:00 2001 From: schiavoanto Date: Sun, 8 Sep 2024 15:59:23 +0200 Subject: [PATCH 26/31] Added background color to hide beatmap background --- .../Screens/Edit/Timing/ControlPointList.cs | 88 +++++++++++-------- 1 file changed, 52 insertions(+), 36 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/ControlPointList.cs b/osu.Game/Screens/Edit/Timing/ControlPointList.cs index 8699c388b3..6a21ff0053 100644 --- a/osu.Game/Screens/Edit/Timing/ControlPointList.cs +++ b/osu.Game/Screens/Edit/Timing/ControlPointList.cs @@ -7,11 +7,13 @@ 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.Input.Events; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterfaceV2; +using osu.Game.Overlays; using osuTK; namespace osu.Game.Screens.Edit.Timing @@ -30,6 +32,9 @@ namespace osu.Game.Screens.Edit.Timing [Resolved] private Bindable selectedGroup { get; set; } = null!; + [Cached] + private OverlayColourProvider overlayColourProvider = new OverlayColourProvider(OverlayColourScheme.Green); + [BackgroundDependencyLoader] private void load(OsuColour colours) { @@ -43,51 +48,62 @@ namespace osu.Game.Screens.Edit.Timing RelativeSizeAxes = Axes.Both, Groups = { BindTarget = Beatmap.ControlPointInfo.Groups, }, }, - new FillFlowContainer + new Container { - AutoSizeAxes = Axes.Both, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Direction = FillDirection.Horizontal, - Margin = new MarginPadding(margins), - Spacing = new Vector2(5), + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, Children = new Drawable[] { - new RoundedButton + new Box { - Text = "Select closest to current time", - Action = goToCurrentGroup, - Size = new Vector2(220, 30), - Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight, + Height = 50, + RelativeSizeAxes = Axes.X, + Anchor = Anchor.CentreLeft, + Colour = overlayColourProvider.Background2, }, - } - }, - new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight, - Direction = FillDirection.Horizontal, - Margin = new MarginPadding(margins), - Spacing = new Vector2(5), - Children = new Drawable[] - { - deleteButton = new RoundedButton + new FillFlowContainer { - Text = "-", - Size = new Vector2(30, 30), - Action = delete, - Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight, - BackgroundColour = colours.Red3, + Anchor = Anchor.BottomLeft, + Padding = new MarginPadding { Left = margins, Bottom = margins }, + Children = new Drawable[] + { + new RoundedButton + { + Text = "Select closest to current time", + Action = goToCurrentGroup, + Size = new Vector2(220, 30), + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + }, + } }, - addButton = new RoundedButton + new FillFlowContainer { - Action = addNew, - Size = new Vector2(160, 30), + Direction = FillDirection.Horizontal, Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight, + Spacing = new Vector2(5), + Padding = new MarginPadding { Right = margins, Bottom = margins }, + Children = new Drawable[] + { + deleteButton = new RoundedButton + { + Text = "-", + Size = new Vector2(30, 30), + Action = delete, + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + BackgroundColour = colours.Red3, + }, + addButton = new RoundedButton + { + Action = addNew, + Size = new Vector2(160, 30), + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + }, + } }, } }, From 2e6f17f25399684681c22f5701717037808c97aa Mon Sep 17 00:00:00 2001 From: schiavoanto Date: Sun, 8 Sep 2024 16:04:10 +0200 Subject: [PATCH 27/31] Fixed wrong OverlayColourScheme --- osu.Game/Screens/Edit/Timing/ControlPointList.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Timing/ControlPointList.cs b/osu.Game/Screens/Edit/Timing/ControlPointList.cs index 6a21ff0053..03ad1a631a 100644 --- a/osu.Game/Screens/Edit/Timing/ControlPointList.cs +++ b/osu.Game/Screens/Edit/Timing/ControlPointList.cs @@ -33,7 +33,7 @@ namespace osu.Game.Screens.Edit.Timing private Bindable selectedGroup { get; set; } = null!; [Cached] - private OverlayColourProvider overlayColourProvider = new OverlayColourProvider(OverlayColourScheme.Green); + private OverlayColourProvider overlayColourProvider = new OverlayColourProvider(OverlayColourScheme.Aquamarine); [BackgroundDependencyLoader] private void load(OsuColour colours) From 134bcc85b76748fc5e5b4678f53498a853bd7a67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 8 Sep 2024 14:53:43 +0200 Subject: [PATCH 28/31] Add failing test case --- .../SongSelect/TestSceneBeatmapCarousel.cs | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs index fbed577ed2..97c46a11fc 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs @@ -520,7 +520,6 @@ namespace osu.Game.Tests.Visual.SongSelect waitForSelection(set_count); } - [Solo] [Test] public void TestDifficultiesSplitOutOnLoad() { @@ -1132,6 +1131,32 @@ namespace osu.Game.Tests.Visual.SongSelect AddAssert("Selection was remembered", () => eagerSelectedIDs.Count == 1); } + [Test] + public void TestCarouselRetainsSelectionFromDifficultySort() + { + List manySets = new List(); + + AddStep("Populate beatmap sets", () => + { + manySets.Clear(); + + for (int i = 1; i <= 50; i++) + manySets.Add(TestResources.CreateTestBeatmapSetInfo(diff_count)); + }); + + loadBeatmaps(manySets); + + BeatmapInfo chosenBeatmap = null!; + AddStep("select given beatmap", () => carousel.SelectBeatmap(chosenBeatmap = manySets[20].Beatmaps[0])); + AddUntilStep("selection changed", () => carousel.SelectedBeatmapInfo, () => Is.EqualTo(chosenBeatmap)); + + AddStep("sort by difficulty", () => carousel.FilterImmediately(new FilterCriteria { Sort = SortMode.Difficulty })); + AddAssert("selection retained", () => carousel.SelectedBeatmapInfo, () => Is.EqualTo(chosenBeatmap)); + + AddStep("sort by title", () => carousel.FilterImmediately(new FilterCriteria { Sort = SortMode.Title })); + AddAssert("selection retained", () => carousel.SelectedBeatmapInfo, () => Is.EqualTo(chosenBeatmap)); + } + [Test] public void TestFilteringByUserStarDifficulty() { From cefbc76490d5b17f5607fd579b86f3c0b89104fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 8 Sep 2024 15:51:59 +0200 Subject: [PATCH 29/31] Fix selection being dropped when changing carousel sort mode from difficulty sort Closes https://github.com/ppy/osu/issues/29738. This "regressed" in https://github.com/ppy/osu/pull/29639, but if I didn't know better, I'd go as far as saying that this looks like a .NET bug, because the fact that PR broke it looks not sane. The TL;DR on this is that before the pull in question, the offending `.Contains()` check that this commit modifies was called on a `List`. The pull changed the collection type to `BeatmapSetInfo[]`. That said, the call is a LINQ call, so all good, right? Not really. First off, the default overload resolution order means that the previous code would call `List.Contains()`, and not `Enumerable.Contains()`. Then again, why would that matter? In both cases `T` is still `BeatmapSetInfo`, right? Well... about that... It is difficult to tell for sure what precisely is happening here, because of what looks like runtime magic. The end *symptom* is that the old code ended up calling `Array.IndexOf()`, and the new code ends up calling... `Array.IndexOf()`. So while yes, `BeatmapSetInfo` implements `IEquatable` and the expectation would be that `Equals()` should be getting called, the type elision to `object` means that we're back to reference equality semantics, because that's what `EqualityComparer.Default` is. A five-minute github search across dotnet/runtime yields this: https://github.com/dotnet/runtime/blob/c4792a228ea36792b90f87ddf7fce2477e827822/src/coreclr/vm/array.cpp#L984-L990 Now again, if I didn't know better, I'd see that "OPTIMIZATION:" comment, see what transpired in this scenario, and call that optimisation invalid, because it changes semantics. But I *probably* know that the dotnet team knows better and am probably just going to take it for what it is, because blame on that code looks to be years old and it's probably not a new behaviour. (I haven't tested empirically if it is.) Instead the fix is just to tell the `.Contains()` method to use the correct comparer. --- 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 2486b26f25..525884c413 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -143,7 +143,7 @@ namespace osu.Game.Screens.Select // We'll catch up on changes via subscriptions anyway. BeatmapSetInfo[] loadableSets = detachedBeatmapSets!.ToArray(); - if (selectedBeatmapSet != null && !loadableSets.Contains(selectedBeatmapSet.BeatmapSet)) + if (selectedBeatmapSet != null && !loadableSets.Contains(selectedBeatmapSet.BeatmapSet, EqualityComparer.Default)) selectedBeatmapSet = null; var selectedBeatmapBefore = selectedBeatmap?.BeatmapInfo; From f5c5614eef02feb0c816f31ce1d4e9dae163ecdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 8 Sep 2024 16:29:53 +0200 Subject: [PATCH 30/31] Resolve existing colour provider instead of re-caching own one --- osu.Game/Screens/Edit/Timing/ControlPointList.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/ControlPointList.cs b/osu.Game/Screens/Edit/Timing/ControlPointList.cs index 03ad1a631a..4cc356012f 100644 --- a/osu.Game/Screens/Edit/Timing/ControlPointList.cs +++ b/osu.Game/Screens/Edit/Timing/ControlPointList.cs @@ -32,11 +32,8 @@ namespace osu.Game.Screens.Edit.Timing [Resolved] private Bindable selectedGroup { get; set; } = null!; - [Cached] - private OverlayColourProvider overlayColourProvider = new OverlayColourProvider(OverlayColourScheme.Aquamarine); - [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OsuColour colours, OverlayColourProvider colourProvider) { RelativeSizeAxes = Axes.Both; From 7ec2e0e86696eb63b6b1e4995af2263d91d214f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 8 Sep 2024 16:30:09 +0200 Subject: [PATCH 31/31] Refactor layout code to be a bit less haphazard Visually the same, functionally much saner. --- .../Screens/Edit/Timing/ControlPointList.cs | 38 +++++++++++-------- .../Screens/Edit/Timing/ControlPointTable.cs | 7 +++- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/ControlPointList.cs b/osu.Game/Screens/Edit/Timing/ControlPointList.cs index 4cc356012f..49e5b76dd6 100644 --- a/osu.Game/Screens/Edit/Timing/ControlPointList.cs +++ b/osu.Game/Screens/Edit/Timing/ControlPointList.cs @@ -20,6 +20,8 @@ namespace osu.Game.Screens.Edit.Timing { public partial class ControlPointList : CompositeDrawable { + private ControlPointTable table = null!; + private Container controls = null!; private OsuButton deleteButton = null!; private RoundedButton addButton = null!; @@ -40,12 +42,12 @@ namespace osu.Game.Screens.Edit.Timing const float margins = 10; InternalChildren = new Drawable[] { - new ControlPointTable + table = new ControlPointTable { RelativeSizeAxes = Axes.Both, Groups = { BindTarget = Beatmap.ControlPointInfo.Groups, }, }, - new Container + controls = new Container { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, @@ -55,15 +57,16 @@ namespace osu.Game.Screens.Edit.Timing { new Box { - Height = 50, - RelativeSizeAxes = Axes.X, - Anchor = Anchor.CentreLeft, - Colour = overlayColourProvider.Background2, + RelativeSizeAxes = Axes.Both, + Colour = colourProvider.Background2, }, new FillFlowContainer { - Anchor = Anchor.BottomLeft, - Padding = new MarginPadding { Left = margins, Bottom = margins }, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Padding = new MarginPadding { Left = margins, Vertical = margins, }, Children = new Drawable[] { new RoundedButton @@ -71,17 +74,19 @@ namespace osu.Game.Screens.Edit.Timing Text = "Select closest to current time", Action = goToCurrentGroup, Size = new Vector2(220, 30), - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, }, } }, new FillFlowContainer { + AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, - Anchor = Anchor.BottomRight, + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, Spacing = new Vector2(5), - Padding = new MarginPadding { Right = margins, Bottom = margins }, + Padding = new MarginPadding { Right = margins, Vertical = margins, }, Children = new Drawable[] { deleteButton = new RoundedButton @@ -89,16 +94,16 @@ namespace osu.Game.Screens.Edit.Timing Text = "-", Size = new Vector2(30, 30), Action = delete, - Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight, + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, BackgroundColour = colours.Red3, }, addButton = new RoundedButton { Action = addNew, Size = new Vector2(160, 30), - Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight, + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, }, } }, @@ -132,6 +137,7 @@ namespace osu.Game.Screens.Edit.Timing base.Update(); addButton.Enabled.Value = clock.CurrentTimeAccurate != selectedGroup.Value?.Time; + table.Padding = new MarginPadding { Bottom = controls.DrawHeight }; } private void goToCurrentGroup() diff --git a/osu.Game/Screens/Edit/Timing/ControlPointTable.cs b/osu.Game/Screens/Edit/Timing/ControlPointTable.cs index dd0cf2116e..fd812cfe2b 100644 --- a/osu.Game/Screens/Edit/Timing/ControlPointTable.cs +++ b/osu.Game/Screens/Edit/Timing/ControlPointTable.cs @@ -28,6 +28,12 @@ namespace osu.Game.Screens.Edit.Timing { public BindableList Groups { get; } = new BindableList(); + public new MarginPadding Padding + { + get => base.Padding; + set => base.Padding = value; + } + [Cached] private Bindable activeTimingPoint { get; } = new Bindable(); @@ -53,7 +59,6 @@ namespace osu.Game.Screens.Edit.Timing private void load(OverlayColourProvider colours) { RelativeSizeAxes = Axes.Both; - Padding = new MarginPadding { Bottom = 50 }; InternalChildren = new Drawable[] {