1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 16:22:57 +08:00
osu-lazer/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyFruitPiece.cs
2023-09-20 12:48:15 +09:00

52 lines
1.6 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;
using osu.Game.Skinning;
using osuTK;
namespace osu.Game.Rulesets.Catch.Skinning.Legacy
{
internal partial class LegacyFruitPiece : LegacyCatchHitObjectPiece
{
private static readonly Vector2 fruit_max_size = new Vector2(128);
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:
setTextures("pear");
break;
case FruitVisualRepresentation.Grape:
setTextures("grapes");
break;
case FruitVisualRepresentation.Pineapple:
setTextures("apple");
break;
case FruitVisualRepresentation.Raspberry:
setTextures("orange");
break;
}
void setTextures(string fruitName) => SetTexture(
Skin.GetTexture($"fruit-{fruitName}")?.WithMaximumSize(fruit_max_size),
Skin.GetTexture($"fruit-{fruitName}-overlay")?.WithMaximumSize(fruit_max_size)
);
}
}
}