using osu.Framework.Graphics; using osu.Framework.Graphics.Transformations; using osu.Framework.MathUtils; using osu.Framework.Timing; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace osu.Game.Graphics.UserInterface { /// /// A simple rollover counter that accepts unsigned long values. /// public class ULongCounter : RollingCounter { protected override void transformCount(ulong currentValue, ulong newValue) { transformCount(new TranformULongCounter(Clock), currentValue, newValue); } public override void ResetCount() { SetCountWithoutRolling(0); } protected override string formatCount(ulong count) { return count.ToString("#,0"); } protected class TranformULongCounter : 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 ULongCounter).VisibleCount = CurrentValue; } public TranformULongCounter(IClock clock) : base(clock) { } } } }