mirror of
https://github.com/ppy/osu
synced 2025-02-27 16:11:43 +00:00
54 lines
1.7 KiB
C#
54 lines
1.7 KiB
C#
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||
|
// See the LICENCE file in the repository root for full licence text.
|
||
|
|
||
|
using osu.Framework.Allocation;
|
||
|
using osu.Framework.Bindables;
|
||
|
using osu.Framework.Graphics;
|
||
|
using osu.Framework.Graphics.Containers;
|
||
|
using osu.Framework.Graphics.Sprites;
|
||
|
using osu.Game.Rulesets.Catch.Objects.Drawable;
|
||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||
|
using osu.Game.Skinning;
|
||
|
using osuTK.Graphics;
|
||
|
|
||
|
namespace osu.Game.Rulesets.Catch.Skinning
|
||
|
{
|
||
|
internal class LegacyFruitPiece : CompositeDrawable
|
||
|
{
|
||
|
private readonly string lookupName;
|
||
|
|
||
|
private readonly IBindable<Color4> accentColour = new Bindable<Color4>();
|
||
|
|
||
|
public LegacyFruitPiece(string lookupName)
|
||
|
{
|
||
|
this.lookupName = lookupName;
|
||
|
RelativeSizeAxes = Axes.Both;
|
||
|
}
|
||
|
|
||
|
[BackgroundDependencyLoader]
|
||
|
private void load(DrawableHitObject drawableObject, ISkinSource skin)
|
||
|
{
|
||
|
DrawableCatchHitObject drawableCatchObject = (DrawableCatchHitObject)drawableObject;
|
||
|
|
||
|
accentColour.BindTo(drawableCatchObject.AccentColour);
|
||
|
|
||
|
InternalChildren = new Drawable[]
|
||
|
{
|
||
|
new Sprite
|
||
|
{
|
||
|
Texture = skin.GetTexture(lookupName),
|
||
|
Colour = drawableObject.AccentColour.Value,
|
||
|
Anchor = Anchor.Centre,
|
||
|
Origin = Anchor.Centre,
|
||
|
},
|
||
|
new Sprite
|
||
|
{
|
||
|
Texture = skin.GetTexture($"{lookupName}-overlay"),
|
||
|
Anchor = Anchor.Centre,
|
||
|
Origin = Anchor.Centre,
|
||
|
},
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
}
|