mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 10:22:56 +08:00
Resolve nullable inspection, enable nullable for FollowPointLifetimeEntry
This commit is contained in:
parent
b373b120ff
commit
bc892086fe
@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Pooling;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
@ -26,7 +27,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
||||
base.OnApply(entry);
|
||||
|
||||
entry.Invalidated += refreshPoints;
|
||||
refreshPoints();
|
||||
refreshPoints(entry);
|
||||
}
|
||||
|
||||
protected override void OnFree(FollowPointLifetimeEntry entry)
|
||||
@ -38,12 +39,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
||||
ClearInternal(false);
|
||||
}
|
||||
|
||||
private void refreshPoints()
|
||||
private void refreshPoints(FollowPointLifetimeEntry entry)
|
||||
{
|
||||
ClearInternal(false);
|
||||
|
||||
OsuHitObject start = Entry.Start;
|
||||
OsuHitObject end = Entry.End;
|
||||
OsuHitObject start = entry.Start;
|
||||
OsuHitObject end = entry.End;
|
||||
Debug.Assert(end != null, $"{nameof(FollowPointLifetimeEntry)} without end hit object should never be alive");
|
||||
|
||||
double startTime = start.GetEndTime();
|
||||
|
||||
@ -88,7 +90,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
||||
}
|
||||
|
||||
// todo: use Expire() on FollowPoints and take lifetime from them when https://github.com/ppy/osu-framework/issues/3300 is fixed.
|
||||
Entry.LifetimeEnd = finalTransformEndTime;
|
||||
entry.LifetimeEnd = finalTransformEndTime;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1,6 +1,8 @@
|
||||
// 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 enable
|
||||
|
||||
using System;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics.Performance;
|
||||
@ -11,7 +13,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
||||
{
|
||||
public class FollowPointLifetimeEntry : LifetimeEntry
|
||||
{
|
||||
public event Action Invalidated;
|
||||
public event Action<FollowPointLifetimeEntry>? Invalidated;
|
||||
public readonly OsuHitObject Start;
|
||||
|
||||
public FollowPointLifetimeEntry(OsuHitObject start)
|
||||
@ -22,9 +24,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
||||
bindEvents();
|
||||
}
|
||||
|
||||
private OsuHitObject end;
|
||||
private OsuHitObject? end;
|
||||
|
||||
public OsuHitObject End
|
||||
public OsuHitObject? End
|
||||
{
|
||||
get => end;
|
||||
set
|
||||
@ -56,11 +58,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
||||
|
||||
public void UnbindEvents()
|
||||
{
|
||||
if (Start != null)
|
||||
{
|
||||
Start.DefaultsApplied -= onDefaultsApplied;
|
||||
Start.PositionBindable.ValueChanged -= onPositionChanged;
|
||||
}
|
||||
Start.DefaultsApplied -= onDefaultsApplied;
|
||||
Start.PositionBindable.ValueChanged -= onPositionChanged;
|
||||
|
||||
if (End != null)
|
||||
{
|
||||
@ -92,7 +91,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
||||
LifetimeStart = fadeInTime;
|
||||
LifetimeEnd = double.MaxValue; // This will be set by the connection.
|
||||
|
||||
Invalidated?.Invoke();
|
||||
Invalidated?.Invoke(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user