osu/osu.Game/GameModes/Play/Catch/CatchComboCounter.cs

68 lines
2.1 KiB
C#
Raw Normal View History

2016-10-07 07:24:46 +00:00
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Graphics;
2016-10-14 23:23:27 +00:00
using osu.Game.GameModes.Play.Osu;
2016-10-07 07:05:02 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
2016-10-14 23:23:27 +00:00
namespace osu.Game.GameModes.Play.Catch
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;
protected virtual 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
}
protected override void OnCountChange(ulong currentValue, ulong newValue)
{
if (newValue != 0)
this.Show();
base.OnCountChange(currentValue, newValue);
}
protected override void OnCountRolling(ulong currentValue, ulong newValue)
{
2016-10-14 23:23:27 +00:00
PopOutSpriteText.Colour = CountSpriteText.Colour;
this.FadeOut(FadeOutDuration);
base.OnCountRolling(currentValue, newValue);
}
protected override void OnCountIncrement(ulong currentValue, ulong newValue)
{
this.Show();
base.OnCountIncrement(currentValue, newValue);
}
protected override void transformPopOutSmall(ulong newValue)
{
base.transformPopOutSmall(newValue);
CountSpriteText.Delay(FadeOutDelay);
CountSpriteText.FadeOut(FadeOutDuration);
CountSpriteText.DelayReset();
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-10-14 23:23:27 +00:00
PopOutSpriteText.Colour = colour;
2016-10-07 07:05:02 +00:00
Count++;
}
}
}