1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:57:36 +08:00

Remove hitObject argument from OnApply and OnFree

This commit is contained in:
ekrctb 2020-11-27 10:13:05 +09:00
parent 5a393b153b
commit 57454bbb1c
5 changed files with 16 additions and 18 deletions

View File

@ -53,9 +53,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
}); });
} }
protected override void OnApply(HitObject hitObject) protected override void OnApply()
{ {
base.OnApply(hitObject); base.OnApply();
IndexInCurrentComboBindable.BindTo(HitObject.IndexInCurrentComboBindable); IndexInCurrentComboBindable.BindTo(HitObject.IndexInCurrentComboBindable);
PositionBindable.BindTo(HitObject.PositionBindable); PositionBindable.BindTo(HitObject.PositionBindable);
@ -70,9 +70,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
LifetimeEnd = HitObject.GetEndTime() + HitObject.HitWindows.WindowFor(HitResult.Miss) + 1000; LifetimeEnd = HitObject.GetEndTime() + HitObject.HitWindows.WindowFor(HitResult.Miss) + 1000;
} }
protected override void OnFree(HitObject hitObject) protected override void OnFree()
{ {
base.OnFree(hitObject); base.OnFree();
IndexInCurrentComboBindable.UnbindFrom(HitObject.IndexInCurrentComboBindable); IndexInCurrentComboBindable.UnbindFrom(HitObject.IndexInCurrentComboBindable);
PositionBindable.UnbindFrom(HitObject.PositionBindable); PositionBindable.UnbindFrom(HitObject.PositionBindable);

View File

@ -86,18 +86,18 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Tracking.BindValueChanged(updateSlidingSample); Tracking.BindValueChanged(updateSlidingSample);
} }
protected override void OnApply(HitObject hitObject) protected override void OnApply()
{ {
base.OnApply(hitObject); base.OnApply();
// Ensure that the version will change after the upcoming BindTo(). // Ensure that the version will change after the upcoming BindTo().
pathVersion.Value = int.MaxValue; pathVersion.Value = int.MaxValue;
PathVersion.BindTo(HitObject.Path.Version); PathVersion.BindTo(HitObject.Path.Version);
} }
protected override void OnFree(HitObject hitObject) protected override void OnFree()
{ {
base.OnFree(hitObject); base.OnFree();
PathVersion.UnbindFrom(HitObject.Path.Version); PathVersion.UnbindFrom(HitObject.Path.Version);
} }

View File

@ -36,9 +36,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
pathVersion.BindValueChanged(_ => updatePosition()); pathVersion.BindValueChanged(_ => updatePosition());
} }
protected override void OnFree(HitObject hitObject) protected override void OnFree()
{ {
base.OnFree(hitObject); base.OnFree();
pathVersion.UnbindFrom(drawableSlider.PathVersion); pathVersion.UnbindFrom(drawableSlider.PathVersion);
} }

View File

@ -261,9 +261,9 @@ namespace osu.Game.Tests.Visual.Gameplay
}); });
} }
protected override void OnApply(HitObject hitObject) protected override void OnApply()
{ {
base.OnApply(hitObject); base.OnApply();
Position = new Vector2(RNG.Next(-200, 200), RNG.Next(-200, 200)); Position = new Vector2(RNG.Next(-200, 200), RNG.Next(-200, 200));
} }

View File

@ -260,7 +260,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
HitObject.DefaultsApplied += onDefaultsApplied; HitObject.DefaultsApplied += onDefaultsApplied;
OnApply(hitObject); OnApply();
HitObjectApplied?.Invoke(this); HitObjectApplied?.Invoke(this);
// If not loaded, the state update happens in LoadComplete(). Otherwise, the update is scheduled to allow for lifetime updates. // If not loaded, the state update happens in LoadComplete(). Otherwise, the update is scheduled to allow for lifetime updates.
@ -315,7 +315,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
HitObject.DefaultsApplied -= onDefaultsApplied; HitObject.DefaultsApplied -= onDefaultsApplied;
OnFree(HitObject); OnFree();
HitObject = null; HitObject = null;
Result = null; Result = null;
@ -340,16 +340,14 @@ namespace osu.Game.Rulesets.Objects.Drawables
/// <summary> /// <summary>
/// Invoked for this <see cref="DrawableHitObject"/> to take on any values from a newly-applied <see cref="HitObject"/>. /// Invoked for this <see cref="DrawableHitObject"/> to take on any values from a newly-applied <see cref="HitObject"/>.
/// </summary> /// </summary>
/// <param name="hitObject">The <see cref="HitObject"/> being applied.</param> protected virtual void OnApply()
protected virtual void OnApply(HitObject hitObject)
{ {
} }
/// <summary> /// <summary>
/// Invoked for this <see cref="DrawableHitObject"/> to revert any values previously taken on from the currently-applied <see cref="HitObject"/>. /// Invoked for this <see cref="DrawableHitObject"/> to revert any values previously taken on from the currently-applied <see cref="HitObject"/>.
/// </summary> /// </summary>
/// <param name="hitObject">The currently-applied <see cref="HitObject"/>.</param> protected virtual void OnFree()
protected virtual void OnFree(HitObject hitObject)
{ {
} }