1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-27 07:53:06 +08:00
osu-lazer/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs

40 lines
1.1 KiB
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
2018-04-13 17:19:50 +08:00
using System;
2018-11-16 04:37:21 +08:00
using osu.Framework.Allocation;
2018-04-13 17:19:50 +08:00
namespace osu.Game.Graphics.UserInterface
{
/// <summary>
/// Used as an accuracy counter. Represented visually as a percentage.
/// </summary>
public class SimpleComboCounter : RollingCounter<int>
{
protected override double RollingDuration => 750;
public SimpleComboCounter()
{
Current.Value = DisplayedCount = 0;
}
2018-11-16 04:37:21 +08:00
[BackgroundDependencyLoader]
private void load(OsuColour colours) => AccentColour = colours.BlueLighter;
2018-04-13 17:19:50 +08:00
protected override string FormatCount(int count)
{
return $@"{count}x";
}
protected override double GetProportionalDuration(int currentValue, int newValue)
{
return Math.Abs(currentValue - newValue) * RollingDuration * 100.0f;
}
public override void Increment(int amount)
{
2019-11-12 17:56:38 +08:00
Current.Value += amount;
2018-04-13 17:19:50 +08:00
}
}
}