1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 07:42:54 +08:00
osu-lazer/osu.Game/Graphics/UserInterface/CatchComboCounter.cs

61 lines
1.9 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
using OpenTK.Graphics;
2016-10-07 15:05:02 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace osu.Game.Graphics.UserInterface
{
/// <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>
public class CatchComboCounter : StandardComboCounter
{
public CatchComboCounter() : base()
2016-10-07 15:05:02 +08:00
{
CanPopOutWhenBackwards = true;
}
protected override string formatCount(ulong count)
{
return count.ToString("#,0");
}
protected override void transformCount(ulong currentValue, ulong newValue)
{
// Animate rollover only when going backwards
if (newValue > currentValue)
{
updateTransforms(typeof(TransformULongCounter));
removeTransforms(typeof(TransformULongCounter));
2016-10-07 15:05:02 +08:00
VisibleCount = newValue;
}
else
{
2016-10-08 05:14:35 +08:00
// Backwards pop-up animation has no tint colour
2016-10-07 15:05:02 +08:00
popOutSpriteText.Colour = countSpriteText.Colour;
transformCount(new TransformULongCounter(Clock), 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)
{
popOutSpriteText.Colour = colour;
Count++;
}
public override void ResetCount()
{
base.ResetCount();
}
}
}