From a671765a4f918cb6745c6e94733133d41186d219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adonais=20Romero=20Gonz=C3=A1lez?= Date: Sun, 16 Oct 2016 17:45:37 -0500 Subject: [PATCH] Modified ManiaComboCounter behavior This to match more with the current behavior in osu!mania. --- .../Tests/TestCaseScoreCounter.cs | 13 ++++++- .../GameModes/Play/Mania/ManiaComboCounter.cs | 35 +++++++++++++++---- 2 files changed, 41 insertions(+), 7 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs index f1f9e449fd..d7ce54ad46 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs @@ -32,6 +32,8 @@ namespace osu.Desktop.Tests int numerator = 0, denominator = 0; + bool maniaHold = false; + ScoreCounter score = new ScoreCounter(7) { Origin = Anchor.TopRight, @@ -72,7 +74,7 @@ namespace osu.Desktop.Tests }; Add(taikoCombo); - ComboCounter maniaCombo = new ManiaComboCounter + ManiaComboCounter maniaCombo = new ManiaComboCounter { Origin = Anchor.Centre, Anchor = Anchor.Centre, @@ -147,6 +149,15 @@ namespace osu.Desktop.Tests accuracyCombo.SetFraction(numerator, denominator); }); + AddButton(@"mania hold", delegate + { + if (!maniaHold) + maniaCombo.HoldStart(); + else + maniaCombo.HoldEnd(); + maniaHold = !maniaHold; + }); + AddButton(@"Alter stars", delegate { stars.Count = RNG.NextSingle() * (stars.MaxStars + 1); diff --git a/osu.Game/GameModes/Play/Mania/ManiaComboCounter.cs b/osu.Game/GameModes/Play/Mania/ManiaComboCounter.cs index 86349115e9..454c6a810d 100644 --- a/osu.Game/GameModes/Play/Mania/ManiaComboCounter.cs +++ b/osu.Game/GameModes/Play/Mania/ManiaComboCounter.cs @@ -4,6 +4,7 @@ using OpenTK.Graphics; using osu.Framework; using osu.Framework.Graphics; +using osu.Framework.Graphics.Transformations; using osu.Game.GameModes.Play.Taiko; using System; using System.Collections.Generic; @@ -18,9 +19,14 @@ namespace osu.Game.GameModes.Play.Mania /// public class ManiaComboCounter : TaikoComboCounter { + protected ushort KeysHeld = 0; + protected Color4 OriginalColour; - protected Color4 TintColour => Color4.OrangeRed; + protected Color4 TintColour => Color4.Orange; + protected EasingTypes TintEasing => EasingTypes.None; + protected int TintDuration => 500; + protected Color4 PopOutColor => Color4.Red; protected override float PopOutInitialAlpha => 1.0f; protected override ulong PopOutDuration => 300; @@ -32,7 +38,7 @@ namespace osu.Game.GameModes.Play.Mania PopOutSpriteText.Anchor = Anchor.BottomCentre; PopOutSpriteText.Origin = Anchor.Centre; PopOutSpriteText.FadeColour(PopOutColor, 0); - OriginalColour = Colour; + OriginalColour = DisplayedCountSpriteText.Colour; } protected override void OnCountRolling(ulong currentValue, ulong newValue) @@ -51,11 +57,28 @@ namespace osu.Game.GameModes.Play.Mania base.OnCountRolling(currentValue, newValue); } - protected override void transformAnimate(ulong newValue) + /// + /// Tints text while holding a key. + /// + /// + /// Does not alter combo. This has to be done depending of the scoring system. + /// (i.e. v1 = each period of time; v2 = when starting and ending a key hold) + /// + public void HoldStart() { - base.transformAnimate(newValue); - DisplayedCountSpriteText.FadeColour(TintColour, 0); - DisplayedCountSpriteText.FadeColour(OriginalColour, AnimationDuration, AnimationEasing); + if (KeysHeld == 0) + DisplayedCountSpriteText.FadeColour(TintColour, TintDuration, TintEasing); + KeysHeld++; + } + + /// + /// Ends tinting. + /// + public void HoldEnd() + { + KeysHeld--; + if (KeysHeld == 0) + DisplayedCountSpriteText.FadeColour(OriginalColour, TintDuration, TintEasing); } } }