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
|
|
|
|
|
2016-10-16 07:06:31 +08:00
|
|
|
|
protected virtual double FadeOutDelay => 1000;
|
2016-10-30 07:42:40 +08:00
|
|
|
|
protected override double FadeOutDuration => 300;
|
2016-10-16 07:06:31 +08:00
|
|
|
|
|
2016-10-15 07:23:27 +08:00
|
|
|
|
protected override string FormatCount(ulong count)
|
2016-10-07 15:05:02 +08:00
|
|
|
|
{
|
2016-10-16 07:06:31 +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();
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-16 07:06:31 +08:00
|
|
|
|
protected override void OnCountChange(ulong currentValue, ulong newValue)
|
|
|
|
|
{
|
|
|
|
|
if (newValue != 0)
|
2016-10-16 08:07:07 +08:00
|
|
|
|
animateFade();
|
2016-10-16 07:06:31 +08:00
|
|
|
|
base.OnCountChange(currentValue, newValue);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnCountRolling(ulong currentValue, ulong newValue)
|
2016-10-13 10:33:55 +08:00
|
|
|
|
{
|
2016-10-16 08:07:07 +08:00
|
|
|
|
if (!IsRolling)
|
|
|
|
|
{
|
2016-11-19 15:19:54 +08:00
|
|
|
|
PopOutCount.Colour = DisplayedCountSpriteText.Colour;
|
2016-10-16 08:07:07 +08:00
|
|
|
|
FadeOut(FadeOutDuration);
|
|
|
|
|
}
|
2016-10-16 07:06:31 +08:00
|
|
|
|
base.OnCountRolling(currentValue, newValue);
|
|
|
|
|
}
|
2016-10-13 10:33:55 +08:00
|
|
|
|
|
2016-10-16 07:06:31 +08:00
|
|
|
|
protected override void OnCountIncrement(ulong currentValue, ulong newValue)
|
|
|
|
|
{
|
2016-10-16 08:07:07 +08:00
|
|
|
|
animateFade();
|
2016-10-16 07:06:31 +08:00
|
|
|
|
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-11-19 15:19:54 +08:00
|
|
|
|
PopOutCount.Colour = colour;
|
2016-10-07 15:05:02 +08:00
|
|
|
|
Count++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|