From af6ae1cce560faa31fd4033c4678054050e99a7c Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 5 Nov 2021 03:49:11 +0300 Subject: [PATCH 01/13] Remove hacky code with explicit pragma disable --- osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs | 5 ++--- osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs b/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs index 97105b6b6a..8d83fe7452 100644 --- a/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs +++ b/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs @@ -79,8 +79,10 @@ namespace osu.Game.Tests.NonVisual public List HitObjects; public override IEnumerable Objects => HitObjects; +#pragma warning disable 67 public override event Action NewResult; public override event Action RevertResult; +#pragma warning restore 67 public override Playfield Playfield { get; } public override Container Overlays { get; } @@ -95,9 +97,6 @@ namespace osu.Game.Tests.NonVisual public TestDrawableRuleset() : base(new OsuRuleset()) { - // won't compile without this. - NewResult?.Invoke(null); - RevertResult?.Invoke(null); } public override void SetReplayScore(Score replayScore) => throw new NotImplementedException(); diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs index 1ba0965ceb..aa29f1386c 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs @@ -235,8 +235,10 @@ namespace osu.Game.Tests.Visual.Gameplay public override IEnumerable Objects => new[] { new HitCircle { HitWindows = HitWindows } }; +#pragma warning disable 67 public override event Action NewResult; public override event Action RevertResult; +#pragma warning restore 67 public override Playfield Playfield { get; } public override Container Overlays { get; } @@ -251,9 +253,6 @@ namespace osu.Game.Tests.Visual.Gameplay public TestDrawableRuleset() : base(new OsuRuleset()) { - // won't compile without this. - NewResult?.Invoke(null); - RevertResult?.Invoke(null); } public override void SetReplayScore(Score replayScore) => throw new NotImplementedException(); From 6197ef426dd1a70e1240e7a9ea0eb83b837f61df Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 5 Nov 2021 03:50:17 +0300 Subject: [PATCH 02/13] Disable another "code heurstically unreachable" with comment --- osu.Game.Tests/Mods/ModDifficultyAdjustTest.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Tests/Mods/ModDifficultyAdjustTest.cs b/osu.Game.Tests/Mods/ModDifficultyAdjustTest.cs index 84cf796835..fd620a0e95 100644 --- a/osu.Game.Tests/Mods/ModDifficultyAdjustTest.cs +++ b/osu.Game.Tests/Mods/ModDifficultyAdjustTest.cs @@ -105,6 +105,9 @@ namespace osu.Game.Tests.Mods testMod.ResetSettingsToDefaults(); Assert.That(testMod.DrainRate.Value, Is.Null); + + // ReSharper disable once HeuristicUnreachableCode + // see https://youtrack.jetbrains.com/issue/RIDER-70159. Assert.That(testMod.OverallDifficulty.Value, Is.Null); var applied = applyDifficulty(new BeatmapDifficulty From 36d99a2e34297f1a2c7f0dacb2704ab8e61a463f Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 5 Nov 2021 03:51:08 +0300 Subject: [PATCH 03/13] Move action to private named method to avoid null inspection --- osu.Game/Overlays/OverlayScrollContainer.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/OverlayScrollContainer.cs b/osu.Game/Overlays/OverlayScrollContainer.cs index ca5fc90027..7fe188eb04 100644 --- a/osu.Game/Overlays/OverlayScrollContainer.cs +++ b/osu.Game/Overlays/OverlayScrollContainer.cs @@ -37,11 +37,7 @@ namespace osu.Game.Overlays Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, Margin = new MarginPadding(20), - Action = () => - { - ScrollToStart(); - Button.State = Visibility.Hidden; - } + Action = scrollToTop }); } @@ -58,6 +54,12 @@ namespace osu.Game.Overlays Button.State = Target > button_scroll_position ? Visibility.Visible : Visibility.Hidden; } + private void scrollToTop() + { + ScrollToStart(); + Button.State = Visibility.Hidden; + } + public class ScrollToTopButton : OsuHoverContainer { private const int fade_duration = 500; From 4245af28e1a3b1d953e391d29c65d535779c70be Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 5 Nov 2021 04:50:52 +0300 Subject: [PATCH 04/13] Disable other false-positive null inspections with comment --- .../BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs | 2 ++ osu.Game/Overlays/Changelog/ChangelogHeader.cs | 2 ++ osu.Game/Overlays/Comments/CommentEditor.cs | 2 ++ 3 files changed, 6 insertions(+) diff --git a/osu.Game/Overlays/BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs b/osu.Game/Overlays/BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs index e0632ace58..845190f285 100644 --- a/osu.Game/Overlays/BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs +++ b/osu.Game/Overlays/BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs @@ -23,6 +23,8 @@ namespace osu.Game.Overlays.BeatmapListing public BeatmapSearchMultipleSelectionFilterRow(LocalisableString header) : base(header) { + // ReSharper disable once PossibleNullReferenceException + // see https://youtrack.jetbrains.com/issue/RSRP-486768 Current.BindTo(filter.Current); } diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index 52dea63ab7..69a8cb2ce0 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -39,6 +39,8 @@ namespace osu.Game.Overlays.Changelog Build.ValueChanged += showBuild; + // ReSharper disable once PossibleNullReferenceException + // see https://youtrack.jetbrains.com/issue/RSRP-486768 Streams.Current.ValueChanged += e => { if (e.NewValue?.LatestBuild != null && !e.NewValue.Equals(Build.Value?.UpdateStream)) diff --git a/osu.Game/Overlays/Comments/CommentEditor.cs b/osu.Game/Overlays/Comments/CommentEditor.cs index 20a8ab64f7..1f3931901c 100644 --- a/osu.Game/Overlays/Comments/CommentEditor.cs +++ b/osu.Game/Overlays/Comments/CommentEditor.cs @@ -187,6 +187,8 @@ namespace osu.Game.Overlays.Comments AutoSizeAxes = Axes.Both; LoadingAnimationSize = new Vector2(10); + // ReSharper disable once PossibleNullReferenceException + // see https://youtrack.jetbrains.com/issue/RSRP-486768 drawableText.Text = text; } From f528488aa2ddea3979ca35c4da2bedb1e2761910 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 5 Nov 2021 05:36:04 +0300 Subject: [PATCH 05/13] Mark as non-null and move current bind to BDL instead --- .../BeatmapSearchMultipleSelectionFilterRow.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs b/osu.Game/Overlays/BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs index 845190f285..461a06a634 100644 --- a/osu.Game/Overlays/BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs +++ b/osu.Game/Overlays/BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; +using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -23,8 +24,11 @@ namespace osu.Game.Overlays.BeatmapListing public BeatmapSearchMultipleSelectionFilterRow(LocalisableString header) : base(header) { - // ReSharper disable once PossibleNullReferenceException - // see https://youtrack.jetbrains.com/issue/RSRP-486768 + } + + [BackgroundDependencyLoader] + private void load() + { Current.BindTo(filter.Current); } @@ -33,6 +37,7 @@ namespace osu.Game.Overlays.BeatmapListing /// /// Creates a filter control that can be used to simultaneously select multiple values of type . /// + [NotNull] protected virtual MultipleSelectionFilter CreateMultipleSelectionFilter() => new MultipleSelectionFilter(); protected class MultipleSelectionFilter : FillFlowContainer From b7239757670ee73f41cf797df4d910a6ab9b9e93 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 5 Nov 2021 09:10:38 +0300 Subject: [PATCH 06/13] Replace pragma with `add/remove => throw` --- .../NonVisual/FirstAvailableHitWindowsTest.cs | 15 +++++++++++---- .../Visual/Gameplay/TestSceneHitErrorMeter.cs | 15 +++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs b/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs index 8d83fe7452..8386a10ebb 100644 --- a/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs +++ b/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs @@ -79,10 +79,17 @@ namespace osu.Game.Tests.NonVisual public List HitObjects; public override IEnumerable Objects => HitObjects; -#pragma warning disable 67 - public override event Action NewResult; - public override event Action RevertResult; -#pragma warning restore 67 + public override event Action NewResult + { + add => throw new InvalidOperationException(); + remove => throw new InvalidOperationException(); + } + + public override event Action RevertResult + { + add => throw new InvalidOperationException(); + remove => throw new InvalidOperationException(); + } public override Playfield Playfield { get; } public override Container Overlays { get; } diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs index aa29f1386c..c1260f0231 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs @@ -235,10 +235,17 @@ namespace osu.Game.Tests.Visual.Gameplay public override IEnumerable Objects => new[] { new HitCircle { HitWindows = HitWindows } }; -#pragma warning disable 67 - public override event Action NewResult; - public override event Action RevertResult; -#pragma warning restore 67 + public override event Action NewResult + { + add => throw new InvalidOperationException(); + remove => throw new InvalidOperationException(); + } + + public override event Action RevertResult + { + add => throw new InvalidOperationException(); + remove => throw new InvalidOperationException(); + } public override Playfield Playfield { get; } public override Container Overlays { get; } From 3a3ec1436b8a35323d6b731f3c6575214ffb8557 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 5 Nov 2021 09:14:50 +0300 Subject: [PATCH 07/13] Re-enable possible null refernece exception inspections and move code --- .../Overlays/Changelog/ChangelogHeader.cs | 53 ++++++++++--------- osu.Game/Overlays/Comments/CommentEditor.cs | 12 +++-- 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index 69a8cb2ce0..1b120ef57c 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -38,14 +38,6 @@ namespace osu.Game.Overlays.Changelog }; Build.ValueChanged += showBuild; - - // ReSharper disable once PossibleNullReferenceException - // see https://youtrack.jetbrains.com/issue/RSRP-486768 - Streams.Current.ValueChanged += e => - { - if (e.NewValue?.LatestBuild != null && !e.NewValue.Equals(Build.Value?.UpdateStream)) - Build.Value = e.NewValue.LatestBuild; - }; } [BackgroundDependencyLoader] @@ -75,29 +67,40 @@ namespace osu.Game.Overlays.Changelog protected override Drawable CreateBackground() => new OverlayHeaderBackground(@"Headers/changelog"); - protected override Drawable CreateContent() => new Container + protected override Drawable CreateContent() { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Children = new Drawable[] + var content = new Container { - streamsBackground = new Box + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new Drawable[] { - RelativeSizeAxes = Axes.Both - }, - new Container - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Padding = new MarginPadding + streamsBackground = new Box { - Horizontal = 65, - Vertical = 20 + RelativeSizeAxes = Axes.Both }, - Child = Streams = new ChangelogUpdateStreamControl() + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding + { + Horizontal = 65, + Vertical = 20 + }, + Child = Streams = new ChangelogUpdateStreamControl() + } } - } - }; + }; + + Streams.Current.ValueChanged += e => + { + if (e.NewValue?.LatestBuild != null && !e.NewValue.Equals(Build.Value?.UpdateStream)) + Build.Value = e.NewValue.LatestBuild; + }; + + return content; + } protected override OverlayTitle CreateTitle() => new ChangelogHeaderTitle(); diff --git a/osu.Game/Overlays/Comments/CommentEditor.cs b/osu.Game/Overlays/Comments/CommentEditor.cs index 1f3931901c..1847de8660 100644 --- a/osu.Game/Overlays/Comments/CommentEditor.cs +++ b/osu.Game/Overlays/Comments/CommentEditor.cs @@ -175,6 +175,8 @@ namespace osu.Game.Overlays.Comments protected override IEnumerable EffectTargets => new[] { background }; + private readonly string text; + [Resolved] private OverlayColourProvider colourProvider { get; set; } @@ -184,12 +186,10 @@ namespace osu.Game.Overlays.Comments public CommitButton(string text) { + this.text = text; + AutoSizeAxes = Axes.Both; LoadingAnimationSize = new Vector2(10); - - // ReSharper disable once PossibleNullReferenceException - // see https://youtrack.jetbrains.com/issue/RSRP-486768 - drawableText.Text = text; } [BackgroundDependencyLoader] @@ -198,6 +198,8 @@ namespace osu.Game.Overlays.Comments IdleColour = colourProvider.Light4; HoverColour = colourProvider.Light3; blockedBackground.Colour = colourProvider.Background5; + + drawableText.Text = text; } protected override void LoadComplete() @@ -234,7 +236,7 @@ namespace osu.Game.Overlays.Comments Anchor = Anchor.Centre, Origin = Anchor.Centre, Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold), - Margin = new MarginPadding { Horizontal = 20 } + Margin = new MarginPadding { Horizontal = 20 }, } } }; From 6399c695e8809a0a8e27931b6eee8b85a06e7761 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 5 Nov 2021 15:54:27 +0900 Subject: [PATCH 08/13] Update usages of `BufferedContainer` in line with framework changes --- .../Skinning/Default/DefaultBodyPiece.cs | 6 ++---- osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs | 3 +-- osu.Game/Graphics/Backgrounds/Background.cs | 3 +-- osu.Game/Graphics/Sprites/GlowingSpriteText.cs | 3 +-- osu.Game/Overlays/NowPlayingOverlay.cs | 3 +-- osu.Game/Screens/Menu/IntroTriangles.cs | 2 +- osu.Game/Screens/Play/Break/BlurredIcon.cs | 2 +- osu.Game/Screens/Play/SquareGraph.cs | 3 +-- osu.Game/Screens/Ranking/Expanded/Accuracy/RankText.cs | 6 ++---- osu.Game/Screens/Select/BeatmapInfoWedgeBackground.cs | 3 +-- osu.Game/Screens/Select/Carousel/SetPanelBackground.cs | 2 +- 11 files changed, 13 insertions(+), 23 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Skinning/Default/DefaultBodyPiece.cs b/osu.Game.Rulesets.Mania/Skinning/Default/DefaultBodyPiece.cs index db1ac6da88..7138421b91 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Default/DefaultBodyPiece.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Default/DefaultBodyPiece.cs @@ -86,20 +86,18 @@ namespace osu.Game.Rulesets.Mania.Skinning.Default [BackgroundDependencyLoader] private void load() { - InternalChild = foregroundBuffer = new BufferedContainer + InternalChild = foregroundBuffer = new BufferedContainer(cachedFrameBuffer: true) { Blending = BlendingParameters.Additive, RelativeSizeAxes = Axes.Both, - CacheDrawnFrameBuffer = true, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both }, - subtractionBuffer = new BufferedContainer + subtractionBuffer = new BufferedContainer(cachedFrameBuffer: true) { RelativeSizeAxes = Axes.Both, // This is needed because we're blending with another object BackgroundColour = Color4.White.Opacity(0), - CacheDrawnFrameBuffer = true, // The 'hole' is achieved by subtracting the result of this container with the parent Blending = new BlendingParameters { AlphaEquation = BlendingEquation.ReverseSubtract }, Child = subtractionLayer = new CircularContainer diff --git a/osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs b/osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs index 3c2077b3c8..db4a6eb50b 100644 --- a/osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs +++ b/osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs @@ -136,10 +136,9 @@ namespace osu.Game.Rulesets.Osu.Statistics } } }, - bufferedGrid = new BufferedContainer + bufferedGrid = new BufferedContainer(cachedFrameBuffer: true) { RelativeSizeAxes = Axes.Both, - CacheDrawnFrameBuffer = true, BackgroundColour = Color4Extensions.FromHex("#202624").Opacity(0), Child = pointGrid = new GridContainer { diff --git a/osu.Game/Graphics/Backgrounds/Background.cs b/osu.Game/Graphics/Backgrounds/Background.cs index cfc1eb1806..353054a1f1 100644 --- a/osu.Game/Graphics/Backgrounds/Background.cs +++ b/osu.Game/Graphics/Backgrounds/Background.cs @@ -58,10 +58,9 @@ namespace osu.Game.Graphics.Backgrounds { RemoveInternal(Sprite); - AddInternal(bufferedContainer = new BufferedContainer + AddInternal(bufferedContainer = new BufferedContainer(cachedFrameBuffer: true) { RelativeSizeAxes = Axes.Both, - CacheDrawnFrameBuffer = true, RedrawOnScale = false, Child = Sprite }); diff --git a/osu.Game/Graphics/Sprites/GlowingSpriteText.cs b/osu.Game/Graphics/Sprites/GlowingSpriteText.cs index fb273d7293..9c43383a29 100644 --- a/osu.Game/Graphics/Sprites/GlowingSpriteText.cs +++ b/osu.Game/Graphics/Sprites/GlowingSpriteText.cs @@ -69,12 +69,11 @@ namespace osu.Game.Graphics.Sprites Children = new Drawable[] { - new BufferedContainer + new BufferedContainer(cachedFrameBuffer: true) { Anchor = Anchor.Centre, Origin = Anchor.Centre, BlurSigma = new Vector2(4), - CacheDrawnFrameBuffer = true, RedrawOnScale = false, RelativeSizeAxes = Axes.Both, Blending = BlendingParameters.Additive, diff --git a/osu.Game/Overlays/NowPlayingOverlay.cs b/osu.Game/Overlays/NowPlayingOverlay.cs index 5619d7b38a..f37e6bedf7 100644 --- a/osu.Game/Overlays/NowPlayingOverlay.cs +++ b/osu.Game/Overlays/NowPlayingOverlay.cs @@ -366,14 +366,13 @@ namespace osu.Game.Overlays private readonly WorkingBeatmap beatmap; public Background(WorkingBeatmap beatmap = null) + : base(cachedFrameBuffer: true) { this.beatmap = beatmap; Depth = float.MaxValue; RelativeSizeAxes = Axes.Both; - CacheDrawnFrameBuffer = true; - Children = new Drawable[] { sprite = new Sprite diff --git a/osu.Game/Screens/Menu/IntroTriangles.cs b/osu.Game/Screens/Menu/IntroTriangles.cs index 48ced63182..d171e481b1 100644 --- a/osu.Game/Screens/Menu/IntroTriangles.cs +++ b/osu.Game/Screens/Menu/IntroTriangles.cs @@ -393,6 +393,7 @@ namespace osu.Game.Screens.Menu public class OutlineTriangle : BufferedContainer { public OutlineTriangle(bool outlineOnly, float size) + : base(cachedFrameBuffer: true) { Size = new Vector2(size); @@ -414,7 +415,6 @@ namespace osu.Game.Screens.Menu } Blending = BlendingParameters.Additive; - CacheDrawnFrameBuffer = true; } } } diff --git a/osu.Game/Screens/Play/Break/BlurredIcon.cs b/osu.Game/Screens/Play/Break/BlurredIcon.cs index a88112a0db..1e974ec916 100644 --- a/osu.Game/Screens/Play/Break/BlurredIcon.cs +++ b/osu.Game/Screens/Play/Break/BlurredIcon.cs @@ -32,9 +32,9 @@ namespace osu.Game.Screens.Play.Break } public BlurredIcon() + : base(cachedFrameBuffer: true) { RelativePositionAxes = Axes.X; - CacheDrawnFrameBuffer = true; Child = icon = new SpriteIcon { Origin = Anchor.Centre, diff --git a/osu.Game/Screens/Play/SquareGraph.cs b/osu.Game/Screens/Play/SquareGraph.cs index 67abcb66e6..a7d4454701 100644 --- a/osu.Game/Screens/Play/SquareGraph.cs +++ b/osu.Game/Screens/Play/SquareGraph.cs @@ -98,9 +98,8 @@ namespace osu.Game.Screens.Play /// protected virtual void RecreateGraph() { - var newColumns = new BufferedContainer + var newColumns = new BufferedContainer(cachedFrameBuffer: true) { - CacheDrawnFrameBuffer = true, RedrawOnScale = false, RelativeSizeAxes = Axes.Both, }; diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/RankText.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/RankText.cs index cc732382f4..5aea0184ee 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/RankText.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/RankText.cs @@ -51,13 +51,12 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy Font = OsuFont.Numeric.With(size: 76), UseFullGlyphHeight = false }, - superFlash = new BufferedContainer + superFlash = new BufferedContainer(cachedFrameBuffer: true) { Anchor = Anchor.Centre, Origin = Anchor.Centre, BlurSigma = new Vector2(85), Size = new Vector2(600), - CacheDrawnFrameBuffer = true, Blending = BlendingParameters.Additive, Alpha = 0, Children = new[] @@ -71,14 +70,13 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy }, }, }, - flash = new BufferedContainer + flash = new BufferedContainer(cachedFrameBuffer: true) { Anchor = Anchor.Centre, Origin = Anchor.Centre, BlurSigma = new Vector2(35), BypassAutoSizeAxes = Axes.Both, Size = new Vector2(200), - CacheDrawnFrameBuffer = true, Blending = BlendingParameters.Additive, Alpha = 0, Scale = new Vector2(1.8f), diff --git a/osu.Game/Screens/Select/BeatmapInfoWedgeBackground.cs b/osu.Game/Screens/Select/BeatmapInfoWedgeBackground.cs index f50fb4dc8a..25056790cc 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedgeBackground.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedgeBackground.cs @@ -27,9 +27,8 @@ namespace osu.Game.Screens.Select { RelativeSizeAxes = Axes.Both; - InternalChild = new BufferedContainer + InternalChild = new BufferedContainer(cachedFrameBuffer: true) { - CacheDrawnFrameBuffer = true, RelativeSizeAxes = Axes.Both, Children = new Drawable[] { diff --git a/osu.Game/Screens/Select/Carousel/SetPanelBackground.cs b/osu.Game/Screens/Select/Carousel/SetPanelBackground.cs index 25139b27db..b4279cce51 100644 --- a/osu.Game/Screens/Select/Carousel/SetPanelBackground.cs +++ b/osu.Game/Screens/Select/Carousel/SetPanelBackground.cs @@ -15,8 +15,8 @@ namespace osu.Game.Screens.Select.Carousel public class SetPanelBackground : BufferedContainer { public SetPanelBackground(WorkingBeatmap working) + : base(cachedFrameBuffer: true) { - CacheDrawnFrameBuffer = true; RedrawOnScale = false; Children = new Drawable[] From f013a1e37fd8f9184bbaa6e6c13841d611aa06e7 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 5 Nov 2021 10:12:41 +0300 Subject: [PATCH 09/13] Move `CreateContent()` to BDL --- .../Graphics/UserInterface/LoadingButton.cs | 40 ++++++++++++------- osu.Game/Overlays/Comments/CommentEditor.cs | 3 +- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/LoadingButton.cs b/osu.Game/Graphics/UserInterface/LoadingButton.cs index 81dc023d7e..a75cf0639c 100644 --- a/osu.Game/Graphics/UserInterface/LoadingButton.cs +++ b/osu.Game/Graphics/UserInterface/LoadingButton.cs @@ -1,7 +1,9 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; using osuTK; @@ -22,15 +24,9 @@ namespace osu.Game.Graphics.UserInterface Enabled.Value = !isLoading; if (value) - { loading.Show(); - OnLoadStarted(); - } else - { loading.Hide(); - OnLoadFinished(); - } } } @@ -44,18 +40,34 @@ namespace osu.Game.Graphics.UserInterface protected LoadingButton() { - AddRange(new[] + Add(loading = new LoadingSpinner { - CreateContent(), - loading = new LoadingSpinner - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(12) - } + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(12), + Depth = -1, }); } + [BackgroundDependencyLoader] + private void load() + { + Add(CreateContent()); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + loading.State.BindValueChanged(s => + { + if (s.NewValue == Visibility.Visible) + OnLoadStarted(); + else + OnLoadFinished(); + }, true); + } + protected override bool OnClick(ClickEvent e) { if (!Enabled.Value) diff --git a/osu.Game/Overlays/Comments/CommentEditor.cs b/osu.Game/Overlays/Comments/CommentEditor.cs index 1847de8660..3ff4cfad4a 100644 --- a/osu.Game/Overlays/Comments/CommentEditor.cs +++ b/osu.Game/Overlays/Comments/CommentEditor.cs @@ -198,8 +198,6 @@ namespace osu.Game.Overlays.Comments IdleColour = colourProvider.Light4; HoverColour = colourProvider.Light3; blockedBackground.Colour = colourProvider.Background5; - - drawableText.Text = text; } protected override void LoadComplete() @@ -237,6 +235,7 @@ namespace osu.Game.Overlays.Comments Origin = Anchor.Centre, Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold), Margin = new MarginPadding { Horizontal = 20 }, + Text = text, } } }; From 51e7b9950e1bcedb85a97315616c486b3b3b75e7 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 5 Nov 2021 18:07:12 +0300 Subject: [PATCH 10/13] Define local current bindable to bind value change instead --- .../Overlays/Changelog/ChangelogHeader.cs | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index 1b120ef57c..4a94666031 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -26,6 +26,8 @@ namespace osu.Game.Overlays.Changelog public static LocalisableString ListingString => LayoutStrings.HeaderChangelogIndex; + private readonly Bindable currentStream = new Bindable(); + private Box streamsBackground; public ChangelogHeader() @@ -38,6 +40,12 @@ namespace osu.Game.Overlays.Changelog }; Build.ValueChanged += showBuild; + + currentStream.ValueChanged += e => + { + if (e.NewValue?.LatestBuild != null && !e.NewValue.Equals(Build.Value?.UpdateStream)) + Build.Value = e.NewValue.LatestBuild; + }; } [BackgroundDependencyLoader] @@ -61,7 +69,7 @@ namespace osu.Game.Overlays.Changelog else { Current.Value = ListingString; - Streams.Current.Value = null; + currentStream.Value = null; } } @@ -88,17 +96,11 @@ namespace osu.Game.Overlays.Changelog Horizontal = 65, Vertical = 20 }, - Child = Streams = new ChangelogUpdateStreamControl() + Child = Streams = new ChangelogUpdateStreamControl { Current = currentStream }, } } }; - Streams.Current.ValueChanged += e => - { - if (e.NewValue?.LatestBuild != null && !e.NewValue.Equals(Build.Value?.UpdateStream)) - Build.Value = e.NewValue.LatestBuild; - }; - return content; } @@ -115,7 +117,7 @@ namespace osu.Game.Overlays.Changelog if (Build.Value == null) return; - Streams.Current.Value = Streams.Items.FirstOrDefault(s => s.Name == Build.Value.UpdateStream.Name); + currentStream.Value = Streams.Items.FirstOrDefault(s => s.Name == Build.Value.UpdateStream.Name); } private class ChangelogHeaderTitle : OverlayTitle From 2b3907db4b80ea7bd859a85d0bbccb7149f9aec3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 6 Nov 2021 14:33:45 +0900 Subject: [PATCH 11/13] 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 6d2e8428a7..4f9f83f199 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 6dda1f77c6..7811de5764 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 df24a57e90..9d95b7c765 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -70,7 +70,7 @@ - + @@ -93,7 +93,7 @@ - + From c40f88749209b7cfd06b9f67a74c345fda3186bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 6 Nov 2021 15:20:29 +0100 Subject: [PATCH 12/13] Remove unnecessary local variable --- .../Overlays/Changelog/ChangelogHeader.cs | 39 ++++++++----------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index 4a94666031..49a33ee5d6 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -75,34 +75,29 @@ namespace osu.Game.Overlays.Changelog protected override Drawable CreateBackground() => new OverlayHeaderBackground(@"Headers/changelog"); - protected override Drawable CreateContent() + protected override Drawable CreateContent() => new Container { - var content = new Container + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new Drawable[] { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Children = new Drawable[] + streamsBackground = new Box { - streamsBackground = new Box + RelativeSizeAxes = Axes.Both + }, + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding { - RelativeSizeAxes = Axes.Both + Horizontal = 65, + Vertical = 20 }, - new Container - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Padding = new MarginPadding - { - Horizontal = 65, - Vertical = 20 - }, - Child = Streams = new ChangelogUpdateStreamControl { Current = currentStream }, - } + Child = Streams = new ChangelogUpdateStreamControl { Current = currentStream }, } - }; - - return content; - } + } + }; protected override OverlayTitle CreateTitle() => new ChangelogHeaderTitle(); From eb5e7402c3b86a4ce19243aaf678d8206c16edf3 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sun, 7 Nov 2021 16:14:24 +0300 Subject: [PATCH 13/13] Remove obsolete method in `ModAutoplay` --- osu.Game/Rulesets/Mods/ModAutoplay.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/osu.Game/Rulesets/Mods/ModAutoplay.cs b/osu.Game/Rulesets/Mods/ModAutoplay.cs index 4849d6ea36..60b9c29fe0 100644 --- a/osu.Game/Rulesets/Mods/ModAutoplay.cs +++ b/osu.Game/Rulesets/Mods/ModAutoplay.cs @@ -30,11 +30,6 @@ namespace osu.Game.Rulesets.Mods public override bool HasImplementation => GetType().GenericTypeArguments.Length == 0; - [Obsolete("Use the mod-supporting override")] // can be removed 20210731 - public virtual Score CreateReplayScore(IBeatmap beatmap) => new Score { Replay = new Replay() }; - -#pragma warning disable 618 - public virtual Score CreateReplayScore(IBeatmap beatmap, IReadOnlyList mods) => CreateReplayScore(beatmap); -#pragma warning restore 618 + public virtual Score CreateReplayScore(IBeatmap beatmap, IReadOnlyList mods) => new Score { Replay = new Replay() }; } }