Use common skinnable catcher in catcher trails

This commit is contained in:
ekrctb 2021-06-14 19:45:58 +09:00
parent ca061c4b93
commit 9b6ab4360e
2 changed files with 7 additions and 15 deletions

View File

@ -120,8 +120,8 @@ namespace osu.Game.Rulesets.Catch.UI
{ {
CatcherTrailSprite sprite = trailPool.Get(); CatcherTrailSprite sprite = trailPool.Get();
sprite.Texture = catcher.CurrentTexture; sprite.AnimationState = catcher.CurrentState;
sprite.Anchor = catcher.Anchor; sprite.Origin = catcher.Origin;
sprite.Scale = catcher.Scale; sprite.Scale = catcher.Scale;
sprite.Blending = BlendingParameters.Additive; sprite.Blending = BlendingParameters.Additive;
sprite.RelativePositionAxes = catcher.RelativePositionAxes; sprite.RelativePositionAxes = catcher.RelativePositionAxes;

View File

@ -3,32 +3,24 @@
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Pooling; using osu.Framework.Graphics.Pooling;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osuTK; using osuTK;
namespace osu.Game.Rulesets.Catch.UI namespace osu.Game.Rulesets.Catch.UI
{ {
public class CatcherTrailSprite : PoolableDrawable public class CatcherTrailSprite : PoolableDrawable
{ {
public Texture Texture public CatcherAnimationState AnimationState
{ {
set => sprite.Texture = value; set => body.AnimationState.Value = value;
} }
private readonly Sprite sprite; private readonly SkinnableCatcher body;
public CatcherTrailSprite() public CatcherTrailSprite()
{ {
InternalChild = sprite = new Sprite
{
RelativeSizeAxes = Axes.Both
};
Size = new Vector2(CatcherArea.CATCHER_SIZE); Size = new Vector2(CatcherArea.CATCHER_SIZE);
Origin = Anchor.TopCentre;
// Sets the origin roughly to the centre of the catcher's plate to allow for correct scaling. InternalChild = body = new SkinnableCatcher();
OriginPosition = new Vector2(0.5f, 0.06f) * CatcherArea.CATCHER_SIZE;
} }
protected override void FreeAfterUse() protected override void FreeAfterUse()