1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-08 17:37: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 15:24:46 +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
2016-11-14 17:54:24 +08:00
using osu.Game.Modes.Osu.UI;
2016-10-07 15:24:46 +08:00
using OpenTK.Graphics;
2016-10-07 15:05:02 +08:00
2016-11-14 17:54:24 +08:00
namespace osu.Game.Modes.Catch.UI
2016-10-07 15:05:02 +08:00
{
/// <summary>
2016-10-08 05:14:35 +08:00
/// Similar to Standard, but without the 'x' and has tinted pop-ups. Used in osu!catch.
2016-10-07 15:05:02 +08:00
/// </summary>
2016-10-15 07:23:27 +08:00
public class CatchComboCounter : OsuComboCounter
2016-10-07 15:05:02 +08:00
{
2016-10-16 03:01:11 +08:00
protected override bool CanPopOutWhileRolling => true;
2016-10-07 15:05:02 +08:00
protected virtual double FadeOutDelay => 1000;
2016-10-30 07:42:40 +08:00
protected override double FadeOutDuration => 300;
2016-10-15 07:23:27 +08:00
protected override string FormatCount(ulong count)
2016-10-07 15:05:02 +08:00
{
return $@"{count:#,0}";
2016-10-07 15:05:02 +08:00
}
2016-10-16 08:07:07 +08:00
private void animateFade()
{
Show();
Delay(FadeOutDelay);
FadeOut(FadeOutDuration);
DelayReset();
}
protected override void OnCountChange(ulong currentValue, ulong newValue)
{
if (newValue != 0)
2016-10-16 08:07:07 +08:00
animateFade();
base.OnCountChange(currentValue, newValue);
}
protected override void OnCountRolling(ulong currentValue, ulong newValue)
{
2016-10-16 08:07:07 +08:00
if (!IsRolling)
{
PopOutSpriteText.Colour = DisplayedCountSpriteText.Colour;
FadeOut(FadeOutDuration);
}
base.OnCountRolling(currentValue, newValue);
}
protected override void OnCountIncrement(ulong currentValue, ulong newValue)
{
2016-10-16 08:07:07 +08:00
animateFade();
base.OnCountIncrement(currentValue, newValue);
}
2016-10-07 15:05:02 +08:00
/// <summary>
2016-10-08 06:15:36 +08:00
/// Increaces counter and tints pop-out before animation.
2016-10-07 15:05:02 +08:00
/// </summary>
2016-10-08 06:15:36 +08:00
/// <param name="colour">Last grabbed fruit colour.</param>
2016-10-07 15:05:02 +08:00
public void CatchFruit(Color4 colour)
{
2016-10-15 07:23:27 +08:00
PopOutSpriteText.Colour = colour;
2016-10-07 15:05:02 +08:00
Count++;
}
}
}