diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs index 5bcfc489d9..3cfd220beb 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs @@ -16,6 +16,7 @@ using osu.Game.GameModes.Play.Catch; using osu.Game.GameModes.Play.Mania; using osu.Game.GameModes.Play.Osu; using osu.Game.GameModes.Play.Taiko; +using osu.Game.GameModes.Play; namespace osu.Desktop.Tests { diff --git a/osu.Game/Graphics/UserInterface/ComboCounter.cs b/osu.Game/GameModes/Play/ComboCounter.cs similarity index 96% rename from osu.Game/Graphics/UserInterface/ComboCounter.cs rename to osu.Game/GameModes/Play/ComboCounter.cs index f5c0c382b8..6cd166a300 100644 --- a/osu.Game/Graphics/UserInterface/ComboCounter.cs +++ b/osu.Game/GameModes/Play/ComboCounter.cs @@ -15,7 +15,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace osu.Game.Graphics.UserInterface +namespace osu.Game.GameModes.Play { public abstract class ComboCounter : Container { diff --git a/osu.Game/GameModes/Play/ComboResultCounter.cs b/osu.Game/GameModes/Play/ComboResultCounter.cs new file mode 100644 index 0000000000..c01edc180d --- /dev/null +++ b/osu.Game/GameModes/Play/ComboResultCounter.cs @@ -0,0 +1,63 @@ +//Copyright (c) 2007-2016 ppy Pty Ltd . +//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Transformations; +using osu.Framework.MathUtils; +using osu.Framework.Timing; +using osu.Game.Graphics.UserInterface; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace osu.Game.GameModes.Play.UserInterface +{ + /// + /// Used to display combo with a roll-up animation in results screen. + /// + public class ComboResultCounter : RollingCounter + { + protected override Type TransformType => typeof(TransformComboResult); + + public override double RollingDuration => 500; + public override EasingTypes RollingEasing => EasingTypes.Out; + + protected override double GetProportionalDuration(ulong currentValue, ulong newValue) + { + return currentValue > newValue ? currentValue - newValue : newValue - currentValue; + } + + protected override string FormatCount(ulong count) + { + return $@"{count}x"; + } + + protected class TransformComboResult : Transform + { + public override ulong CurrentValue + { + get + { + double time = Time; + if (time < StartTime) return StartValue; + if (time >= EndTime) return EndValue; + + return (ulong)Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing); + } + } + + public override void Apply(Drawable d) + { + base.Apply(d); + (d as ComboResultCounter).VisibleCount = CurrentValue; + } + + public TransformComboResult(IClock clock) + : base(clock) + { + } + } + } +} diff --git a/osu.Game/GameModes/Play/Osu/OsuComboCounter.cs b/osu.Game/GameModes/Play/Osu/OsuComboCounter.cs index 209fae57b7..07b7fa7934 100644 --- a/osu.Game/GameModes/Play/Osu/OsuComboCounter.cs +++ b/osu.Game/GameModes/Play/Osu/OsuComboCounter.cs @@ -3,7 +3,6 @@ using OpenTK; using osu.Framework; -using osu.Game.Graphics.UserInterface; using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/GameModes/Play/Taiko/TaikoComboCounter.cs b/osu.Game/GameModes/Play/Taiko/TaikoComboCounter.cs index 84019739ea..2e1923ceb5 100644 --- a/osu.Game/GameModes/Play/Taiko/TaikoComboCounter.cs +++ b/osu.Game/GameModes/Play/Taiko/TaikoComboCounter.cs @@ -3,7 +3,6 @@ using OpenTK; using osu.Framework.Graphics.Transformations; -using osu.Game.Graphics.UserInterface; using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 0e51cd2452..82e98606c6 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -130,7 +130,8 @@ - + +