From 35c3d75cb8d720583e7b010ff026fdd7885b773c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 17 Sep 2021 18:51:43 +0900 Subject: [PATCH] Preserve flashlight size through aspect adjustment --- .../Mods/TaikoModFlashlight.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs index 19ba99586b..12f19a0086 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs @@ -43,13 +43,17 @@ public TaikoFlashlight(TaikoPlayfield taikoPlayfield) private Vector2 getSizeFor(int combo) { + Vector2 size; + if (combo > 200) - return new Vector2(0, default_flashlight_size * 0.8f); + size = new Vector2(0, default_flashlight_size * 0.8f); + else if (combo > 100) + size = new Vector2(0, default_flashlight_size * 0.9f); + else + size = new Vector2(0, default_flashlight_size); - if (combo > 100) - return new Vector2(0, default_flashlight_size * 0.9f); - - return new Vector2(0, default_flashlight_size); + // Preserve flashlight size through the playfield's aspect adjustment. + return size * taikoPlayfield.DrawHeight / TaikoPlayfield.DEFAULT_HEIGHT; } protected override void OnComboChange(ValueChangedEvent e) @@ -66,6 +70,10 @@ protected override void Update() if (!flashlightProperties.IsValid) { FlashlightPosition = ToLocalSpace(taikoPlayfield.HitTarget.ScreenSpaceDrawQuad.Centre); + + ClearTransforms(targetMember: nameof(FlashlightSize)); + FlashlightSize = getSizeFor(Combo.Value); + flashlightProperties.Validate(); } }