1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-29 02:12:57 +08:00

Make track not-null in GameplayClockContainer/FailAnimation

This commit is contained in:
smoogipoo 2020-08-12 00:50:56 +09:00
parent b66f303e71
commit eec94e1f53
2 changed files with 7 additions and 8 deletions

View File

@ -6,6 +6,7 @@ using osu.Framework.Bindables;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio.Sample; using osu.Framework.Audio.Sample;
using osu.Framework.Audio.Track; using osu.Framework.Audio.Track;
@ -26,6 +27,8 @@ namespace osu.Game.Screens.Play
public Action OnComplete; public Action OnComplete;
private readonly DrawableRuleset drawableRuleset; private readonly DrawableRuleset drawableRuleset;
[NotNull]
private readonly ITrack track; private readonly ITrack track;
private readonly BindableDouble trackFreq = new BindableDouble(1); private readonly BindableDouble trackFreq = new BindableDouble(1);
@ -34,7 +37,7 @@ namespace osu.Game.Screens.Play
private SampleChannel failSample; private SampleChannel failSample;
public FailAnimation(DrawableRuleset drawableRuleset, ITrack track) public FailAnimation(DrawableRuleset drawableRuleset, [NotNull] ITrack track)
{ {
this.drawableRuleset = drawableRuleset; this.drawableRuleset = drawableRuleset;
this.track = track; this.track = track;

View File

@ -3,6 +3,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using osu.Framework; using osu.Framework;
@ -27,6 +28,7 @@ namespace osu.Game.Screens.Play
private readonly WorkingBeatmap beatmap; private readonly WorkingBeatmap beatmap;
private readonly IReadOnlyList<Mod> mods; private readonly IReadOnlyList<Mod> mods;
[NotNull]
private ITrack track; private ITrack track;
public readonly BindableBool IsPaused = new BindableBool(); public readonly BindableBool IsPaused = new BindableBool();
@ -60,7 +62,7 @@ namespace osu.Game.Screens.Play
private readonly FramedOffsetClock platformOffsetClock; private readonly FramedOffsetClock platformOffsetClock;
public GameplayClockContainer(ITrack track, WorkingBeatmap beatmap, IReadOnlyList<Mod> mods, double gameplayStartTime) public GameplayClockContainer([NotNull] ITrack track, WorkingBeatmap beatmap, IReadOnlyList<Mod> mods, double gameplayStartTime)
{ {
this.beatmap = beatmap; this.beatmap = beatmap;
this.mods = mods; this.mods = mods;
@ -196,9 +198,6 @@ namespace osu.Game.Screens.Play
/// </summary> /// </summary>
public void StopUsingBeatmapClock() public void StopUsingBeatmapClock()
{ {
if (track == null)
return;
removeSourceClockAdjustments(); removeSourceClockAdjustments();
track = new TrackVirtual(track.Length); track = new TrackVirtual(track.Length);
@ -217,8 +216,6 @@ namespace osu.Game.Screens.Play
private void updateRate() private void updateRate()
{ {
if (track == null) return;
speedAdjustmentsApplied = true; speedAdjustmentsApplied = true;
track.ResetSpeedAdjustments(); track.ResetSpeedAdjustments();
@ -233,7 +230,6 @@ namespace osu.Game.Screens.Play
{ {
base.Dispose(isDisposing); base.Dispose(isDisposing);
removeSourceClockAdjustments(); removeSourceClockAdjustments();
track = null;
} }
private void removeSourceClockAdjustments() private void removeSourceClockAdjustments()