1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 16:12:19 +08:00
osu-lazer/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyFruitPiece.cs

52 lines
1.6 KiB
C#
Raw Normal View History

2020-02-17 18:06:08 +08:00
// 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;
2020-02-17 18:06:08 +08:00
2020-12-07 11:35:24 +08:00
namespace osu.Game.Rulesets.Catch.Skinning.Legacy
2020-02-17 18:06:08 +08:00
{
2022-11-24 13:32:20 +08:00
internal partial class LegacyFruitPiece : LegacyCatchHitObjectPiece
2020-02-17 18:06:08 +08:00
{
private static readonly Vector2 fruit_max_size = new Vector2(160);
protected override void LoadComplete()
2020-02-17 18:06:08 +08:00
{
base.LoadComplete();
2020-02-17 18:06:08 +08:00
IndexInBeatmap.BindValueChanged(index =>
{
setTexture(Fruit.GetVisualRepresentation(index.NewValue));
}, true);
2020-02-17 18:06:08 +08:00
}
private void setTexture(FruitVisualRepresentation visualRepresentation)
{
switch (visualRepresentation)
{
case FruitVisualRepresentation.Pear:
2023-09-20 11:48:15 +08:00
setTextures("pear");
break;
case FruitVisualRepresentation.Grape:
2023-09-20 11:48:15 +08:00
setTextures("grapes");
break;
case FruitVisualRepresentation.Pineapple:
2023-09-20 11:48:15 +08:00
setTextures("apple");
break;
case FruitVisualRepresentation.Raspberry:
2023-09-20 11:48:15 +08:00
setTextures("orange");
break;
}
2023-09-20 11:48:15 +08:00
void setTextures(string fruitName) => SetTexture(
Skin.GetTexture($"fruit-{fruitName}")?.WithMaximumSize(fruit_max_size),
Skin.GetTexture($"fruit-{fruitName}-overlay")?.WithMaximumSize(fruit_max_size)
);
}
2020-02-17 18:06:08 +08:00
}
}