2016-10-16 04:16:02 +08:00
|
|
|
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
//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;
|
|
|
|
|
|
2016-10-16 11:24:03 +08:00
|
|
|
|
namespace osu.Game.GameModes.Play
|
2016-10-16 04:16:02 +08:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Used to display combo with a roll-up animation in results screen.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class ComboResultCounter : RollingCounter<ulong>
|
|
|
|
|
{
|
|
|
|
|
protected override Type TransformType => typeof(TransformComboResult);
|
|
|
|
|
|
2016-10-18 10:40:50 +08:00
|
|
|
|
protected override double RollingDuration => 500;
|
|
|
|
|
protected override EasingTypes RollingEasing => EasingTypes.Out;
|
2016-10-16 04:16:02 +08:00
|
|
|
|
|
|
|
|
|
protected override double GetProportionalDuration(ulong currentValue, ulong newValue)
|
|
|
|
|
{
|
|
|
|
|
return currentValue > newValue ? currentValue - newValue : newValue - currentValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override string FormatCount(ulong count)
|
|
|
|
|
{
|
|
|
|
|
return $@"{count}x";
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-19 18:44:03 +08:00
|
|
|
|
public override void Increment(ulong amount)
|
|
|
|
|
{
|
|
|
|
|
Count = Count + amount;
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-16 04:16:02 +08:00
|
|
|
|
protected class TransformComboResult : Transform<ulong>
|
|
|
|
|
{
|
2016-10-28 16:42:00 +08:00
|
|
|
|
protected override ulong CurrentValue
|
2016-10-16 04:16:02 +08:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-10-28 16:42:00 +08:00
|
|
|
|
double time = CurrentTime ?? 0;
|
2016-10-16 04:16:02 +08:00
|
|
|
|
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);
|
2016-10-16 08:07:07 +08:00
|
|
|
|
(d as ComboResultCounter).DisplayedCount = CurrentValue;
|
2016-10-16 04:16:02 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|