Add animation and fallback catcher support
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 130 KiB |
@ -17,6 +17,7 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
{
|
{
|
||||||
typeof(CatcherArea),
|
typeof(CatcherArea),
|
||||||
|
typeof(CatcherSprite)
|
||||||
};
|
};
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
@ -10,6 +10,7 @@ namespace osu.Game.Rulesets.Catch
|
|||||||
FruitGrapes,
|
FruitGrapes,
|
||||||
FruitOrange,
|
FruitOrange,
|
||||||
FruitPear,
|
FruitPear,
|
||||||
Droplet
|
Droplet,
|
||||||
|
CatcherIdle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,10 @@ namespace osu.Game.Rulesets.Catch.Skinning
|
|||||||
return new LegacyFruitPiece("fruit-drop") { Scale = new Vector2(0.8f) };
|
return new LegacyFruitPiece("fruit-drop") { Scale = new Vector2(0.8f) };
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CatchSkinComponents.CatcherIdle:
|
||||||
|
return this.GetAnimation("fruit-catcher-idle", true, true, true) ??
|
||||||
|
this.GetAnimation("fruit-ryuuta", true, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -155,7 +155,10 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
},
|
},
|
||||||
createCatcherSprite(),
|
createCatcherSprite().With(c =>
|
||||||
|
{
|
||||||
|
c.Anchor = Anchor.TopCentre;
|
||||||
|
})
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,12 +208,11 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
var additive = createCatcherSprite();
|
var additive = createCatcherSprite();
|
||||||
|
|
||||||
additive.Anchor = Anchor;
|
additive.Anchor = Anchor;
|
||||||
additive.OriginPosition += new Vector2(DrawWidth / 2, 0); // also temporary to align sprite correctly.
|
|
||||||
additive.Position = Position;
|
|
||||||
additive.Scale = Scale;
|
additive.Scale = Scale;
|
||||||
additive.Colour = HyperDashing ? Color4.Red : Color4.White;
|
additive.Colour = HyperDashing ? Color4.Red : Color4.White;
|
||||||
additive.RelativePositionAxes = RelativePositionAxes;
|
|
||||||
additive.Blending = BlendingParameters.Additive;
|
additive.Blending = BlendingParameters.Additive;
|
||||||
|
additive.RelativePositionAxes = RelativePositionAxes;
|
||||||
|
additive.Position = Position;
|
||||||
|
|
||||||
AdditiveTarget.Add(additive);
|
AdditiveTarget.Add(additive);
|
||||||
|
|
||||||
|
@ -3,31 +3,35 @@
|
|||||||
|
|
||||||
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.Sprites;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.UI
|
namespace osu.Game.Rulesets.Catch.UI
|
||||||
{
|
{
|
||||||
public class CatcherSprite : CompositeDrawable
|
public class CatcherSprite : SkinnableDrawable
|
||||||
{
|
{
|
||||||
|
protected override bool ApplySizeRestrictionsToDefault => true;
|
||||||
|
|
||||||
public CatcherSprite()
|
public CatcherSprite()
|
||||||
|
: base(new CatchSkinComponent(CatchSkinComponents.CatcherIdle), _ =>
|
||||||
|
new DefaultCatcherSprite(), confineMode: ConfineMode.ScaleDownToFit)
|
||||||
{
|
{
|
||||||
|
RelativeSizeAxes = Axes.None;
|
||||||
Size = new Vector2(CatcherArea.CATCHER_SIZE);
|
Size = new Vector2(CatcherArea.CATCHER_SIZE);
|
||||||
|
|
||||||
// Sets the origin roughly to the centre of the catcher's plate to allow for correct scaling.
|
// Sets the origin roughly to the centre of the catcher's plate to allow for correct scaling.
|
||||||
OriginPosition = new Vector2(-0.02f, 0.06f) * CatcherArea.CATCHER_SIZE;
|
OriginPosition = new Vector2(0.5f, 0.06f) * CatcherArea.CATCHER_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class DefaultCatcherSprite : Sprite
|
||||||
|
{
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load(TextureStore textures)
|
||||||
{
|
{
|
||||||
InternalChild = new SkinnableSprite("Gameplay/catch/fruit-catcher-idle", confineMode: ConfineMode.ScaleDownToFit)
|
Texture = textures.Get("Gameplay/catch/fruit-catcher-idle");
|
||||||
{
|
}
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Anchor = Anchor.TopCentre,
|
|
||||||
Origin = Anchor.TopCentre,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|