Don't flip catcher plate contents in legacy skin

This commit is contained in:
ekrctb 2021-07-02 22:18:31 +09:00
parent fbba32647e
commit 83c80291d4
3 changed files with 34 additions and 2 deletions

View File

@ -0,0 +1,13 @@
// 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.
namespace osu.Game.Rulesets.Catch.Skinning
{
public enum CatchSkinConfiguration
{
/// <summary>
/// Whether the contents of the catcher plate should be visually flipped when the catcher direction is changed.
/// </summary>
FlipCatcherPlate
}
}

View File

@ -103,6 +103,16 @@ public override IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup)
result.Value = LegacyColourCompatibility.DisallowZeroAlpha(result.Value);
return (IBindable<TValue>)result;
case CatchSkinConfiguration config:
switch (config)
{
case CatchSkinConfiguration.FlipCatcherPlate:
// Always return `false` (don't flip catcher plate contents) for a legacy skin.
return (IBindable<TValue>)new Bindable<bool>();
}
break;
}
return base.GetConfig<TLookup, TValue>(lookup);

View File

@ -108,8 +108,16 @@ public bool Dashing
}
}
/// <summary>
/// The currently facing direction.
/// </summary>
public Direction VisualDirection { get; set; } = Direction.Right;
/// <summary>
/// Whether the contents of the catcher plate should be visually flipped when the catcher direction is changed.
/// </summary>
private bool flipCatcherPlate;
/// <summary>
/// Width of the area that can be used to attempt catches during gameplay.
/// </summary>
@ -343,6 +351,8 @@ protected override void SkinChanged(ISkinSource skin)
trails.HyperDashTrailsColour = hyperDashColour;
trails.EndGlowSpritesColour = hyperDashEndGlowColour;
flipCatcherPlate = skin.GetConfig<CatchSkinConfiguration, bool>(CatchSkinConfiguration.FlipCatcherPlate)?.Value ?? true;
runHyperDashStateTransition(HyperDashing);
}
@ -352,8 +362,7 @@ protected override void Update()
var scaleFromDirection = new Vector2((int)VisualDirection, 1);
Body.Scale = scaleFromDirection;
// TODO: don't flip plate contents on legacy skin.
caughtObjectContainer.Scale = hitExplosionContainer.Scale = scaleFromDirection;
caughtObjectContainer.Scale = hitExplosionContainer.Scale = flipCatcherPlate ? scaleFromDirection : Vector2.One;
// Correct overshooting.
if ((hyperDashDirection > 0 && hyperDashTargetPosition < X) ||