1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-24 04:03:02 +08:00
osu-lazer/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyFruitPiece.cs
ekrctb ac5c55bd2c Remove "fruit visual representation" state from DrawableFruit
Instead, skin pieces compute visual representation from `IndexInBeatmap`.
2021-06-07 14:49:37 +09:00

43 lines
1.5 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.Game.Rulesets.Catch.Objects;
namespace osu.Game.Rulesets.Catch.Skinning.Legacy
{
internal class LegacyFruitPiece : LegacyCatchHitObjectPiece
{
protected override void LoadComplete()
{
base.LoadComplete();
IndexInBeatmap.BindValueChanged(index =>
{
setTexture(Fruit.GetVisualRepresentation(index.NewValue));
}, true);
}
private void setTexture(FruitVisualRepresentation visualRepresentation)
{
switch (visualRepresentation)
{
case FruitVisualRepresentation.Pear:
SetTexture(Skin.GetTexture("fruit-pear"), Skin.GetTexture("fruit-pear-overlay"));
break;
case FruitVisualRepresentation.Grape:
SetTexture(Skin.GetTexture("fruit-grapes"), Skin.GetTexture("fruit-grapes-overlay"));
break;
case FruitVisualRepresentation.Pineapple:
SetTexture(Skin.GetTexture("fruit-apple"), Skin.GetTexture("fruit-apple-overlay"));
break;
case FruitVisualRepresentation.Raspberry:
SetTexture(Skin.GetTexture("fruit-orange"), Skin.GetTexture("fruit-orange-overlay"));
break;
}
}
}
}