1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-06 14:27:46 +08:00
osu-lazer/osu.Game.Modes.Catch/UI/CatchComboCounter.cs

66 lines
2.0 KiB
C#
Raw Normal View History

2016-10-07 02:24:46 -05:00
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
2016-11-14 18:54:24 +09:00
using osu.Game.Modes.Osu.UI;
2016-10-07 02:24:46 -05:00
using OpenTK.Graphics;
2016-10-07 02:05:02 -05:00
2016-11-14 18:54:24 +09:00
namespace osu.Game.Modes.Catch.UI
2016-10-07 02:05:02 -05:00
{
/// <summary>
2016-10-07 16:14:35 -05:00
/// Similar to Standard, but without the 'x' and has tinted pop-ups. Used in osu!catch.
2016-10-07 02:05:02 -05:00
/// </summary>
2016-10-14 18:23:27 -05:00
public class CatchComboCounter : OsuComboCounter
2016-10-07 02:05:02 -05:00
{
2016-10-15 14:01:11 -05:00
protected override bool CanPopOutWhileRolling => true;
2016-10-07 02:05:02 -05:00
protected virtual double FadeOutDelay => 1000;
2016-10-29 18:42:40 -05:00
protected override double FadeOutDuration => 300;
2016-10-14 18:23:27 -05:00
protected override string FormatCount(ulong count)
2016-10-07 02:05:02 -05:00
{
return $@"{count:#,0}";
2016-10-07 02:05:02 -05:00
}
2016-10-15 19:07:07 -05:00
private void animateFade()
{
Show();
Delay(FadeOutDelay);
FadeOut(FadeOutDuration);
DelayReset();
}
protected override void OnCountChange(ulong currentValue, ulong newValue)
{
if (newValue != 0)
2016-10-15 19:07:07 -05:00
animateFade();
base.OnCountChange(currentValue, newValue);
}
protected override void OnCountRolling(ulong currentValue, ulong newValue)
{
2016-10-15 19:07:07 -05:00
if (!IsRolling)
{
PopOutCount.Colour = DisplayedCountSpriteText.Colour;
2016-10-15 19:07:07 -05:00
FadeOut(FadeOutDuration);
}
base.OnCountRolling(currentValue, newValue);
}
protected override void OnCountIncrement(ulong currentValue, ulong newValue)
{
2016-10-15 19:07:07 -05:00
animateFade();
base.OnCountIncrement(currentValue, newValue);
}
2016-10-07 02:05:02 -05:00
/// <summary>
2016-10-07 17:15:36 -05:00
/// Increaces counter and tints pop-out before animation.
2016-10-07 02:05:02 -05:00
/// </summary>
2016-10-07 17:15:36 -05:00
/// <param name="colour">Last grabbed fruit colour.</param>
2016-10-07 02:05:02 -05:00
public void CatchFruit(Color4 colour)
{
PopOutCount.Colour = colour;
2016-10-07 02:05:02 -05:00
Count++;
}
}
}