From f64fa65fd5c2297f9f0d0355c189feaffb3ec3bb Mon Sep 17 00:00:00 2001 From: Jason Won Date: Tue, 26 Oct 2021 14:52:15 -0400 Subject: [PATCH 01/11] right click on unselected object shows context menu --- .../Editing/TestSceneComposerSelection.cs | 24 +++++++++++++++++++ .../Compose/Components/BlueprintContainer.cs | 12 +++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneComposerSelection.cs b/osu.Game.Tests/Visual/Editing/TestSceneComposerSelection.cs index a2a7b72283..36663591f2 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneComposerSelection.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneComposerSelection.cs @@ -42,6 +42,30 @@ namespace osu.Game.Tests.Visual.Editing }); } + [Test] + public void TestSelectAndShowContextMenu() + { + var addedObject = new HitCircle { StartTime = 100, Position = new Vector2(100, 100) }; + AddStep("add hitobject", () => EditorBeatmap.Add(addedObject)); + + moveMouseToObject(() => addedObject); + AddStep("right click", () => InputManager.Click(MouseButton.Right)); + + AddAssert("hitobject selected", () => EditorBeatmap.SelectedHitObjects.Single() == addedObject); + + AddStep("delete from context menu", () => + { + var pos = blueprintContainer.SelectionBlueprints + .First(s => s.Item == addedObject) + .ChildrenOfType() + .First(); + + InputManager.MoveMouseTo(pos, new Vector2(50, 120)); + InputManager.Click(MouseButton.Left); + }); + AddAssert("no hitobjects in beatmap", () => EditorBeatmap.HitObjects.Count == 0); + } + [Test] public void TestNudgeSelection() { diff --git a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs index 75d4d13f94..0de99831f2 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs @@ -108,11 +108,17 @@ namespace osu.Game.Screens.Edit.Compose.Components protected override bool OnMouseDown(MouseDownEvent e) { bool selectionPerformed = performMouseDownActions(e); - - // even if a selection didn't occur, a drag event may still move the selection. bool movementPossible = prepareSelectionMovement(); - return selectionPerformed || (e.Button == MouseButton.Left && movementPossible); + // check if selection has occurred + if (selectionPerformed) + { + // propagate right click to show context menu on selection + return e.Button != MouseButton.Right; + } + + // even if a selection didn't occur, a drag event may still move the selection. + return e.Button == MouseButton.Left && movementPossible; } protected SelectionBlueprint ClickedBlueprint { get; private set; } From 4efa1f23bb7c0ce836d0d59b8748cc4b8583d962 Mon Sep 17 00:00:00 2001 From: Jason Won Date: Tue, 26 Oct 2021 15:29:50 -0400 Subject: [PATCH 02/11] fix context menu test --- .../Editing/TestSceneComposerSelection.cs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneComposerSelection.cs b/osu.Game.Tests/Visual/Editing/TestSceneComposerSelection.cs index 36663591f2..9aae595808 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneComposerSelection.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneComposerSelection.cs @@ -5,7 +5,10 @@ using System; using System.Linq; using NUnit.Framework; using osu.Framework.Testing; +using osu.Framework.Graphics.Cursor; +using osu.Framework.Graphics.UserInterface; using osu.Game.Beatmaps; +using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu; @@ -29,6 +32,9 @@ namespace osu.Game.Tests.Visual.Editing private ComposeBlueprintContainer blueprintContainer => Editor.ChildrenOfType().First(); + private ContextMenuContainer contextMenuContainer + => Editor.ChildrenOfType().First(); + private void moveMouseToObject(Func targetFunc) { AddStep("move mouse to object", () => @@ -52,18 +58,7 @@ namespace osu.Game.Tests.Visual.Editing AddStep("right click", () => InputManager.Click(MouseButton.Right)); AddAssert("hitobject selected", () => EditorBeatmap.SelectedHitObjects.Single() == addedObject); - - AddStep("delete from context menu", () => - { - var pos = blueprintContainer.SelectionBlueprints - .First(s => s.Item == addedObject) - .ChildrenOfType() - .First(); - - InputManager.MoveMouseTo(pos, new Vector2(50, 120)); - InputManager.Click(MouseButton.Left); - }); - AddAssert("no hitobjects in beatmap", () => EditorBeatmap.HitObjects.Count == 0); + AddAssert("context menu is visible", () => contextMenuContainer.ChildrenOfType().Single().State == MenuState.Open); } [Test] From c633e2e9521b9c9ae86defae674a0d65b16efabd Mon Sep 17 00:00:00 2001 From: Jason Won Date: Tue, 26 Oct 2021 16:24:53 -0400 Subject: [PATCH 03/11] only propagate unmodified right click --- .../Visual/Editing/TestSceneComposerSelection.cs | 4 ++-- .../Screens/Edit/Compose/Components/BlueprintContainer.cs | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneComposerSelection.cs b/osu.Game.Tests/Visual/Editing/TestSceneComposerSelection.cs index 9aae595808..dddd9f07ab 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneComposerSelection.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneComposerSelection.cs @@ -57,8 +57,8 @@ namespace osu.Game.Tests.Visual.Editing moveMouseToObject(() => addedObject); AddStep("right click", () => InputManager.Click(MouseButton.Right)); - AddAssert("hitobject selected", () => EditorBeatmap.SelectedHitObjects.Single() == addedObject); - AddAssert("context menu is visible", () => contextMenuContainer.ChildrenOfType().Single().State == MenuState.Open); + AddUntilStep("hitobject selected", () => EditorBeatmap.SelectedHitObjects.Single() == addedObject); + AddUntilStep("context menu is visible", () => contextMenuContainer.ChildrenOfType().Single().State == MenuState.Open); } [Test] diff --git a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs index 0de99831f2..7391c1a642 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs @@ -113,8 +113,11 @@ namespace osu.Game.Screens.Edit.Compose.Components // check if selection has occurred if (selectionPerformed) { - // propagate right click to show context menu on selection - return e.Button != MouseButton.Right; + // only unmodified right click should show context menu + var shouldShowContextMenu = e.Button == MouseButton.Right && !e.ShiftPressed && !e.AltPressed && !e.SuperPressed; + + // stop propagation if not showing context menu + return !shouldShowContextMenu; } // even if a selection didn't occur, a drag event may still move the selection. From 09701d0af12f8ae0f05fdf7fc6e947216ed40388 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 4 Nov 2021 16:02:37 +0900 Subject: [PATCH 04/11] Use explicit primitive type specification --- osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs index 42792bdf5b..29e3f12d03 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs @@ -114,7 +114,7 @@ namespace osu.Game.Screens.Edit.Compose.Components if (selectionPerformed) { // only unmodified right click should show context menu - var shouldShowContextMenu = e.Button == MouseButton.Right && !e.ShiftPressed && !e.AltPressed && !e.SuperPressed; + bool shouldShowContextMenu = e.Button == MouseButton.Right && !e.ShiftPressed && !e.AltPressed && !e.SuperPressed; // stop propagation if not showing context menu return !shouldShowContextMenu; From 0c14d8af23cd4f0b89846da362dea637ce3d8b0e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 4 Nov 2021 16:03:15 +0900 Subject: [PATCH 05/11] Upgrade to nvika 1.0.4 --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 1b06aa4d17..d64ad6ad21 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -15,7 +15,7 @@ ] }, "smoogipoo.nvika": { - "version": "1.0.3", + "version": "1.0.4", "commands": [ "nvika" ] From 317506d4d7a472bedba1586bb2ebbad7e089d7f6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 4 Nov 2021 16:11:23 +0900 Subject: [PATCH 06/11] Fix a few more "maybe null" inspections --- .../Online/TestAPIModJsonSerialization.cs | 15 +++++++++------ osu.Game/Screens/Select/BeatmapDeleteDialog.cs | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Online/TestAPIModJsonSerialization.cs b/osu.Game.Tests/Online/TestAPIModJsonSerialization.cs index c8848ab7d8..656e333073 100644 --- a/osu.Game.Tests/Online/TestAPIModJsonSerialization.cs +++ b/osu.Game.Tests/Online/TestAPIModJsonSerialization.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using Newtonsoft.Json; using NUnit.Framework; @@ -67,9 +68,11 @@ namespace osu.Game.Tests.Online var deserialised = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(apiMod)); var converted = (TestModTimeRamp)deserialised?.ToMod(new TestRuleset()); - Assert.That(converted?.AdjustPitch.Value, Is.EqualTo(false)); - Assert.That(converted?.InitialRate.Value, Is.EqualTo(1.25)); - Assert.That(converted?.FinalRate.Value, Is.EqualTo(0.25)); + Assert.That(converted, Is.Not.Null); + + Assert.That(converted.AdjustPitch.Value, Is.EqualTo(false)); + Assert.That(converted.InitialRate.Value, Is.EqualTo(1.25)); + Assert.That(converted.FinalRate.Value, Is.EqualTo(0.25)); } [Test] @@ -121,11 +124,11 @@ namespace osu.Game.Tests.Online new TestModDifficultyAdjust() }; - public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList mods = null) => throw new System.NotImplementedException(); + public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList mods = null) => throw new NotImplementedException(); - public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => throw new System.NotImplementedException(); + public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => throw new NotImplementedException(); - public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => throw new System.NotImplementedException(); + public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => throw new NotImplementedException(); public override string Description { get; } = string.Empty; public override string ShortName { get; } = string.Empty; diff --git a/osu.Game/Screens/Select/BeatmapDeleteDialog.cs b/osu.Game/Screens/Select/BeatmapDeleteDialog.cs index 5fb72e4151..307c2352e3 100644 --- a/osu.Game/Screens/Select/BeatmapDeleteDialog.cs +++ b/osu.Game/Screens/Select/BeatmapDeleteDialog.cs @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Select new PopupDialogOkButton { Text = @"Yes. Totally. Delete it.", - Action = () => manager.Delete(beatmap), + Action = () => manager?.Delete(beatmap), }, new PopupDialogCancelButton { From 5a078da4d9f16c510382d1134fb5a982700f5529 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 4 Nov 2021 16:44:05 +0900 Subject: [PATCH 07/11] Fix `APIBeatmapSet.Beatmaps` being `IEnumerable`, causing stupid issues --- osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCard.cs | 4 ++-- .../Beatmaps/TestSceneDifficultySpectrumDisplay.cs | 2 +- .../Visual/Online/TestSceneBeatmapRulesetSelector.cs | 10 +++------- .../Visual/Online/TestSceneBeatmapSetOverlay.cs | 6 +++--- .../Visual/Online/TestSceneBeatmapSetOverlayDetails.cs | 3 +-- osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs | 4 ++-- .../Online/API/Requests/Responses/APIBeatmapSet.cs | 2 +- .../Overlays/BeatmapListing/Panels/BeatmapPanel.cs | 2 +- .../Tests/Visual/Multiplayer/TestMultiplayerClient.cs | 2 +- 9 files changed, 15 insertions(+), 20 deletions(-) diff --git a/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCard.cs b/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCard.cs index d1b21547dc..2aeb4ab4e2 100644 --- a/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCard.cs +++ b/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCard.cs @@ -91,7 +91,7 @@ namespace osu.Game.Tests.Visual.Beatmaps HasVideo = true, HasStoryboard = true, Covers = new BeatmapSetOnlineCovers(), - Beatmaps = new List + Beatmaps = new[] { new APIBeatmap { @@ -128,7 +128,7 @@ namespace osu.Game.Tests.Visual.Beatmaps HasVideo = true, HasStoryboard = true, Covers = new BeatmapSetOnlineCovers(), - Beatmaps = beatmaps, + Beatmaps = beatmaps.ToArray(), }; } diff --git a/osu.Game.Tests/Visual/Beatmaps/TestSceneDifficultySpectrumDisplay.cs b/osu.Game.Tests/Visual/Beatmaps/TestSceneDifficultySpectrumDisplay.cs index 1f38b05879..4063fa1252 100644 --- a/osu.Game.Tests/Visual/Beatmaps/TestSceneDifficultySpectrumDisplay.cs +++ b/osu.Game.Tests/Visual/Beatmaps/TestSceneDifficultySpectrumDisplay.cs @@ -21,7 +21,7 @@ namespace osu.Game.Tests.Visual.Beatmaps { RulesetID = difficulty.rulesetId, StarRating = difficulty.stars - }).ToList() + }).ToArray() }; [Test] diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapRulesetSelector.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapRulesetSelector.cs index b880633559..90f3eb64e4 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapRulesetSelector.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapRulesetSelector.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.Collections.Generic; using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; @@ -37,7 +36,7 @@ namespace osu.Game.Tests.Visual.Online { selector.BeatmapSet = new APIBeatmapSet { - Beatmaps = enabledRulesets.Select(r => new APIBeatmap { RulesetID = r.OnlineID }).ToList() + Beatmaps = enabledRulesets.Select(r => new APIBeatmap { RulesetID = r.OnlineID }).ToArray() }; }); @@ -55,7 +54,7 @@ namespace osu.Game.Tests.Visual.Online { selector.BeatmapSet = new APIBeatmapSet { - Beatmaps = new List + Beatmaps = new[] { new APIBeatmap { @@ -71,10 +70,7 @@ namespace osu.Game.Tests.Visual.Online [Test] public void TestEmptyBeatmapSet() { - AddStep("load empty beatmapset", () => selector.BeatmapSet = new APIBeatmapSet - { - Beatmaps = new List() - }); + AddStep("load empty beatmapset", () => selector.BeatmapSet = new APIBeatmapSet()); AddAssert("no ruleset selected", () => selector.SelectedTab == null); AddAssert("all rulesets disabled", () => selector.TabContainer.TabItems.All(t => !t.Enabled.Value)); diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs index bae9af1897..63ce057667 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs @@ -71,7 +71,7 @@ namespace osu.Game.Tests.Visual.Online Ratings = Enumerable.Range(0, 11).ToArray(), HasStoryboard = true, Covers = new BeatmapSetOnlineCovers(), - Beatmaps = new List + Beatmaps = new[] { new APIBeatmap { @@ -145,7 +145,7 @@ namespace osu.Game.Tests.Visual.Online var set = getBeatmapSet(); - set.Beatmaps = beatmaps; + set.Beatmaps = beatmaps.ToArray(); overlay.ShowBeatmapSet(set); }); @@ -211,7 +211,7 @@ namespace osu.Game.Tests.Visual.Online }); } - set.Beatmaps = beatmaps; + set.Beatmaps = beatmaps.ToArray(); return set; } diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlayDetails.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlayDetails.cs index 491a2d5d90..9c0c67b1d8 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlayDetails.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlayDetails.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.Collections.Generic; using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; @@ -46,7 +45,7 @@ namespace osu.Game.Tests.Visual.Online static APIBeatmapSet createSet() => new APIBeatmapSet { - Beatmaps = new List + Beatmaps = new[] { new APIBeatmap { diff --git a/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs b/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs index 9a3d998966..a3c8935fa8 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs @@ -90,7 +90,7 @@ namespace osu.Game.Tests.Visual.Online HasVideo = true, HasStoryboard = true, Covers = new BeatmapSetOnlineCovers(), - Beatmaps = new List + Beatmaps = new[] { new APIBeatmap { @@ -129,7 +129,7 @@ namespace osu.Game.Tests.Visual.Online HasVideo = true, HasStoryboard = true, Covers = new BeatmapSetOnlineCovers(), - Beatmaps = beatmaps, + Beatmaps = beatmaps.ToArray(), }; } } diff --git a/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs b/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs index d8efa20b39..22cf6d25cd 100644 --- a/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs +++ b/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs @@ -119,7 +119,7 @@ namespace osu.Game.Online.API.Requests.Responses public string Tags { get; set; } = string.Empty; [JsonProperty(@"beatmaps")] - public IEnumerable Beatmaps { get; set; } = Array.Empty(); + public APIBeatmap[] Beatmaps { get; set; } = Array.Empty(); public virtual BeatmapSetInfo ToBeatmapSet(RulesetStore rulesets) { diff --git a/osu.Game/Overlays/BeatmapListing/Panels/BeatmapPanel.cs b/osu.Game/Overlays/BeatmapListing/Panels/BeatmapPanel.cs index 2fd05f6742..34086c214f 100644 --- a/osu.Game/Overlays/BeatmapListing/Panels/BeatmapPanel.cs +++ b/osu.Game/Overlays/BeatmapListing/Panels/BeatmapPanel.cs @@ -147,7 +147,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels { var icons = new List(); - if (SetInfo.Beatmaps.Count() > maximum_difficulty_icons) + if (SetInfo.Beatmaps.Length > maximum_difficulty_icons) { foreach (var ruleset in SetInfo.Beatmaps.Select(b => b.Ruleset).Distinct()) icons.Add(new GroupedDifficultyIcon(SetInfo.Beatmaps.Where(b => b.RulesetID == ruleset.OnlineID).ToList(), ruleset, this is ListBeatmapPanel ? Color4.White : colours.Gray5)); diff --git a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs index c690a621eb..70d907ba15 100644 --- a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs +++ b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs @@ -280,7 +280,7 @@ namespace osu.Game.Tests.Visual.Multiplayer var apiSet = new APIBeatmapSet { OnlineID = set.OnlineID, - Beatmaps = set.Beatmaps.Select(b => new APIBeatmap { OnlineID = b.OnlineID }) + Beatmaps = set.Beatmaps.Select(b => new APIBeatmap { OnlineID = b.OnlineID }).ToArray(), }; return Task.FromResult(apiSet); From b80c02b757346a99012949d9d227fb876c8f3bcd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 4 Nov 2021 17:24:40 +0900 Subject: [PATCH 08/11] Fix crash on gameplay startup if beatmap has no background --- osu.Game/Storyboards/Storyboard.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Storyboards/Storyboard.cs b/osu.Game/Storyboards/Storyboard.cs index 99123627bd..9e3d3df915 100644 --- a/osu.Game/Storyboards/Storyboard.cs +++ b/osu.Game/Storyboards/Storyboard.cs @@ -77,10 +77,14 @@ namespace osu.Game.Storyboards { get { - string backgroundPath = BeatmapInfo.BeatmapSet?.Metadata?.BackgroundFile.ToLowerInvariant(); + string backgroundPath = BeatmapInfo.BeatmapSet?.Metadata?.BackgroundFile; + if (string.IsNullOrEmpty(backgroundPath)) return false; + // Importantly, do this after the NullOrEmpty because EF may have stored the non-nullable value as null to the database, bypassing compile-time constraints. + backgroundPath = backgroundPath.ToLowerInvariant(); + return GetLayer("Background").Elements.Any(e => e.Path.ToLowerInvariant() == backgroundPath); } } @@ -93,7 +97,7 @@ namespace osu.Game.Storyboards Drawable drawable = null; string storyboardPath = BeatmapInfo.BeatmapSet?.Files.Find(f => f.Filename.Equals(path, StringComparison.OrdinalIgnoreCase))?.FileInfo.StoragePath; - if (storyboardPath != null) + if (!string.IsNullOrEmpty(storyboardPath)) drawable = new Sprite { Texture = textureStore.Get(storyboardPath) }; // if the texture isn't available locally in the beatmap, some storyboards choose to source from the underlying skin lookup hierarchy. else if (UseSkinSprites) From df3c3a32ceb9e03082c03b74f48ba488091bda2c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 4 Nov 2021 15:35:32 +0900 Subject: [PATCH 09/11] Fix unintentionally broken background update logic --- .../OnlinePlay/Components/OnlinePlayBackgroundScreen.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/OnlinePlay/Components/OnlinePlayBackgroundScreen.cs b/osu.Game/Screens/OnlinePlay/Components/OnlinePlayBackgroundScreen.cs index 279a8e1a14..ffc5c07d4e 100644 --- a/osu.Game/Screens/OnlinePlay/Components/OnlinePlayBackgroundScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Components/OnlinePlayBackgroundScreen.cs @@ -60,8 +60,10 @@ namespace osu.Game.Screens.OnlinePlay.Components { Schedule(() => { + var beatmap = playlistItem?.Beatmap.Value; + string? lastCover = (background?.Beatmap?.BeatmapSet as IBeatmapSetOnlineInfo)?.Covers.Cover; - string? newCover = (background?.Beatmap?.BeatmapSet as IBeatmapSetOnlineInfo)?.Covers.Cover; + string? newCover = (beatmap?.BeatmapSet as IBeatmapSetOnlineInfo)?.Covers.Cover; if (lastCover == newCover) return; From 28e9b9a25f2dbbb871d2e174371850aebad2a810 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 4 Nov 2021 19:01:39 +0900 Subject: [PATCH 10/11] 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 4887e3a95f..6d2e8428a7 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 972d64a997..6dda1f77c6 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index f6e4f61fde..df24a57e90 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -70,7 +70,7 @@ - + @@ -93,7 +93,7 @@ - + From 30635fb4769dc70eaf27181450b5703cbf0a339e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 4 Nov 2021 19:19:00 +0900 Subject: [PATCH 11/11] Use official nvika package again --- .config/dotnet-tools.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index d64ad6ad21..6444127594 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -14,8 +14,8 @@ "jb" ] }, - "smoogipoo.nvika": { - "version": "1.0.4", + "nvika": { + "version": "2.2.0", "commands": [ "nvika" ]