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