mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 20:32:55 +08:00
Fix slider parts not reproxying after first hitobject freed
This commit is contained in:
parent
738ce0f689
commit
79438c19a4
@ -187,7 +187,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
repeatContainer.Clear(false);
|
repeatContainer.Clear(false);
|
||||||
tickContainer.Clear(false);
|
tickContainer.Clear(false);
|
||||||
|
|
||||||
OverlayElementContainer.Clear();
|
OverlayElementContainer.Clear(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override DrawableHitObject CreateNestedHitObject(HitObject hitObject)
|
protected override DrawableHitObject CreateNestedHitObject(HitObject hitObject)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Diagnostics;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -17,12 +18,14 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
[Resolved(canBeNull: true)]
|
[Resolved(canBeNull: true)]
|
||||||
private DrawableHitObject drawableHitObject { get; set; }
|
private DrawableHitObject drawableHitObject { get; set; }
|
||||||
|
|
||||||
|
private Drawable proxy;
|
||||||
|
|
||||||
public LegacyReverseArrow(ISkin skin)
|
public LegacyReverseArrow(ISkin skin)
|
||||||
{
|
{
|
||||||
this.skin = skin;
|
this.skin = skin;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
@ -36,9 +39,29 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
|
proxy = CreateProxy();
|
||||||
|
|
||||||
|
if (drawableHitObject != null)
|
||||||
|
{
|
||||||
|
drawableHitObject.HitObjectApplied += onHitObjectApplied;
|
||||||
|
onHitObjectApplied(drawableHitObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onHitObjectApplied(DrawableHitObject drawableObject)
|
||||||
|
{
|
||||||
|
Debug.Assert(proxy.Parent == null);
|
||||||
|
|
||||||
// see logic in LegacySliderHeadHitCircle.
|
// see logic in LegacySliderHeadHitCircle.
|
||||||
(drawableHitObject as DrawableSliderRepeat)?.DrawableSlider
|
(drawableObject as DrawableSliderRepeat)?.DrawableSlider
|
||||||
.OverlayElementContainer.Add(CreateProxy());
|
.OverlayElementContainer.Add(proxy);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
if (drawableHitObject != null)
|
||||||
|
drawableHitObject.HitObjectApplied -= onHitObjectApplied;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Diagnostics;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
@ -13,6 +14,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
[Resolved(canBeNull: true)]
|
[Resolved(canBeNull: true)]
|
||||||
private DrawableHitObject drawableHitObject { get; set; }
|
private DrawableHitObject drawableHitObject { get; set; }
|
||||||
|
|
||||||
|
private Drawable proxiedHitCircleOverlay;
|
||||||
|
|
||||||
public LegacySliderHeadHitCircle()
|
public LegacySliderHeadHitCircle()
|
||||||
: base("sliderstartcircle")
|
: base("sliderstartcircle")
|
||||||
{
|
{
|
||||||
@ -21,10 +24,30 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
proxiedHitCircleOverlay = HitCircleOverlay.CreateProxy();
|
||||||
|
|
||||||
|
if (drawableHitObject != null)
|
||||||
|
{
|
||||||
|
drawableHitObject.HitObjectApplied += onHitObjectApplied;
|
||||||
|
onHitObjectApplied(drawableHitObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onHitObjectApplied(DrawableHitObject drawableObject)
|
||||||
|
{
|
||||||
|
Debug.Assert(proxiedHitCircleOverlay.Parent == null);
|
||||||
|
|
||||||
// see logic in LegacyReverseArrow.
|
// see logic in LegacyReverseArrow.
|
||||||
(drawableHitObject as DrawableSliderHead)?.DrawableSlider
|
(drawableObject as DrawableSliderHead)?.DrawableSlider
|
||||||
.OverlayElementContainer.Add(HitCircleOverlay.CreateProxy().With(d => d.Depth = float.MinValue));
|
.OverlayElementContainer.Add(proxiedHitCircleOverlay.With(d => d.Depth = float.MinValue));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
|
if (drawableHitObject != null)
|
||||||
|
drawableHitObject.HitObjectApplied -= onHitObjectApplied;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user