mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 17:37:23 +09:00
Simplify process of adding catcher trails
This commit is contained in:
parent
a82efa626e
commit
ee62739b08
@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
|
|
||||||
public Container ExplodingFruitTarget;
|
public Container ExplodingFruitTarget;
|
||||||
|
|
||||||
private Container additiveTarget;
|
private readonly Container additiveTarget;
|
||||||
private Container<CatcherTrailSprite> dashTrails;
|
private Container<CatcherTrailSprite> dashTrails;
|
||||||
private Container<CatcherTrailSprite> hyperDashTrails;
|
private Container<CatcherTrailSprite> hyperDashTrails;
|
||||||
private Container<CatcherTrailSprite> endGlowSprites;
|
private Container<CatcherTrailSprite> endGlowSprites;
|
||||||
@ -116,8 +116,10 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
private int hyperDashDirection;
|
private int hyperDashDirection;
|
||||||
private float hyperDashTargetPosition;
|
private float hyperDashTargetPosition;
|
||||||
|
|
||||||
public Catcher(BeatmapDifficulty difficulty = null)
|
public Catcher(BeatmapDifficulty difficulty = null, Container additiveTarget = null)
|
||||||
{
|
{
|
||||||
|
this.additiveTarget = additiveTarget;
|
||||||
|
|
||||||
RelativePositionAxes = Axes.X;
|
RelativePositionAxes = Axes.X;
|
||||||
X = 0.5f;
|
X = 0.5f;
|
||||||
|
|
||||||
@ -155,27 +157,14 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
updateCatcher();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sets container target to provide catcher additive trails content in.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="target">The container to add catcher trails in.</param>
|
|
||||||
public void SetAdditiveTarget(Container target)
|
|
||||||
{
|
|
||||||
if (additiveTarget == target)
|
|
||||||
return;
|
|
||||||
|
|
||||||
additiveTarget?.RemoveRange(new[] { dashTrails, hyperDashTrails, endGlowSprites });
|
|
||||||
|
|
||||||
additiveTarget = target;
|
|
||||||
additiveTarget?.AddRange(new[]
|
additiveTarget?.AddRange(new[]
|
||||||
{
|
{
|
||||||
dashTrails ??= new Container<CatcherTrailSprite> { RelativeSizeAxes = Axes.Both, Colour = Color4.White },
|
dashTrails = new Container<CatcherTrailSprite> { RelativeSizeAxes = Axes.Both, Colour = Color4.White },
|
||||||
hyperDashTrails ??= new Container<CatcherTrailSprite> { RelativeSizeAxes = Axes.Both, Colour = hyperDashColour },
|
hyperDashTrails = new Container<CatcherTrailSprite> { RelativeSizeAxes = Axes.Both, Colour = hyperDashColour },
|
||||||
endGlowSprites ??= new Container<CatcherTrailSprite> { RelativeSizeAxes = Axes.Both, Colour = hyperDashEndGlowColour },
|
endGlowSprites = new Container<CatcherTrailSprite> { RelativeSizeAxes = Axes.Both, Colour = hyperDashEndGlowColour }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
updateCatcher();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -33,9 +33,7 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Height = CATCHER_SIZE;
|
Height = CATCHER_SIZE;
|
||||||
|
Child = MovableCatcher = new Catcher(difficulty, this);
|
||||||
Child = MovableCatcher = new Catcher(difficulty);
|
|
||||||
MovableCatcher.SetAdditiveTarget(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float GetCatcherSize(BeatmapDifficulty difficulty)
|
public static float GetCatcherSize(BeatmapDifficulty difficulty)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user