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.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 @@ public ForegroundPiece() [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 @@ private void load() } } }, - 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.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 @@ public void TestChangedSettingsRevertedToDefault() 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 diff --git a/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs b/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs index 97105b6b6a..8386a10ebb 100644 --- a/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs +++ b/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs @@ -79,8 +79,17 @@ private class TestDrawableRuleset : DrawableRuleset public List HitObjects; public override IEnumerable Objects => HitObjects; - public override event Action NewResult; - public override event Action RevertResult; + 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; } @@ -95,9 +104,6 @@ private class TestDrawableRuleset : DrawableRuleset 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..c1260f0231 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs @@ -235,8 +235,17 @@ private class TestDrawableRuleset : DrawableRuleset public override IEnumerable Objects => new[] { new HitCircle { HitWindows = HitWindows } }; - public override event Action NewResult; - public override event Action RevertResult; + 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; } @@ -251,9 +260,6 @@ private class TestDrawableRuleset : DrawableRuleset 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/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 @@ public void BlurTo(Vector2 newBlurSigma, double duration = 0, Easing easing = Ea { 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 @@ public GlowingSpriteText() 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/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 @@ public bool IsLoading Enabled.Value = !isLoading; if (value) - { loading.Show(); - OnLoadStarted(); - } else - { loading.Hide(); - OnLoadFinished(); - } } } @@ -44,18 +40,34 @@ public Vector2 LoadingAnimationSize 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/BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs b/osu.Game/Overlays/BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs index e0632ace58..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; @@ -22,6 +23,11 @@ public class BeatmapSearchMultipleSelectionFilterRow : BeatmapSearchFilterRow public BeatmapSearchMultipleSelectionFilterRow(LocalisableString header) : base(header) + { + } + + [BackgroundDependencyLoader] + private void load() { Current.BindTo(filter.Current); } @@ -31,6 +37,7 @@ public BeatmapSearchMultipleSelectionFilterRow(LocalisableString header) /// /// 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 diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index 52dea63ab7..49a33ee5d6 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -26,6 +26,8 @@ public class ChangelogHeader : BreadcrumbControlOverlayHeader public static LocalisableString ListingString => LayoutStrings.HeaderChangelogIndex; + private readonly Bindable currentStream = new Bindable(); + private Box streamsBackground; public ChangelogHeader() @@ -39,7 +41,7 @@ public ChangelogHeader() Build.ValueChanged += showBuild; - Streams.Current.ValueChanged += e => + currentStream.ValueChanged += e => { if (e.NewValue?.LatestBuild != null && !e.NewValue.Equals(Build.Value?.UpdateStream)) Build.Value = e.NewValue.LatestBuild; @@ -67,7 +69,7 @@ private void showBuild(ValueChangedEvent e) else { Current.Value = ListingString; - Streams.Current.Value = null; + currentStream.Value = null; } } @@ -92,7 +94,7 @@ private void showBuild(ValueChangedEvent e) Horizontal = 65, Vertical = 20 }, - Child = Streams = new ChangelogUpdateStreamControl() + Child = Streams = new ChangelogUpdateStreamControl { Current = currentStream }, } } }; @@ -110,7 +112,7 @@ private void updateCurrentStream() 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 diff --git a/osu.Game/Overlays/Comments/CommentEditor.cs b/osu.Game/Overlays/Comments/CommentEditor.cs index 20a8ab64f7..3ff4cfad4a 100644 --- a/osu.Game/Overlays/Comments/CommentEditor.cs +++ b/osu.Game/Overlays/Comments/CommentEditor.cs @@ -175,6 +175,8 @@ private class CommitButton : LoadingButton protected override IEnumerable EffectTargets => new[] { background }; + private readonly string text; + [Resolved] private OverlayColourProvider colourProvider { get; set; } @@ -184,10 +186,10 @@ private class CommitButton : LoadingButton public CommitButton(string text) { + this.text = text; + AutoSizeAxes = Axes.Both; LoadingAnimationSize = new Vector2(10); - - drawableText.Text = text; } [BackgroundDependencyLoader] @@ -232,7 +234,8 @@ private void onBlockedStateChanged(ValueChangedEvent isBlocked) Anchor = Anchor.Centre, Origin = Anchor.Centre, Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold), - Margin = new MarginPadding { Horizontal = 20 } + Margin = new MarginPadding { Horizontal = 20 }, + Text = text, } } }; 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 @@ private class Background : BufferedContainer 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/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 @@ public OverlayScrollContainer() Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, Margin = new MarginPadding(20), - Action = () => - { - ScrollToStart(); - Button.State = Visibility.Hidden; - } + Action = scrollToTop }); } @@ -58,6 +54,12 @@ protected override void UpdateAfterChildren() 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; 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 @@ public abstract class ModAutoplay : Mod, IApplicableFailOverride, ICreateReplay 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() }; } } 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 @@ protected override void Update() public class OutlineTriangle : BufferedContainer { public OutlineTriangle(bool outlineOnly, float size) + : base(cachedFrameBuffer: true) { Size = new Vector2(size); @@ -414,7 +415,6 @@ public OutlineTriangle(bool outlineOnly, float size) } 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 @@ public override Vector2 Size } 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 @@ protected override void Update() /// 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 @@ private void load() 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 @@ private void load() }, }, }, - 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 @@ private void load() { 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[] 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 @@ - +