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.Framework.Bindables;
|
2020-02-19 17:01:59 +08:00
|
|
|
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
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
|
|
|
{
|
2020-12-07 11:57:24 +08:00
|
|
|
internal class LegacyFruitPiece : LegacyCatchHitObjectPiece
|
2020-02-17 18:06:08 +08:00
|
|
|
{
|
2020-12-07 11:57:24 +08:00
|
|
|
public readonly Bindable<FruitVisualRepresentation> VisualRepresentation = new Bindable<FruitVisualRepresentation>();
|
2020-02-17 18:06:08 +08:00
|
|
|
|
2020-12-07 11:57:24 +08:00
|
|
|
protected override void LoadComplete()
|
2020-02-17 18:06:08 +08:00
|
|
|
{
|
2020-12-07 11:57:24 +08:00
|
|
|
base.LoadComplete();
|
2020-02-17 18:06:08 +08:00
|
|
|
|
2020-12-07 11:57:24 +08:00
|
|
|
var fruit = (DrawableFruit)DrawableHitObject;
|
2020-02-26 18:22:46 +08:00
|
|
|
|
2020-12-07 11:57:24 +08:00
|
|
|
if (fruit != null)
|
|
|
|
VisualRepresentation.BindTo(fruit.VisualRepresentation);
|
2020-02-26 18:22:46 +08:00
|
|
|
|
2020-12-07 11:57:24 +08:00
|
|
|
VisualRepresentation.BindValueChanged(visual => setTexture(visual.NewValue), true);
|
2020-02-17 18:06:08 +08:00
|
|
|
}
|
2020-02-19 10:23:45 +08:00
|
|
|
|
2020-12-07 11:57:24 +08:00
|
|
|
private void setTexture(FruitVisualRepresentation visualRepresentation)
|
2020-02-19 10:23:45 +08:00
|
|
|
{
|
2020-12-08 15:59:06 +08:00
|
|
|
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;
|
|
|
|
}
|
2020-02-19 10:23:45 +08:00
|
|
|
}
|
2020-02-17 18:06:08 +08:00
|
|
|
}
|
|
|
|
}
|