From cb07f2399fc584069578e2791fb8ecf7f5fd5674 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 20 Jun 2023 21:03:55 +0900 Subject: [PATCH] Apply NRT to `GameplaySampleTriggerSource` --- osu.Game/Rulesets/UI/GameplaySampleTriggerSource.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/osu.Game/Rulesets/UI/GameplaySampleTriggerSource.cs b/osu.Game/Rulesets/UI/GameplaySampleTriggerSource.cs index 029cab65ab..472f91ac27 100644 --- a/osu.Game/Rulesets/UI/GameplaySampleTriggerSource.cs +++ b/osu.Game/Rulesets/UI/GameplaySampleTriggerSource.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; @@ -31,8 +29,10 @@ namespace osu.Game.Rulesets.UI private readonly Container hitSounds; + private HitObjectLifetimeEntry? mostValidObject; + [Resolved] - private IGameplayClock gameplayClock { get; set; } + private IGameplayClock gameplayClock { get; set; } = null!; public GameplaySampleTriggerSource(HitObjectContainer hitObjectContainer) { @@ -45,14 +45,12 @@ namespace osu.Game.Rulesets.UI }; } - private HitObjectLifetimeEntry mostValidObject; - /// /// Play the most appropriate hit sound for the current point in time. /// public virtual void Play() { - var nextObject = GetMostValidObject(); + HitObject? nextObject = GetMostValidObject(); if (nextObject == null) return; @@ -71,7 +69,7 @@ namespace osu.Game.Rulesets.UI hitSound.Play(); }); - protected HitObject GetMostValidObject() + protected HitObject? GetMostValidObject() { if (mostValidObject == null || isAlreadyHit(mostValidObject)) {