mirror of
https://github.com/ppy/osu.git
synced 2024-11-14 16:37:26 +08:00
52 lines
1.6 KiB
C#
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)
|
|
);
|
|
}
|
|
}
|
|
}
|