2020-02-17 10:06:08 +00: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.
|
|
|
|
|
2021-06-07 04:59:17 +00:00
|
|
|
using osu.Game.Rulesets.Catch.Objects;
|
2023-09-19 00:17:07 +00:00
|
|
|
using osu.Game.Skinning;
|
2023-09-02 23:22:41 +00:00
|
|
|
using osuTK;
|
2020-02-17 10:06:08 +00:00
|
|
|
|
2020-12-07 03:35:24 +00:00
|
|
|
namespace osu.Game.Rulesets.Catch.Skinning.Legacy
|
2020-02-17 10:06:08 +00:00
|
|
|
{
|
2020-12-07 03:57:24 +00:00
|
|
|
internal partial class LegacyFruitPiece : LegacyCatchHitObjectPiece
|
2020-02-17 10:06:08 +00:00
|
|
|
{
|
2023-10-05 18:37:10 +00:00
|
|
|
private static readonly Vector2 fruit_max_size = new Vector2(160);
|
2023-09-02 23:22:41 +00:00
|
|
|
|
2020-12-07 03:57:24 +00:00
|
|
|
protected override void LoadComplete()
|
2020-02-17 10:06:08 +00:00
|
|
|
{
|
2020-12-07 03:57:24 +00:00
|
|
|
base.LoadComplete();
|
2020-02-17 10:06:08 +00:00
|
|
|
|
2021-06-07 05:49:37 +00:00
|
|
|
IndexInBeatmap.BindValueChanged(index =>
|
|
|
|
{
|
|
|
|
setTexture(Fruit.GetVisualRepresentation(index.NewValue));
|
|
|
|
}, true);
|
2020-02-17 10:06:08 +00:00
|
|
|
}
|
2020-02-19 02:23:45 +00:00
|
|
|
|
2020-12-07 03:57:24 +00:00
|
|
|
private void setTexture(FruitVisualRepresentation visualRepresentation)
|
2020-02-19 02:23:45 +00:00
|
|
|
{
|
2020-12-08 07:59:06 +00:00
|
|
|
switch (visualRepresentation)
|
|
|
|
{
|
|
|
|
case FruitVisualRepresentation.Pear:
|
2023-09-20 03:48:15 +00:00
|
|
|
setTextures("pear");
|
2020-12-08 07:59:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FruitVisualRepresentation.Grape:
|
2023-09-20 03:48:15 +00:00
|
|
|
setTextures("grapes");
|
2020-12-08 07:59:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FruitVisualRepresentation.Pineapple:
|
2023-09-20 03:48:15 +00:00
|
|
|
setTextures("apple");
|
2020-12-08 07:59:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FruitVisualRepresentation.Raspberry:
|
2023-09-20 03:48:15 +00:00
|
|
|
setTextures("orange");
|
2020-12-08 07:59:06 +00:00
|
|
|
break;
|
|
|
|
}
|
2023-09-20 03:48:15 +00: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-19 02:23:45 +00:00
|
|
|
}
|
2020-02-17 10:06:08 +00:00
|
|
|
}
|
|
|
|
}
|