Use `AsNonNull()` instead.

This commit is contained in:
andy840119 2022-07-02 19:48:32 +08:00
parent 59c83a3423
commit 0a1543c6e8
4 changed files with 8 additions and 4 deletions

View File

@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Objects;
@ -94,7 +95,7 @@ private double calculateReleaseTime(HitObject currentObject, HitObject? nextObje
bool canDelayKeyUpFully = nextObject == null ||
nextObject.StartTime > endTime + RELEASE_DELAY;
return endTime + (canDelayKeyUpFully ? RELEASE_DELAY : (nextObject!.StartTime - endTime) * 0.9);
return endTime + (canDelayKeyUpFully ? RELEASE_DELAY : (nextObject.AsNonNull().StartTime - endTime) * 0.9);
}
protected override HitObject? GetNextObject(int currentIndex)

View File

@ -3,6 +3,7 @@
using System;
using System.Linq;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Rulesets.Replays;
@ -117,7 +118,7 @@ protected override void GenerateFrames()
var nextHitObject = GetNextObject(i); // Get the next object that requires pressing the same button
bool canDelayKeyUp = nextHitObject == null || nextHitObject.StartTime > endTime + KEY_UP_DELAY;
double calculatedDelay = canDelayKeyUp ? KEY_UP_DELAY : (nextHitObject!.StartTime - endTime) * 0.9;
double calculatedDelay = canDelayKeyUp ? KEY_UP_DELAY : (nextHitObject.AsNonNull().StartTime - endTime) * 0.9;
Frames.Add(new TaikoReplayFrame(endTime + calculatedDelay));
hitButton = !hitButton;

View File

@ -9,6 +9,7 @@
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Development;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics;
using osu.Framework.Logging;
using osu.Game.Beatmaps;
@ -188,7 +189,7 @@ public void HandleFrame(ReplayFrame frame) => Schedule(() =>
}
if (frame is IConvertibleReplayFrame convertible)
pendingFrames.Enqueue(convertible.ToLegacy(currentBeatmap!));
pendingFrames.Enqueue(convertible.ToLegacy(currentBeatmap.AsNonNull()));
if (pendingFrames.Count > max_pending_frames)
purgePendingFrames();

View File

@ -6,6 +6,7 @@
using System.Linq;
using System.Text;
using osu.Framework.Extensions;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Formats;
using osu.Game.Extensions;
@ -143,7 +144,7 @@ private LegacyReplayFrame getLegacyFrame(ReplayFrame replayFrame)
return legacyFrame;
case IConvertibleReplayFrame convertibleFrame:
return convertibleFrame.ToLegacy(beatmap!);
return convertibleFrame.ToLegacy(beatmap.AsNonNull());
default:
throw new ArgumentException(@"Frame could not be converted to legacy frames", nameof(replayFrame));