Add droplet skinning support

This commit is contained in:
Dean Herbert 2020-02-19 13:27:15 +09:00
parent 0f85e81240
commit ce1a57550f
4 changed files with 32 additions and 5 deletions

View File

@ -10,5 +10,6 @@ public enum CatchSkinComponents
FruitGrapes,
FruitOrange,
FruitPear,
Droplet
}
}

View File

@ -3,8 +3,11 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces;
using osu.Game.Skinning;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Catch.Objects.Drawable
{
@ -16,18 +19,35 @@ public DrawableDroplet(Droplet h)
: base(h)
{
Origin = Anchor.Centre;
Size = new Vector2(CatchHitObject.OBJECT_RADIUS) / 4;
Size = new Vector2(CatchHitObject.OBJECT_RADIUS * 2) / 4;
Masking = false;
}
private Container scaleContainer;
[BackgroundDependencyLoader]
private void load()
{
AddInternal(new Pulp
AddRangeInternal(new Framework.Graphics.Drawable[]
{
Size = Size,
AccentColour = { BindTarget = AccentColour }
scaleContainer = new Container
{
RelativeSizeAxes = Axes.Both,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Children = new Framework.Graphics.Drawable[]
{
new SkinnableDrawable(
new CatchSkinComponent(CatchSkinComponents.Droplet), _ => new Pulp
{
Size = Size,
AccentColour = { Value = Color4.White }
})
}
}
});
scaleContainer.Scale = new Vector2(HitObject.Scale);
}
}
}

View File

@ -10,7 +10,7 @@ public class DrawableTinyDroplet : DrawableDroplet
public DrawableTinyDroplet(TinyDroplet h)
: base(h)
{
Size = new Vector2(CatchHitObject.OBJECT_RADIUS / 8);
Size = new Vector2(CatchHitObject.OBJECT_RADIUS * 2) / 8;
}
}
}

View File

@ -37,6 +37,12 @@ public Drawable GetDrawableComponent(ISkinComponent component)
return new LegacyFruitPiece(lookupName);
break;
case CatchSkinComponents.Droplet:
if (GetTexture("fruit-drop") != null)
return new LegacyFruitPiece("fruit-drop");
break;
}
return null;