mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 18:23:04 +08:00
Merge pull request #11110 from ekrctb/fruit-piece-in-place
Implement in-place update of catch DrawableHitObject
This commit is contained in:
commit
0739f09930
@ -5,11 +5,8 @@ namespace osu.Game.Rulesets.Catch
|
|||||||
{
|
{
|
||||||
public enum CatchSkinComponents
|
public enum CatchSkinComponents
|
||||||
{
|
{
|
||||||
FruitBananas,
|
Fruit,
|
||||||
FruitApple,
|
Banana,
|
||||||
FruitGrapes,
|
|
||||||
FruitOrange,
|
|
||||||
FruitPear,
|
|
||||||
Droplet,
|
Droplet,
|
||||||
CatcherIdle,
|
CatcherIdle,
|
||||||
CatcherFail,
|
CatcherFail,
|
||||||
|
@ -14,7 +14,7 @@ using osuTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Objects
|
namespace osu.Game.Rulesets.Catch.Objects
|
||||||
{
|
{
|
||||||
public class Banana : Fruit, IHasComboInformation
|
public class Banana : PalpableCatchHitObject, IHasComboInformation
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Index of banana in current shower.
|
/// Index of banana in current shower.
|
||||||
|
@ -2,14 +2,15 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Rulesets.Catch.Skinning.Default;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||||
{
|
{
|
||||||
public class DrawableBanana : DrawableFruit
|
public class DrawableBanana : DrawablePalpableCatchHitObject
|
||||||
{
|
{
|
||||||
protected override FruitVisualRepresentation GetVisualRepresentation(int indexInBeatmap) => FruitVisualRepresentation.Banana;
|
|
||||||
|
|
||||||
public DrawableBanana()
|
public DrawableBanana()
|
||||||
: this(null)
|
: this(null)
|
||||||
{
|
{
|
||||||
@ -20,6 +21,14 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
ScaleContainer.Child = new SkinnableDrawable(
|
||||||
|
new CatchSkinComponent(CatchSkinComponents.Banana),
|
||||||
|
_ => new BananaPiece());
|
||||||
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
@ -25,18 +25,10 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
|
||||||
HyperDash.BindValueChanged(_ => updatePiece(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updatePiece()
|
|
||||||
{
|
{
|
||||||
ScaleContainer.Child = new SkinnableDrawable(
|
ScaleContainer.Child = new SkinnableDrawable(
|
||||||
new CatchSkinComponent(CatchSkinComponents.Droplet),
|
new CatchSkinComponent(CatchSkinComponents.Droplet),
|
||||||
_ => new DropletPiece
|
_ => new DropletPiece());
|
||||||
{
|
|
||||||
HyperDash = { BindTarget = HyperDash }
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateInitialTransforms()
|
protected override void UpdateInitialTransforms()
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
@ -15,8 +14,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
{
|
{
|
||||||
public readonly Bindable<FruitVisualRepresentation> VisualRepresentation = new Bindable<FruitVisualRepresentation>();
|
public readonly Bindable<FruitVisualRepresentation> VisualRepresentation = new Bindable<FruitVisualRepresentation>();
|
||||||
|
|
||||||
protected virtual FruitVisualRepresentation GetVisualRepresentation(int indexInBeatmap) => (FruitVisualRepresentation)(indexInBeatmap % 4);
|
|
||||||
|
|
||||||
public DrawableFruit()
|
public DrawableFruit()
|
||||||
: this(null)
|
: this(null)
|
||||||
{
|
{
|
||||||
@ -32,11 +29,12 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
{
|
{
|
||||||
IndexInBeatmap.BindValueChanged(change =>
|
IndexInBeatmap.BindValueChanged(change =>
|
||||||
{
|
{
|
||||||
VisualRepresentation.Value = GetVisualRepresentation(change.NewValue);
|
VisualRepresentation.Value = (FruitVisualRepresentation)(change.NewValue % 4);
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
VisualRepresentation.BindValueChanged(_ => updatePiece());
|
ScaleContainer.Child = new SkinnableDrawable(
|
||||||
HyperDash.BindValueChanged(_ => updatePiece(), true);
|
new CatchSkinComponent(CatchSkinComponents.Fruit),
|
||||||
|
_ => new FruitPiece());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateInitialTransforms()
|
protected override void UpdateInitialTransforms()
|
||||||
@ -45,41 +43,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
|
|
||||||
ScaleContainer.RotateTo((RandomSingle(1) - 0.5f) * 40);
|
ScaleContainer.RotateTo((RandomSingle(1) - 0.5f) * 40);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePiece()
|
|
||||||
{
|
|
||||||
ScaleContainer.Child = new SkinnableDrawable(
|
|
||||||
new CatchSkinComponent(getComponent(VisualRepresentation.Value)),
|
|
||||||
_ => new FruitPiece
|
|
||||||
{
|
|
||||||
VisualRepresentation = { BindTarget = VisualRepresentation },
|
|
||||||
HyperDash = { BindTarget = HyperDash },
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private CatchSkinComponents getComponent(FruitVisualRepresentation hitObjectVisualRepresentation)
|
|
||||||
{
|
|
||||||
switch (hitObjectVisualRepresentation)
|
|
||||||
{
|
|
||||||
case FruitVisualRepresentation.Pear:
|
|
||||||
return CatchSkinComponents.FruitPear;
|
|
||||||
|
|
||||||
case FruitVisualRepresentation.Grape:
|
|
||||||
return CatchSkinComponents.FruitGrapes;
|
|
||||||
|
|
||||||
case FruitVisualRepresentation.Pineapple:
|
|
||||||
return CatchSkinComponents.FruitApple;
|
|
||||||
|
|
||||||
case FruitVisualRepresentation.Raspberry:
|
|
||||||
return CatchSkinComponents.FruitOrange;
|
|
||||||
|
|
||||||
case FruitVisualRepresentation.Banana:
|
|
||||||
return CatchSkinComponents.FruitBananas;
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new ArgumentOutOfRangeException(nameof(hitObjectVisualRepresentation), hitObjectVisualRepresentation, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum FruitVisualRepresentation
|
public enum FruitVisualRepresentation
|
||||||
@ -88,6 +51,5 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
Grape,
|
Grape,
|
||||||
Pineapple,
|
Pineapple,
|
||||||
Raspberry,
|
Raspberry,
|
||||||
Banana // banananananannaanana
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,28 +2,24 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Skinning.Default
|
namespace osu.Game.Rulesets.Catch.Skinning.Default
|
||||||
{
|
{
|
||||||
public class BananaPiece : PulpFormation
|
public class BananaPiece : CatchHitObjectPiece
|
||||||
{
|
{
|
||||||
|
protected override BorderPiece BorderPiece { get; }
|
||||||
|
|
||||||
public BananaPiece()
|
public BananaPiece()
|
||||||
{
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new Pulp
|
new BananaPulpFormation
|
||||||
{
|
{
|
||||||
AccentColour = { BindTarget = AccentColour },
|
AccentColour = { BindTarget = AccentColour },
|
||||||
Size = new Vector2(SMALL_PULP),
|
|
||||||
Y = -0.3f
|
|
||||||
},
|
|
||||||
new Pulp
|
|
||||||
{
|
|
||||||
AccentColour = { BindTarget = AccentColour },
|
|
||||||
Size = new Vector2(LARGE_PULP_4 * 0.8f, LARGE_PULP_4 * 2.5f),
|
|
||||||
Y = 0.05f,
|
|
||||||
},
|
},
|
||||||
|
BorderPiece = new BorderPiece(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
// 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 osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Catch.Skinning.Default
|
||||||
|
{
|
||||||
|
public class BananaPulpFormation : PulpFormation
|
||||||
|
{
|
||||||
|
public BananaPulpFormation()
|
||||||
|
{
|
||||||
|
AddPulp(new Vector2(0, -0.3f), new Vector2(SMALL_PULP));
|
||||||
|
AddPulp(new Vector2(0, 0.05f), new Vector2(LARGE_PULP_4 * 0.8f, LARGE_PULP_4 * 2.5f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
// 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 System;
|
||||||
|
using JetBrains.Annotations;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Catch.Skinning.Default
|
||||||
|
{
|
||||||
|
public abstract class CatchHitObjectPiece : CompositeDrawable
|
||||||
|
{
|
||||||
|
public readonly Bindable<Color4> AccentColour = new Bindable<Color4>();
|
||||||
|
public readonly Bindable<bool> HyperDash = new Bindable<bool>();
|
||||||
|
|
||||||
|
[Resolved(canBeNull: true)]
|
||||||
|
[CanBeNull]
|
||||||
|
protected DrawableHitObject DrawableHitObject { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A part of this piece that will be faded out while falling in the playfield.
|
||||||
|
/// </summary>
|
||||||
|
[CanBeNull]
|
||||||
|
protected virtual BorderPiece BorderPiece => null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A part of this piece that will be only visible when <see cref="HyperDash"/> is true.
|
||||||
|
/// </summary>
|
||||||
|
[CanBeNull]
|
||||||
|
protected virtual HyperBorderPiece HyperBorderPiece => null;
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
var hitObject = (DrawablePalpableCatchHitObject)DrawableHitObject;
|
||||||
|
|
||||||
|
if (hitObject != null)
|
||||||
|
{
|
||||||
|
AccentColour.BindTo(hitObject.AccentColour);
|
||||||
|
HyperDash.BindTo(hitObject.HyperDash);
|
||||||
|
}
|
||||||
|
|
||||||
|
HyperDash.BindValueChanged(hyper =>
|
||||||
|
{
|
||||||
|
if (HyperBorderPiece != null)
|
||||||
|
HyperBorderPiece.Alpha = hyper.NewValue ? 1 : 0;
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
if (BorderPiece != null && DrawableHitObject?.HitObject != null)
|
||||||
|
BorderPiece.Alpha = (float)Math.Clamp((DrawableHitObject.HitObject.StartTime - Time.Current) / 500, 0, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,38 +1,29 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Bindables;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Game.Rulesets.Catch.Objects;
|
using osu.Game.Rulesets.Catch.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Skinning.Default
|
namespace osu.Game.Rulesets.Catch.Skinning.Default
|
||||||
{
|
{
|
||||||
public class DropletPiece : CompositeDrawable
|
public class DropletPiece : CatchHitObjectPiece
|
||||||
{
|
{
|
||||||
public readonly Bindable<bool> HyperDash = new Bindable<bool>();
|
protected override HyperBorderPiece HyperBorderPiece { get; }
|
||||||
|
|
||||||
public DropletPiece()
|
public DropletPiece()
|
||||||
{
|
{
|
||||||
Size = new Vector2(CatchHitObject.OBJECT_RADIUS / 2);
|
Size = new Vector2(CatchHitObject.OBJECT_RADIUS / 2);
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
InternalChildren = new Drawable[]
|
||||||
private void load(DrawableHitObject drawableObject)
|
|
||||||
{
|
|
||||||
InternalChild = new Pulp
|
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
new Pulp
|
||||||
AccentColour = { BindTarget = drawableObject.AccentColour }
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
AccentColour = { BindTarget = AccentColour }
|
||||||
|
},
|
||||||
|
HyperBorderPiece = new HyperDropletBorderPiece()
|
||||||
};
|
};
|
||||||
|
|
||||||
if (HyperDash.Value)
|
|
||||||
{
|
|
||||||
AddInternal(new HyperDropletBorderPiece());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,13 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
|
||||||
using JetBrains.Annotations;
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Skinning.Default
|
namespace osu.Game.Rulesets.Catch.Skinning.Default
|
||||||
{
|
{
|
||||||
internal class FruitPiece : CompositeDrawable
|
internal class FruitPiece : CatchHitObjectPiece
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Because we're adding a border around the fruit, we need to scale down some.
|
/// Because we're adding a border around the fruit, we need to scale down some.
|
||||||
@ -20,61 +15,34 @@ namespace osu.Game.Rulesets.Catch.Skinning.Default
|
|||||||
public const float RADIUS_ADJUST = 1.1f;
|
public const float RADIUS_ADJUST = 1.1f;
|
||||||
|
|
||||||
public readonly Bindable<FruitVisualRepresentation> VisualRepresentation = new Bindable<FruitVisualRepresentation>();
|
public readonly Bindable<FruitVisualRepresentation> VisualRepresentation = new Bindable<FruitVisualRepresentation>();
|
||||||
public readonly Bindable<bool> HyperDash = new Bindable<bool>();
|
|
||||||
|
|
||||||
[CanBeNull]
|
protected override BorderPiece BorderPiece { get; }
|
||||||
private DrawableCatchHitObject drawableHitObject;
|
protected override HyperBorderPiece HyperBorderPiece { get; }
|
||||||
|
|
||||||
[CanBeNull]
|
|
||||||
private BorderPiece borderPiece;
|
|
||||||
|
|
||||||
public FruitPiece()
|
public FruitPiece()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader(permitNulls: true)]
|
InternalChildren = new Drawable[]
|
||||||
private void load([CanBeNull] DrawableHitObject drawable)
|
|
||||||
{
|
|
||||||
drawableHitObject = (DrawableCatchHitObject)drawable;
|
|
||||||
|
|
||||||
AddInternal(getFruitFor(VisualRepresentation.Value));
|
|
||||||
|
|
||||||
// if it is not part of a DHO, the border is always invisible.
|
|
||||||
if (drawableHitObject != null)
|
|
||||||
AddInternal(borderPiece = new BorderPiece());
|
|
||||||
|
|
||||||
if (HyperDash.Value)
|
|
||||||
AddInternal(new HyperBorderPiece());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Update()
|
|
||||||
{
|
|
||||||
if (borderPiece != null && drawableHitObject?.HitObject != null)
|
|
||||||
borderPiece.Alpha = (float)Math.Clamp((drawableHitObject.HitObject.StartTime - Time.Current) / 500, 0, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Drawable getFruitFor(FruitVisualRepresentation representation)
|
|
||||||
{
|
|
||||||
switch (representation)
|
|
||||||
{
|
{
|
||||||
case FruitVisualRepresentation.Pear:
|
new FruitPulpFormation
|
||||||
return new PearPiece();
|
{
|
||||||
|
AccentColour = { BindTarget = AccentColour },
|
||||||
|
VisualRepresentation = { BindTarget = VisualRepresentation }
|
||||||
|
},
|
||||||
|
BorderPiece = new BorderPiece(),
|
||||||
|
HyperBorderPiece = new HyperBorderPiece()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
case FruitVisualRepresentation.Grape:
|
protected override void LoadComplete()
|
||||||
return new GrapePiece();
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
case FruitVisualRepresentation.Pineapple:
|
var fruit = (DrawableFruit)DrawableHitObject;
|
||||||
return new PineapplePiece();
|
|
||||||
|
|
||||||
case FruitVisualRepresentation.Banana:
|
if (fruit != null)
|
||||||
return new BananaPiece();
|
VisualRepresentation.BindTo(fruit.VisualRepresentation);
|
||||||
|
|
||||||
case FruitVisualRepresentation.Raspberry:
|
|
||||||
return new RaspberryPiece();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Empty();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,59 @@
|
|||||||
|
// 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;
|
||||||
|
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Catch.Skinning.Default
|
||||||
|
{
|
||||||
|
public class FruitPulpFormation : PulpFormation
|
||||||
|
{
|
||||||
|
public readonly Bindable<FruitVisualRepresentation> VisualRepresentation = new Bindable<FruitVisualRepresentation>();
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
VisualRepresentation.BindValueChanged(setFormation, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setFormation(ValueChangedEvent<FruitVisualRepresentation> visualRepresentation)
|
||||||
|
{
|
||||||
|
Clear();
|
||||||
|
|
||||||
|
switch (visualRepresentation.NewValue)
|
||||||
|
{
|
||||||
|
case FruitVisualRepresentation.Pear:
|
||||||
|
AddPulp(new Vector2(0, -0.33f), new Vector2(SMALL_PULP));
|
||||||
|
AddPulp(PositionAt(60, DISTANCE_FROM_CENTRE_3), new Vector2(LARGE_PULP_3));
|
||||||
|
AddPulp(PositionAt(180, DISTANCE_FROM_CENTRE_3), new Vector2(LARGE_PULP_3));
|
||||||
|
AddPulp(PositionAt(300, DISTANCE_FROM_CENTRE_3), new Vector2(LARGE_PULP_3));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FruitVisualRepresentation.Grape:
|
||||||
|
AddPulp(new Vector2(0, -0.25f), new Vector2(SMALL_PULP));
|
||||||
|
AddPulp(PositionAt(0, DISTANCE_FROM_CENTRE_3), new Vector2(LARGE_PULP_3));
|
||||||
|
AddPulp(PositionAt(120, DISTANCE_FROM_CENTRE_3), new Vector2(LARGE_PULP_3));
|
||||||
|
AddPulp(PositionAt(240, DISTANCE_FROM_CENTRE_3), new Vector2(LARGE_PULP_3));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FruitVisualRepresentation.Pineapple:
|
||||||
|
AddPulp(new Vector2(0, -0.3f), new Vector2(SMALL_PULP));
|
||||||
|
AddPulp(PositionAt(45, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4));
|
||||||
|
AddPulp(PositionAt(135, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4));
|
||||||
|
AddPulp(PositionAt(225, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4));
|
||||||
|
AddPulp(PositionAt(315, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FruitVisualRepresentation.Raspberry:
|
||||||
|
AddPulp(new Vector2(0, -0.34f), new Vector2(SMALL_PULP));
|
||||||
|
AddPulp(PositionAt(0, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4));
|
||||||
|
AddPulp(PositionAt(90, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4));
|
||||||
|
AddPulp(PositionAt(180, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4));
|
||||||
|
AddPulp(PositionAt(270, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,42 +0,0 @@
|
|||||||
// 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.Graphics;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Skinning.Default
|
|
||||||
{
|
|
||||||
public class GrapePiece : PulpFormation
|
|
||||||
{
|
|
||||||
public GrapePiece()
|
|
||||||
{
|
|
||||||
InternalChildren = new Drawable[]
|
|
||||||
{
|
|
||||||
new Pulp
|
|
||||||
{
|
|
||||||
AccentColour = { BindTarget = AccentColour },
|
|
||||||
Size = new Vector2(SMALL_PULP),
|
|
||||||
Y = -0.25f,
|
|
||||||
},
|
|
||||||
new Pulp
|
|
||||||
{
|
|
||||||
AccentColour = { BindTarget = AccentColour },
|
|
||||||
Size = new Vector2(LARGE_PULP_3),
|
|
||||||
Position = PositionAt(0, DISTANCE_FROM_CENTRE_3),
|
|
||||||
},
|
|
||||||
new Pulp
|
|
||||||
{
|
|
||||||
AccentColour = { BindTarget = AccentColour },
|
|
||||||
Size = new Vector2(LARGE_PULP_3),
|
|
||||||
Position = PositionAt(120, DISTANCE_FROM_CENTRE_3),
|
|
||||||
},
|
|
||||||
new Pulp
|
|
||||||
{
|
|
||||||
Size = new Vector2(LARGE_PULP_3),
|
|
||||||
AccentColour = { BindTarget = AccentColour },
|
|
||||||
Position = PositionAt(240, DISTANCE_FROM_CENTRE_3),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
// 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.Graphics;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Skinning.Default
|
|
||||||
{
|
|
||||||
public class PearPiece : PulpFormation
|
|
||||||
{
|
|
||||||
public PearPiece()
|
|
||||||
{
|
|
||||||
InternalChildren = new Drawable[]
|
|
||||||
{
|
|
||||||
new Pulp
|
|
||||||
{
|
|
||||||
AccentColour = { BindTarget = AccentColour },
|
|
||||||
Size = new Vector2(SMALL_PULP),
|
|
||||||
Y = -0.33f,
|
|
||||||
},
|
|
||||||
new Pulp
|
|
||||||
{
|
|
||||||
AccentColour = { BindTarget = AccentColour },
|
|
||||||
Size = new Vector2(LARGE_PULP_3),
|
|
||||||
Position = PositionAt(60, DISTANCE_FROM_CENTRE_3),
|
|
||||||
},
|
|
||||||
new Pulp
|
|
||||||
{
|
|
||||||
AccentColour = { BindTarget = AccentColour },
|
|
||||||
Size = new Vector2(LARGE_PULP_3),
|
|
||||||
Position = PositionAt(180, DISTANCE_FROM_CENTRE_3),
|
|
||||||
},
|
|
||||||
new Pulp
|
|
||||||
{
|
|
||||||
Size = new Vector2(LARGE_PULP_3),
|
|
||||||
AccentColour = { BindTarget = AccentColour },
|
|
||||||
Position = PositionAt(300, DISTANCE_FROM_CENTRE_3),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
// 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.Graphics;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Skinning.Default
|
|
||||||
{
|
|
||||||
public class PineapplePiece : PulpFormation
|
|
||||||
{
|
|
||||||
public PineapplePiece()
|
|
||||||
{
|
|
||||||
InternalChildren = new Drawable[]
|
|
||||||
{
|
|
||||||
new Pulp
|
|
||||||
{
|
|
||||||
AccentColour = { BindTarget = AccentColour },
|
|
||||||
Size = new Vector2(SMALL_PULP),
|
|
||||||
Y = -0.3f,
|
|
||||||
},
|
|
||||||
new Pulp
|
|
||||||
{
|
|
||||||
AccentColour = { BindTarget = AccentColour },
|
|
||||||
Size = new Vector2(LARGE_PULP_4),
|
|
||||||
Position = PositionAt(45, DISTANCE_FROM_CENTRE_4),
|
|
||||||
},
|
|
||||||
new Pulp
|
|
||||||
{
|
|
||||||
AccentColour = { BindTarget = AccentColour },
|
|
||||||
Size = new Vector2(LARGE_PULP_4),
|
|
||||||
Position = PositionAt(135, DISTANCE_FROM_CENTRE_4),
|
|
||||||
},
|
|
||||||
new Pulp
|
|
||||||
{
|
|
||||||
AccentColour = { BindTarget = AccentColour },
|
|
||||||
Size = new Vector2(LARGE_PULP_4),
|
|
||||||
Position = PositionAt(225, DISTANCE_FROM_CENTRE_4),
|
|
||||||
},
|
|
||||||
new Pulp
|
|
||||||
{
|
|
||||||
Size = new Vector2(LARGE_PULP_4),
|
|
||||||
AccentColour = { BindTarget = AccentColour },
|
|
||||||
Position = PositionAt(315, DISTANCE_FROM_CENTRE_4),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -12,6 +12,8 @@ namespace osu.Game.Rulesets.Catch.Skinning.Default
|
|||||||
{
|
{
|
||||||
public class Pulp : Circle
|
public class Pulp : Circle
|
||||||
{
|
{
|
||||||
|
public readonly Bindable<Color4> AccentColour = new Bindable<Color4>();
|
||||||
|
|
||||||
public Pulp()
|
public Pulp()
|
||||||
{
|
{
|
||||||
RelativePositionAxes = Axes.Both;
|
RelativePositionAxes = Axes.Both;
|
||||||
@ -22,8 +24,6 @@ namespace osu.Game.Rulesets.Catch.Skinning.Default
|
|||||||
Colour = Color4.White.Opacity(0.9f);
|
Colour = Color4.White.Opacity(0.9f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public readonly Bindable<Color4> AccentColour = new Bindable<Color4>();
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
@ -2,12 +2,9 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -15,7 +12,7 @@ namespace osu.Game.Rulesets.Catch.Skinning.Default
|
|||||||
{
|
{
|
||||||
public abstract class PulpFormation : CompositeDrawable
|
public abstract class PulpFormation : CompositeDrawable
|
||||||
{
|
{
|
||||||
protected readonly IBindable<Color4> AccentColour = new Bindable<Color4>();
|
public readonly Bindable<Color4> AccentColour = new Bindable<Color4>();
|
||||||
|
|
||||||
protected const float LARGE_PULP_3 = 16f * FruitPiece.RADIUS_ADJUST;
|
protected const float LARGE_PULP_3 = 16f * FruitPiece.RADIUS_ADJUST;
|
||||||
protected const float DISTANCE_FROM_CENTRE_3 = 0.15f;
|
protected const float DISTANCE_FROM_CENTRE_3 = 0.15f;
|
||||||
@ -25,6 +22,8 @@ namespace osu.Game.Rulesets.Catch.Skinning.Default
|
|||||||
|
|
||||||
protected const float SMALL_PULP = LARGE_PULP_3 / 2;
|
protected const float SMALL_PULP = LARGE_PULP_3 / 2;
|
||||||
|
|
||||||
|
private int pulpsInUse;
|
||||||
|
|
||||||
protected PulpFormation()
|
protected PulpFormation()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
@ -34,11 +33,24 @@ namespace osu.Game.Rulesets.Catch.Skinning.Default
|
|||||||
distance * MathF.Sin(angle * MathF.PI / 180),
|
distance * MathF.Sin(angle * MathF.PI / 180),
|
||||||
distance * MathF.Cos(angle * MathF.PI / 180));
|
distance * MathF.Cos(angle * MathF.PI / 180));
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
protected void Clear()
|
||||||
private void load(DrawableHitObject drawableObject)
|
|
||||||
{
|
{
|
||||||
DrawableCatchHitObject drawableCatchObject = (DrawableCatchHitObject)drawableObject;
|
for (int i = 0; i < pulpsInUse; i++)
|
||||||
AccentColour.BindTo(drawableCatchObject.AccentColour);
|
InternalChildren[i].Alpha = 0;
|
||||||
|
pulpsInUse = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void AddPulp(Vector2 position, Vector2 size)
|
||||||
|
{
|
||||||
|
if (pulpsInUse == InternalChildren.Count)
|
||||||
|
AddInternal(new Pulp { AccentColour = { BindTarget = AccentColour } });
|
||||||
|
|
||||||
|
var pulp = InternalChildren[pulpsInUse];
|
||||||
|
pulp.Position = position;
|
||||||
|
pulp.Size = size;
|
||||||
|
pulp.Alpha = 1;
|
||||||
|
|
||||||
|
pulpsInUse++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,48 +0,0 @@
|
|||||||
// 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.Graphics;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Skinning.Default
|
|
||||||
{
|
|
||||||
public class RaspberryPiece : PulpFormation
|
|
||||||
{
|
|
||||||
public RaspberryPiece()
|
|
||||||
{
|
|
||||||
InternalChildren = new Drawable[]
|
|
||||||
{
|
|
||||||
new Pulp
|
|
||||||
{
|
|
||||||
AccentColour = { BindTarget = AccentColour },
|
|
||||||
Size = new Vector2(SMALL_PULP),
|
|
||||||
Y = -0.34f,
|
|
||||||
},
|
|
||||||
new Pulp
|
|
||||||
{
|
|
||||||
AccentColour = { BindTarget = AccentColour },
|
|
||||||
Size = new Vector2(LARGE_PULP_4),
|
|
||||||
Position = PositionAt(0, DISTANCE_FROM_CENTRE_4),
|
|
||||||
},
|
|
||||||
new Pulp
|
|
||||||
{
|
|
||||||
AccentColour = { BindTarget = AccentColour },
|
|
||||||
Size = new Vector2(LARGE_PULP_4),
|
|
||||||
Position = PositionAt(90, DISTANCE_FROM_CENTRE_4),
|
|
||||||
},
|
|
||||||
new Pulp
|
|
||||||
{
|
|
||||||
AccentColour = { BindTarget = AccentColour },
|
|
||||||
Size = new Vector2(LARGE_PULP_4),
|
|
||||||
Position = PositionAt(180, DISTANCE_FROM_CENTRE_4),
|
|
||||||
},
|
|
||||||
new Pulp
|
|
||||||
{
|
|
||||||
Size = new Vector2(LARGE_PULP_4),
|
|
||||||
AccentColour = { BindTarget = AccentColour },
|
|
||||||
Position = PositionAt(270, DISTANCE_FROM_CENTRE_4),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +1,9 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using Humanizer;
|
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osuTK;
|
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using static osu.Game.Skinning.LegacySkinConfiguration;
|
using static osu.Game.Skinning.LegacySkinConfiguration;
|
||||||
|
|
||||||
@ -40,20 +38,21 @@ namespace osu.Game.Rulesets.Catch.Skinning.Legacy
|
|||||||
|
|
||||||
switch (catchSkinComponent.Component)
|
switch (catchSkinComponent.Component)
|
||||||
{
|
{
|
||||||
case CatchSkinComponents.FruitApple:
|
case CatchSkinComponents.Fruit:
|
||||||
case CatchSkinComponents.FruitBananas:
|
if (GetTexture("fruit-pear") != null)
|
||||||
case CatchSkinComponents.FruitOrange:
|
return new LegacyFruitPiece();
|
||||||
case CatchSkinComponents.FruitGrapes:
|
|
||||||
case CatchSkinComponents.FruitPear:
|
break;
|
||||||
var lookupName = catchSkinComponent.Component.ToString().Kebaberize();
|
|
||||||
if (GetTexture(lookupName) != null)
|
case CatchSkinComponents.Banana:
|
||||||
return new LegacyFruitPiece(lookupName);
|
if (GetTexture("fruit-bananas") != null)
|
||||||
|
return new LegacyBananaPiece();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CatchSkinComponents.Droplet:
|
case CatchSkinComponents.Droplet:
|
||||||
if (GetTexture("fruit-drop") != null)
|
if (GetTexture("fruit-drop") != null)
|
||||||
return new LegacyFruitPiece("fruit-drop") { Scale = new Vector2(0.8f) };
|
return new LegacyDropletPiece();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1,83 +1,47 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Catch.UI;
|
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
|
||||||
using osu.Game.Skinning;
|
|
||||||
using osuTK;
|
|
||||||
using osuTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Skinning.Legacy
|
namespace osu.Game.Rulesets.Catch.Skinning.Legacy
|
||||||
{
|
{
|
||||||
internal class LegacyFruitPiece : CompositeDrawable
|
internal class LegacyFruitPiece : LegacyCatchHitObjectPiece
|
||||||
{
|
{
|
||||||
private readonly string lookupName;
|
public readonly Bindable<FruitVisualRepresentation> VisualRepresentation = new Bindable<FruitVisualRepresentation>();
|
||||||
|
|
||||||
private readonly Bindable<Color4> accentColour = new Bindable<Color4>();
|
|
||||||
private readonly Bindable<bool> hyperDash = new Bindable<bool>();
|
|
||||||
private Sprite colouredSprite;
|
|
||||||
|
|
||||||
public LegacyFruitPiece(string lookupName)
|
|
||||||
{
|
|
||||||
this.lookupName = lookupName;
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(DrawableHitObject drawableObject, ISkinSource skin)
|
|
||||||
{
|
|
||||||
var drawableCatchObject = (DrawablePalpableCatchHitObject)drawableObject;
|
|
||||||
|
|
||||||
accentColour.BindTo(drawableCatchObject.AccentColour);
|
|
||||||
hyperDash.BindTo(drawableCatchObject.HyperDash);
|
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
|
||||||
{
|
|
||||||
colouredSprite = new Sprite
|
|
||||||
{
|
|
||||||
Texture = skin.GetTexture(lookupName),
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
},
|
|
||||||
new Sprite
|
|
||||||
{
|
|
||||||
Texture = skin.GetTexture($"{lookupName}-overlay"),
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
if (hyperDash.Value)
|
|
||||||
{
|
|
||||||
var hyperDashOverlay = new Sprite
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Blending = BlendingParameters.Additive,
|
|
||||||
Depth = 1,
|
|
||||||
Alpha = 0.7f,
|
|
||||||
Scale = new Vector2(1.2f),
|
|
||||||
Texture = skin.GetTexture(lookupName),
|
|
||||||
Colour = skin.GetConfig<CatchSkinColour, Color4>(CatchSkinColour.HyperDashFruit)?.Value ??
|
|
||||||
skin.GetConfig<CatchSkinColour, Color4>(CatchSkinColour.HyperDash)?.Value ??
|
|
||||||
Catcher.DEFAULT_HYPER_DASH_COLOUR,
|
|
||||||
};
|
|
||||||
|
|
||||||
AddInternal(hyperDashOverlay);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
accentColour.BindValueChanged(colour => colouredSprite.Colour = LegacyColourCompatibility.DisallowZeroAlpha(colour.NewValue), true);
|
var fruit = (DrawableFruit)DrawableHitObject;
|
||||||
|
|
||||||
|
if (fruit != null)
|
||||||
|
VisualRepresentation.BindTo(fruit.VisualRepresentation);
|
||||||
|
|
||||||
|
VisualRepresentation.BindValueChanged(visual => setTexture(visual.NewValue), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setTexture(FruitVisualRepresentation visualRepresentation)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
20
osu.Game.Rulesets.Catch/Skinning/LegacyBananaPiece.cs
Normal file
20
osu.Game.Rulesets.Catch/Skinning/LegacyBananaPiece.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// 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.Graphics.Textures;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Catch.Skinning
|
||||||
|
{
|
||||||
|
public class LegacyBananaPiece : LegacyCatchHitObjectPiece
|
||||||
|
{
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
Texture texture = Skin.GetTexture("fruit-bananas");
|
||||||
|
Texture overlayTexture = Skin.GetTexture("fruit-bananas-overlay");
|
||||||
|
|
||||||
|
SetTexture(texture, overlayTexture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,98 @@
|
|||||||
|
// 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 JetBrains.Annotations;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Pooling;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Catch.UI;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Catch.Skinning
|
||||||
|
{
|
||||||
|
public abstract class LegacyCatchHitObjectPiece : PoolableDrawable
|
||||||
|
{
|
||||||
|
public readonly Bindable<Color4> AccentColour = new Bindable<Color4>();
|
||||||
|
public readonly Bindable<bool> HyperDash = new Bindable<bool>();
|
||||||
|
|
||||||
|
private readonly Sprite colouredSprite;
|
||||||
|
private readonly Sprite overlaySprite;
|
||||||
|
private readonly Sprite hyperSprite;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
protected ISkinSource Skin { get; private set; }
|
||||||
|
|
||||||
|
[Resolved(canBeNull: true)]
|
||||||
|
[CanBeNull]
|
||||||
|
protected DrawableHitObject DrawableHitObject { get; private set; }
|
||||||
|
|
||||||
|
protected LegacyCatchHitObjectPiece()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
colouredSprite = new Sprite
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
},
|
||||||
|
overlaySprite = new Sprite
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
},
|
||||||
|
hyperSprite = new Sprite
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Blending = BlendingParameters.Additive,
|
||||||
|
Depth = 1,
|
||||||
|
Alpha = 0,
|
||||||
|
Scale = new Vector2(1.2f),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
var hitObject = (DrawablePalpableCatchHitObject)DrawableHitObject;
|
||||||
|
|
||||||
|
if (hitObject != null)
|
||||||
|
{
|
||||||
|
AccentColour.BindTo(hitObject.AccentColour);
|
||||||
|
HyperDash.BindTo(hitObject.HyperDash);
|
||||||
|
}
|
||||||
|
|
||||||
|
hyperSprite.Colour = Skin.GetConfig<CatchSkinColour, Color4>(CatchSkinColour.HyperDashFruit)?.Value ??
|
||||||
|
Skin.GetConfig<CatchSkinColour, Color4>(CatchSkinColour.HyperDash)?.Value ??
|
||||||
|
Catcher.DEFAULT_HYPER_DASH_COLOUR;
|
||||||
|
|
||||||
|
AccentColour.BindValueChanged(colour =>
|
||||||
|
{
|
||||||
|
colouredSprite.Colour = LegacyColourCompatibility.DisallowZeroAlpha(colour.NewValue);
|
||||||
|
}, true);
|
||||||
|
|
||||||
|
HyperDash.BindValueChanged(hyper =>
|
||||||
|
{
|
||||||
|
hyperSprite.Alpha = hyper.NewValue ? 0.7f : 0;
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void SetTexture(Texture texture, Texture overlayTexture)
|
||||||
|
{
|
||||||
|
colouredSprite.Texture = texture;
|
||||||
|
overlaySprite.Texture = overlayTexture;
|
||||||
|
hyperSprite.Texture = texture;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
26
osu.Game.Rulesets.Catch/Skinning/LegacyDropletPiece.cs
Normal file
26
osu.Game.Rulesets.Catch/Skinning/LegacyDropletPiece.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// 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.Graphics.Textures;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Catch.Skinning
|
||||||
|
{
|
||||||
|
public class LegacyDropletPiece : LegacyCatchHitObjectPiece
|
||||||
|
{
|
||||||
|
public LegacyDropletPiece()
|
||||||
|
{
|
||||||
|
Scale = new Vector2(0.8f);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
Texture texture = Skin.GetTexture("fruit-drop");
|
||||||
|
Texture overlayTexture = Skin.GetTexture("fruit-drop-overlay");
|
||||||
|
|
||||||
|
SetTexture(texture, overlayTexture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user