From 08d8975566b9a3474c3df1b3882e86e49fd3f649 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 22 Sep 2020 12:35:18 +0900 Subject: [PATCH] Remove DisplayInitialCombo method for simplicity --- .../Skinning/LegacyComboCounter.cs | 12 +++++++++--- osu.Game.Rulesets.Catch/UI/CatchComboDisplay.cs | 2 +- osu.Game.Rulesets.Catch/UI/ICatchComboCounter.cs | 12 +----------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Skinning/LegacyComboCounter.cs b/osu.Game.Rulesets.Catch/Skinning/LegacyComboCounter.cs index 320fc9c440..047d9b3602 100644 --- a/osu.Game.Rulesets.Catch/Skinning/LegacyComboCounter.cs +++ b/osu.Game.Rulesets.Catch/Skinning/LegacyComboCounter.cs @@ -50,11 +50,17 @@ public LegacyComboCounter(ISkin skin) }; } - public void DisplayInitialCombo(int combo) => updateCombo(combo, null, true); - public void UpdateCombo(int combo, Color4? hitObjectColour) => updateCombo(combo, hitObjectColour, false); + private int lastDisplayedCombo; - private void updateCombo(int combo, Color4? hitObjectColour, bool immediate) + public void UpdateCombo(int combo, Color4? hitObjectColour = null) { + bool immediate = Time.Elapsed < 0; + + if (combo == lastDisplayedCombo) + return; + + lastDisplayedCombo = combo; + // There may still be existing transforms to the counter (including value change after 250ms), // finish them immediately before new transforms. counter.FinishTransforms(); diff --git a/osu.Game.Rulesets.Catch/UI/CatchComboDisplay.cs b/osu.Game.Rulesets.Catch/UI/CatchComboDisplay.cs index b53711e4ed..deb2cb99ed 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchComboDisplay.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchComboDisplay.cs @@ -28,7 +28,7 @@ public CatchComboDisplay() protected override void SkinChanged(ISkinSource skin, bool allowFallback) { base.SkinChanged(skin, allowFallback); - ComboCounter?.DisplayInitialCombo(currentCombo); + ComboCounter?.UpdateCombo(currentCombo); } public void OnNewResult(DrawableCatchHitObject judgedObject, JudgementResult result) diff --git a/osu.Game.Rulesets.Catch/UI/ICatchComboCounter.cs b/osu.Game.Rulesets.Catch/UI/ICatchComboCounter.cs index 1363ed1352..cfb6879067 100644 --- a/osu.Game.Rulesets.Catch/UI/ICatchComboCounter.cs +++ b/osu.Game.Rulesets.Catch/UI/ICatchComboCounter.cs @@ -11,16 +11,6 @@ namespace osu.Game.Rulesets.Catch.UI /// public interface ICatchComboCounter : IDrawable { - /// - /// Updates the counter to display the provided as initial value. - /// The value should be immediately displayed without any animation. - /// - /// - /// This is required for when instantiating a combo counter in middle of accumulating combo (via skin change). - /// - /// The combo value to be displayed as initial. - void DisplayInitialCombo(int combo); - /// /// Updates the counter to animate a transition from the old combo value it had to the current provided one. /// @@ -29,6 +19,6 @@ public interface ICatchComboCounter : IDrawable /// /// The new combo value. /// The colour of the object if hit, null on miss. - void UpdateCombo(int combo, Color4? hitObjectColour); + void UpdateCombo(int combo, Color4? hitObjectColour = null); } }