1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 17:27:24 +08:00

Apply NRT to touched files

This commit is contained in:
Joseph Madamba 2024-02-27 23:24:04 -08:00
parent e8a1061777
commit 8e462fbb38
7 changed files with 30 additions and 37 deletions

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
@ -20,10 +18,10 @@ namespace osu.Game.Tests.Visual.Gameplay
[Description("player pause/fail screens")]
public partial class TestSceneGameplayMenuOverlay : OsuManualInputManagerTestScene
{
private FailOverlay failOverlay;
private PauseOverlay pauseOverlay;
private FailOverlay failOverlay = null!;
private PauseOverlay pauseOverlay = null!;
private GlobalActionContainer globalActionContainer;
private GlobalActionContainer globalActionContainer = null!;
private bool triggeredRetryButton;

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
@ -40,13 +38,13 @@ namespace osu.Game.Tests.Visual.Gameplay
protected override bool UseOnlineAPI => true;
[Resolved]
private OsuGameBase game { get; set; }
private OsuGameBase game { get; set; } = null!;
private TestSpectatorClient spectatorClient => dependenciesScreen.SpectatorClient;
private DependenciesScreen dependenciesScreen;
private SoloSpectatorScreen spectatorScreen;
private DependenciesScreen dependenciesScreen = null!;
private SoloSpectatorScreen spectatorScreen = null!;
private BeatmapSetInfo importedBeatmap;
private BeatmapSetInfo importedBeatmap = null!;
private int importedBeatmapId;
[SetUpSteps]
@ -189,7 +187,7 @@ namespace osu.Game.Tests.Visual.Gameplay
waitForPlayerCurrent();
Player lastPlayer = null;
Player lastPlayer = null!;
AddStep("store first player", () => lastPlayer = player);
start();
@ -282,7 +280,7 @@ namespace osu.Game.Tests.Visual.Gameplay
[Test]
public void TestFinalFrameInBundleHasHeader()
{
FrameDataBundle lastBundle = null;
FrameDataBundle? lastBundle = null;
AddStep("bind to client", () => spectatorClient.OnNewFrames += (_, bundle) => lastBundle = bundle);
@ -291,8 +289,8 @@ namespace osu.Game.Tests.Visual.Gameplay
finish();
AddUntilStep("bundle received", () => lastBundle != null);
AddAssert("first frame does not have header", () => lastBundle.Frames[0].Header == null);
AddAssert("last frame has header", () => lastBundle.Frames[^1].Header != null);
AddAssert("first frame does not have header", () => lastBundle?.Frames[0].Header == null);
AddAssert("last frame has header", () => lastBundle?.Frames[^1].Header != null);
}
[Test]
@ -387,7 +385,7 @@ namespace osu.Game.Tests.Visual.Gameplay
}
private OsuFramedReplayInputHandler replayHandler =>
(OsuFramedReplayInputHandler)Stack.ChildrenOfType<OsuInputManager>().First().ReplayInputHandler;
(OsuFramedReplayInputHandler)Stack.ChildrenOfType<OsuInputManager>().First().ReplayInputHandler!;
private Player player => this.ChildrenOfType<Player>().Single();

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System;
using System.Threading.Tasks;
using osu.Game.Scoring;
@ -20,7 +18,7 @@ namespace osu.Game.Screens.Play
{
public partial class FailOverlay : GameplayMenuOverlay
{
public Func<Task<ScoreInfo>> SaveReplay;
public Func<Task<ScoreInfo>>? SaveReplay;
public override LocalisableString Header => GameplayMenuOverlayStrings.FailedHeader;

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System;
using System.Linq;
using osu.Framework.Allocation;
@ -23,7 +21,7 @@ namespace osu.Game.Screens.Play
public override LocalisableString Header => GameplayMenuOverlayStrings.PausedHeader;
private SkinnableSound pauseLoop;
private SkinnableSound pauseLoop = null!;
protected override Action BackAction => () =>
{

View File

@ -30,13 +30,13 @@ namespace osu.Game.Screens.Play
private readonly Bindable<DownloadState> state = new Bindable<DownloadState>();
private readonly Func<Task<ScoreInfo>> importFailedScore;
private readonly Func<Task<ScoreInfo>>? importFailedScore;
private ScoreInfo? importedScore;
private DownloadButton button = null!;
public SaveFailedScoreButton(Func<Task<ScoreInfo>> importFailedScore)
public SaveFailedScoreButton(Func<Task<ScoreInfo>>? importFailedScore)
{
Size = new Vector2(50, 30);
@ -60,11 +60,16 @@ namespace osu.Game.Screens.Play
case DownloadState.NotDownloaded:
state.Value = DownloadState.Importing;
Task.Run(importFailedScore).ContinueWith(t =>
if (importFailedScore != null)
{
importedScore = realm.Run(r => r.Find<ScoreInfo>(t.GetResultSafely().ID)?.Detach());
Schedule(() => state.Value = importedScore != null ? DownloadState.LocallyAvailable : DownloadState.NotDownloaded);
}).FireAndForget();
Task.Run(importFailedScore).ContinueWith(t =>
{
importedScore = realm.Run(r => r.Find<ScoreInfo>(t.GetResultSafely().ID)?.Detach());
Schedule(() => state.Value = importedScore != null ? DownloadState.LocallyAvailable : DownloadState.NotDownloaded);
}).FireAndForget();
}
break;
}
}

View File

@ -50,8 +50,7 @@ namespace osu.Game.Screens.Play
{
base.Dispose(isDisposing);
if (SpectatorClient != null)
SpectatorClient.OnUserBeganPlaying -= userBeganPlaying;
SpectatorClient.OnUserBeganPlaying -= userBeganPlaying;
}
}
}

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System.Diagnostics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
@ -21,7 +19,7 @@ namespace osu.Game.Screens.Play
public abstract partial class SpectatorPlayer : Player
{
[Resolved]
protected SpectatorClient SpectatorClient { get; private set; }
protected SpectatorClient SpectatorClient { get; private set; } = null!;
private readonly Score score;
@ -35,7 +33,7 @@ namespace osu.Game.Screens.Play
private bool allowFail;
protected SpectatorPlayer(Score score, PlayerConfiguration configuration = null)
protected SpectatorPlayer(Score score, PlayerConfiguration? configuration = null)
: base(configuration)
{
this.score = score;
@ -98,7 +96,7 @@ namespace osu.Game.Screens.Play
foreach (var frame in bundle.Frames)
{
IConvertibleReplayFrame convertibleFrame = GameplayState.Ruleset.CreateConvertibleReplayFrame();
IConvertibleReplayFrame convertibleFrame = GameplayState.Ruleset.CreateConvertibleReplayFrame()!;
Debug.Assert(convertibleFrame != null);
convertibleFrame.FromLegacy(frame, GameplayState.Beatmap);
@ -134,8 +132,7 @@ namespace osu.Game.Screens.Play
{
base.Dispose(isDisposing);
if (SpectatorClient != null)
SpectatorClient.OnNewFrames -= userSentFrames;
SpectatorClient.OnNewFrames -= userSentFrames;
}
}
}