From 33905f2e7022f91c7c6d7da6bd69df596c941ac1 Mon Sep 17 00:00:00 2001 From: Tom Martin Date: Wed, 11 Jun 2025 04:34:13 +0100 Subject: [PATCH] Address review comments --- .../Visual/Ranking/TestSceneStatisticsPanel.cs | 2 ++ .../Visual/Ranking/TestSceneUserTagControl.cs | 3 ++- .../Screens/Ranking/Statistics/StatisticsPanel.cs | 6 ++++-- osu.Game/Screens/Ranking/UserTagControl.cs | 11 +++++------ 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/osu.Game.Tests/Visual/Ranking/TestSceneStatisticsPanel.cs b/osu.Game.Tests/Visual/Ranking/TestSceneStatisticsPanel.cs index f92dc0313e..b682ec7265 100644 --- a/osu.Game.Tests/Visual/Ranking/TestSceneStatisticsPanel.cs +++ b/osu.Game.Tests/Visual/Ranking/TestSceneStatisticsPanel.cs @@ -256,6 +256,7 @@ namespace osu.Game.Tests.Visual.Ranking var score = TestResources.CreateTestScoreInfo(); score.Rank = ScoreRank.D; + setUpTaggingRequests(() => score.BeatmapInfo); AddStep("load panel", () => { Child = new PopoverContainer @@ -278,6 +279,7 @@ namespace osu.Game.Tests.Visual.Ranking var score = TestResources.CreateTestScoreInfo(); score.Ruleset = new ManiaRuleset().RulesetInfo; + setUpTaggingRequests(() => score.BeatmapInfo); AddStep("load panel", () => { Child = new PopoverContainer diff --git a/osu.Game.Tests/Visual/Ranking/TestSceneUserTagControl.cs b/osu.Game.Tests/Visual/Ranking/TestSceneUserTagControl.cs index fb6be1daed..a3ffe0dba2 100644 --- a/osu.Game.Tests/Visual/Ranking/TestSceneUserTagControl.cs +++ b/osu.Game.Tests/Visual/Ranking/TestSceneUserTagControl.cs @@ -100,8 +100,9 @@ namespace osu.Game.Tests.Visual.Ranking Child = new PopoverContainer { RelativeSizeAxes = Axes.Both, - Child = new UserTagControl(Beatmap.Value.BeatmapInfo, true) + Child = new UserTagControl(Beatmap.Value.BeatmapInfo) { + Writable = true, Width = 700, Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game/Screens/Ranking/Statistics/StatisticsPanel.cs b/osu.Game/Screens/Ranking/Statistics/StatisticsPanel.cs index 169a8b4f12..3c1aec745d 100644 --- a/osu.Game/Screens/Ranking/Statistics/StatisticsPanel.cs +++ b/osu.Game/Screens/Ranking/Statistics/StatisticsPanel.cs @@ -265,8 +265,9 @@ namespace osu.Game.Screens.Ranking.Statistics if (preventTaggingReason == null) { - yield return new StatisticItem("Tag the beatmap!", () => new UserTagControl(newScore.BeatmapInfo, true) + yield return new StatisticItem("Tag the beatmap!", () => new UserTagControl(newScore.BeatmapInfo) { + Writable = true, RelativeSizeAxes = Axes.X, Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -287,8 +288,9 @@ namespace osu.Game.Screens.Ranking.Statistics Anchor = Anchor.Centre, Origin = Anchor.Centre, }, - new UserTagControl(newScore.BeatmapInfo, false) + new UserTagControl(newScore.BeatmapInfo) { + Writable = false, RelativeSizeAxes = Axes.X, Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game/Screens/Ranking/UserTagControl.cs b/osu.Game/Screens/Ranking/UserTagControl.cs index b61ed4dcda..a66721782e 100644 --- a/osu.Game/Screens/Ranking/UserTagControl.cs +++ b/osu.Game/Screens/Ranking/UserTagControl.cs @@ -47,15 +47,14 @@ namespace osu.Game.Screens.Ranking /// /// Determines whether the user can modify the contained tags /// - private readonly bool writable; + public bool Writable { get; init; } [Resolved] private IAPIProvider api { get; set; } = null!; - public UserTagControl(BeatmapInfo beatmapInfo, bool writable) + public UserTagControl(BeatmapInfo beatmapInfo) { this.beatmapInfo = beatmapInfo; - this.writable = writable; } [BackgroundDependencyLoader] @@ -94,7 +93,7 @@ namespace osu.Game.Screens.Ranking AutoSizeAxes = Axes.Y, Direction = FillDirection.Full, Spacing = new Vector2(4), - Children = writable + Children = Writable ? [ addNewTagUserTag = new AddNewTagUserTag @@ -202,7 +201,7 @@ namespace osu.Game.Screens.Ranking case NotifyCollectionChangedAction.Reset: { tagFlow.Clear(); - if (writable) tagFlow.Add(addNewTagUserTag!); + if (Writable) tagFlow.Add(addNewTagUserTag!); break; } } @@ -210,7 +209,7 @@ namespace osu.Game.Screens.Ranking private void toggleVote(UserTag tag) { - if (!writable) + if (!Writable) return; if (tag.Updating.Value)