osu/osu.Game.Modes.Catch/UI/CatchComboCounter.cs

66 lines
2.0 KiB
C#
Raw Normal View History

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