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

Move proxy state check to base class

This commit is contained in:
Dean Herbert 2018-06-18 00:27:18 +09:00
parent 479eac8aa8
commit 5b344525e1
2 changed files with 11 additions and 8 deletions

View File

@ -34,7 +34,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
/// </summary>
private int userHits;
private bool hasProxied;
private readonly SwellSymbolPiece symbol;
public DrawableSwell(Swell swell)
@ -172,7 +171,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
switch (state)
{
case ArmedState.Idle:
hasProxied = false;
UnproxyContent();
break;
case ArmedState.Hit:
@ -193,11 +191,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
X = Math.Max(0, X);
double t = Math.Min(HitObject.StartTime, Time.Current);
if (t == HitObject.StartTime && !hasProxied)
{
if (t == HitObject.StartTime)
ProxyContent();
hasProxied = true;
}
}
private bool? lastWasCentre;

View File

@ -40,23 +40,31 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
/// </summary>
protected override bool ComputeIsMaskedAway(RectangleF maskingBounds) => false;
private bool isProxied;
/// <summary>
/// Moves <see cref="Content"/> to a layer proxied above the playfield.
/// Does nothing is content is already proxied.
/// </summary>
protected void ProxyContent()
{
if (isProxied) return;
isProxied = true;
nonProxiedContent.Remove(Content);
proxiedContent.Remove(Content);
proxiedContent.Add(Content);
}
/// <summary>
/// Moves <see cref="Content"/> to the normal hitobject layer.
/// Does nothing is content is not currently proxied.
/// </summary>
protected void UnproxyContent()
{
if (!isProxied) return;
isProxied = false;
proxiedContent.Remove(Content);
nonProxiedContent.Remove(Content);
nonProxiedContent.Add(Content);
}