From 83c80291d49b5b65d056019710e400dc0d1c16c6 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Fri, 2 Jul 2021 22:18:31 +0900 Subject: [PATCH] Don't flip catcher plate contents in legacy skin --- .../Skinning/CatchSkinConfiguration.cs | 13 +++++++++++++ .../Skinning/Legacy/CatchLegacySkinTransformer.cs | 10 ++++++++++ osu.Game.Rulesets.Catch/UI/Catcher.cs | 13 +++++++++++-- 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 osu.Game.Rulesets.Catch/Skinning/CatchSkinConfiguration.cs diff --git a/osu.Game.Rulesets.Catch/Skinning/CatchSkinConfiguration.cs b/osu.Game.Rulesets.Catch/Skinning/CatchSkinConfiguration.cs new file mode 100644 index 0000000000..ea8d742b1a --- /dev/null +++ b/osu.Game.Rulesets.Catch/Skinning/CatchSkinConfiguration.cs @@ -0,0 +1,13 @@ +// Copyright (c) ppy Pty Ltd . 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 + { + /// + /// Whether the contents of the catcher plate should be visually flipped when the catcher direction is changed. + /// + FlipCatcherPlate + } +} diff --git a/osu.Game.Rulesets.Catch/Skinning/Legacy/CatchLegacySkinTransformer.cs b/osu.Game.Rulesets.Catch/Skinning/Legacy/CatchLegacySkinTransformer.cs index 287ed1b4c7..b6f6e91c29 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Legacy/CatchLegacySkinTransformer.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Legacy/CatchLegacySkinTransformer.cs @@ -103,6 +103,16 @@ namespace osu.Game.Rulesets.Catch.Skinning.Legacy result.Value = LegacyColourCompatibility.DisallowZeroAlpha(result.Value); return (IBindable)result; + + case CatchSkinConfiguration config: + switch (config) + { + case CatchSkinConfiguration.FlipCatcherPlate: + // Always return `false` (don't flip catcher plate contents) for a legacy skin. + return (IBindable)new Bindable(); + } + + break; } return base.GetConfig(lookup); diff --git a/osu.Game.Rulesets.Catch/UI/Catcher.cs b/osu.Game.Rulesets.Catch/UI/Catcher.cs index b6a9863002..4b532b9c91 100644 --- a/osu.Game.Rulesets.Catch/UI/Catcher.cs +++ b/osu.Game.Rulesets.Catch/UI/Catcher.cs @@ -108,8 +108,16 @@ namespace osu.Game.Rulesets.Catch.UI } } + /// + /// The currently facing direction. + /// public Direction VisualDirection { get; set; } = Direction.Right; + /// + /// Whether the contents of the catcher plate should be visually flipped when the catcher direction is changed. + /// + private bool flipCatcherPlate; + /// /// Width of the area that can be used to attempt catches during gameplay. /// @@ -343,6 +351,8 @@ namespace osu.Game.Rulesets.Catch.UI trails.HyperDashTrailsColour = hyperDashColour; trails.EndGlowSpritesColour = hyperDashEndGlowColour; + flipCatcherPlate = skin.GetConfig(CatchSkinConfiguration.FlipCatcherPlate)?.Value ?? true; + runHyperDashStateTransition(HyperDashing); } @@ -352,8 +362,7 @@ namespace osu.Game.Rulesets.Catch.UI 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) ||