mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:07:52 +08:00
Merge pull request #8833 from smoogipoo/remove-obsoletes
Remove obsolete nested hitobject methods
This commit is contained in:
commit
97dcd546f1
@ -4,7 +4,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
@ -180,11 +179,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
|
||||
private void apply(HitObject hitObject)
|
||||
{
|
||||
#pragma warning disable 618 // can be removed 20200417
|
||||
if (GetType().GetMethod(nameof(AddNested), BindingFlags.NonPublic | BindingFlags.Instance)?.DeclaringType != typeof(DrawableHitObject))
|
||||
return;
|
||||
#pragma warning restore 618
|
||||
|
||||
if (nestedHitObjects.IsValueCreated)
|
||||
{
|
||||
nestedHitObjects.Value.Clear();
|
||||
@ -195,7 +189,11 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
{
|
||||
var drawableNested = CreateNestedHitObject(h) ?? throw new InvalidOperationException($"{nameof(CreateNestedHitObject)} returned null for {h.GetType().ReadableName()}.");
|
||||
|
||||
addNested(drawableNested);
|
||||
drawableNested.OnNewResult += (d, r) => OnNewResult?.Invoke(d, r);
|
||||
drawableNested.OnRevertResult += (d, r) => OnRevertResult?.Invoke(d, r);
|
||||
drawableNested.ApplyCustomUpdateState += (d, j) => ApplyCustomUpdateState?.Invoke(d, j);
|
||||
|
||||
nestedHitObjects.Value.Add(drawableNested);
|
||||
AddNestedHitObject(drawableNested);
|
||||
}
|
||||
}
|
||||
@ -208,13 +206,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a nested <see cref="DrawableHitObject"/>. This should not be used except for legacy nested <see cref="DrawableHitObject"/> usages.
|
||||
/// </summary>
|
||||
/// <param name="h"></param>
|
||||
[Obsolete("Use AddNestedHitObject() / ClearNestedHitObjects() / CreateNestedHitObject() instead.")] // can be removed 20200417
|
||||
protected virtual void AddNested(DrawableHitObject h) => addNested(h);
|
||||
|
||||
/// <summary>
|
||||
/// Invoked by the base <see cref="DrawableHitObject"/> to remove all previously-added nested <see cref="DrawableHitObject"/>s.
|
||||
/// </summary>
|
||||
@ -229,17 +220,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
/// <returns>The drawable representation for <paramref name="hitObject"/>.</returns>
|
||||
protected virtual DrawableHitObject CreateNestedHitObject(HitObject hitObject) => null;
|
||||
|
||||
private void addNested(DrawableHitObject hitObject)
|
||||
{
|
||||
// Todo: Exists for legacy purposes, can be removed 20200417
|
||||
|
||||
hitObject.OnNewResult += (d, r) => OnNewResult?.Invoke(d, r);
|
||||
hitObject.OnRevertResult += (d, r) => OnRevertResult?.Invoke(d, r);
|
||||
hitObject.ApplyCustomUpdateState += (d, j) => ApplyCustomUpdateState?.Invoke(d, j);
|
||||
|
||||
nestedHitObjects.Value.Add(hitObject);
|
||||
}
|
||||
|
||||
#region State / Transform Management
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user