1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 13:22:55 +08:00
osu-lazer/osu.Game.Modes.Mania/UI/ManiaComboCounter.cs

79 lines
2.6 KiB
C#
Raw Normal View History

2016-10-15 07:23:27 +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 osu.Framework.Graphics;
using osu.Framework.Graphics.Transformations;
2016-11-14 17:54:24 +08:00
using osu.Game.Modes.Taiko.UI;
2016-11-14 16:23:33 +08:00
using OpenTK.Graphics;
2016-10-15 07:23:27 +08:00
2016-11-14 17:54:24 +08:00
namespace osu.Game.Modes.Mania.UI
2016-10-15 07:23:27 +08:00
{
/// <summary>
2016-10-16 04:03:51 +08:00
/// Similar to osu!taiko, with a pop-out animation when failing (rolling). Used in osu!mania.
2016-10-15 07:23:27 +08:00
/// </summary>
public class ManiaComboCounter : TaikoComboCounter
{
protected ushort KeysHeld = 0;
2016-10-15 07:23:27 +08:00
protected Color4 OriginalColour;
protected Color4 TintColour => Color4.Orange;
protected EasingTypes TintEasing => EasingTypes.None;
protected int TintDuration => 500;
2016-10-15 07:23:27 +08:00
protected Color4 PopOutColor => Color4.Red;
protected override float PopOutInitialAlpha => 1.0f;
2016-10-17 07:30:25 +08:00
protected override double PopOutDuration => 300;
2016-10-15 07:23:27 +08:00
protected override void LoadComplete()
2016-10-15 07:23:27 +08:00
{
base.LoadComplete();
2016-10-15 07:23:27 +08:00
PopOutCount.Anchor = Anchor.BottomCentre;
PopOutCount.Origin = Anchor.Centre;
PopOutCount.FadeColour(PopOutColor, 0);
OriginalColour = DisplayedCountSpriteText.Colour;
2016-10-15 07:23:27 +08:00
}
protected override void OnCountRolling(ulong currentValue, ulong newValue)
2016-10-15 07:23:27 +08:00
{
if (!IsRolling && newValue < currentValue)
2016-10-15 07:23:27 +08:00
{
PopOutCount.Text = FormatCount(currentValue);
2016-10-15 07:23:27 +08:00
PopOutCount.FadeTo(PopOutInitialAlpha);
PopOutCount.ScaleTo(1.0f);
2016-10-15 07:23:27 +08:00
PopOutCount.FadeOut(PopOutDuration, PopOutEasing);
PopOutCount.ScaleTo(PopOutScale, PopOutDuration, PopOutEasing);
2016-10-15 07:23:27 +08:00
}
base.OnCountRolling(currentValue, newValue);
2016-10-15 07:23:27 +08:00
}
/// <summary>
/// Tints text while holding a key.
/// </summary>
/// <remarks>
/// Does not alter combo. This has to be done depending of the scoring system.
/// (i.e. v1 = each period of time; v2 = when starting and ending a key hold)
/// </remarks>
public void HoldStart()
{
if (KeysHeld == 0)
DisplayedCountSpriteText.FadeColour(TintColour, TintDuration, TintEasing);
KeysHeld++;
}
/// <summary>
/// Ends tinting.
/// </summary>
public void HoldEnd()
2016-10-15 07:23:27 +08:00
{
KeysHeld--;
if (KeysHeld == 0)
DisplayedCountSpriteText.FadeColour(OriginalColour, TintDuration, TintEasing);
2016-10-15 07:23:27 +08:00
}
}
}