1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-21 23:36:10 +08:00

Privatise the proxied content

This commit is contained in:
smoogipoo 2018-06-17 17:56:46 +09:00
parent 99ef44eca2
commit 4575319102
2 changed files with 12 additions and 7 deletions

View File

@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
public abstract class DrawableTaikoHitObject : DrawableHitObject<TaikoHitObject>, IKeyBindingHandler<TaikoAction> public abstract class DrawableTaikoHitObject : DrawableHitObject<TaikoHitObject>, IKeyBindingHandler<TaikoAction>
{ {
protected readonly Container Content; protected readonly Container Content;
public readonly Container ProxiedContent; private readonly Container proxiedContent;
private readonly Container nonProxiedContent; private readonly Container nonProxiedContent;
@ -31,12 +31,12 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Child = Content = new Container { RelativeSizeAxes = Axes.Both } Child = Content = new Container { RelativeSizeAxes = Axes.Both }
}, },
ProxiedContent = new Container { RelativeSizeAxes = Axes.Both } proxiedContent = new Container { RelativeSizeAxes = Axes.Both }
}; };
} }
/// <summary> /// <summary>
/// <see cref="ProxiedContent"/> is proxied into an upper layer. We don't want to get masked away otherwise <see cref="ProxiedContent"/> would too. /// <see cref="proxiedContent"/> is proxied into an upper layer. We don't want to get masked away otherwise <see cref="proxiedContent"/> would too.
/// </summary> /// </summary>
protected override bool ComputeIsMaskedAway(RectangleF maskingBounds) => false; protected override bool ComputeIsMaskedAway(RectangleF maskingBounds) => false;
@ -46,8 +46,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
protected void ProxyContent() protected void ProxyContent()
{ {
nonProxiedContent.Remove(Content); nonProxiedContent.Remove(Content);
ProxiedContent.Remove(Content); proxiedContent.Remove(Content);
ProxiedContent.Add(Content); proxiedContent.Add(Content);
} }
/// <summary> /// <summary>
@ -55,11 +55,16 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
/// </summary> /// </summary>
protected void UnproxyContent() protected void UnproxyContent()
{ {
ProxiedContent.Remove(Content); proxiedContent.Remove(Content);
nonProxiedContent.Remove(Content); nonProxiedContent.Remove(Content);
nonProxiedContent.Add(Content); nonProxiedContent.Add(Content);
} }
/// <summary>
/// Creates a proxy for the content of this <see cref="DrawableTaikoHitObject"/>.
/// </summary>
public Drawable CreateProxiedContent() => proxiedContent.CreateProxy();
public abstract bool OnPressed(TaikoAction action); public abstract bool OnPressed(TaikoAction action);
public virtual bool OnReleased(TaikoAction action) => false; public virtual bool OnReleased(TaikoAction action) => false;
} }

View File

@ -218,7 +218,7 @@ namespace osu.Game.Rulesets.Taiko.UI
var taikoObject = h as DrawableTaikoHitObject; var taikoObject = h as DrawableTaikoHitObject;
if (taikoObject != null) if (taikoObject != null)
topLevelHitContainer.Add(taikoObject.ProxiedContent.CreateProxy()); topLevelHitContainer.Add(taikoObject.CreateProxiedContent());
} }
internal void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) internal void OnJudgement(DrawableHitObject judgedObject, Judgement judgement)