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 @@ namespace osu.Game.Rulesets.Catch
FruitGrapes, FruitGrapes,
FruitOrange, FruitOrange,
FruitPear, FruitPear,
Droplet
} }
} }

View File

@ -3,8 +3,11 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces; using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces;
using osu.Game.Skinning;
using osuTK; using osuTK;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Catch.Objects.Drawable namespace osu.Game.Rulesets.Catch.Objects.Drawable
{ {
@ -16,18 +19,35 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
: base(h) : base(h)
{ {
Origin = Anchor.Centre; Origin = Anchor.Centre;
Size = new Vector2(CatchHitObject.OBJECT_RADIUS) / 4; Size = new Vector2(CatchHitObject.OBJECT_RADIUS * 2) / 4;
Masking = false; Masking = false;
} }
private Container scaleContainer;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
AddInternal(new Pulp AddRangeInternal(new Framework.Graphics.Drawable[]
{ {
Size = Size, scaleContainer = new Container
AccentColour = { BindTarget = AccentColour } {
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 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
public DrawableTinyDroplet(TinyDroplet h) public DrawableTinyDroplet(TinyDroplet h)
: base(h) : base(h)
{ {
Size = new Vector2(CatchHitObject.OBJECT_RADIUS / 8); Size = new Vector2(CatchHitObject.OBJECT_RADIUS * 2) / 8;
} }
} }
} }

View File

@ -37,6 +37,12 @@ namespace osu.Game.Rulesets.Catch.Skinning
return new LegacyFruitPiece(lookupName); return new LegacyFruitPiece(lookupName);
break; break;
case CatchSkinComponents.Droplet:
if (GetTexture("fruit-drop") != null)
return new LegacyFruitPiece("fruit-drop");
break;
} }
return null; return null;