2017-02-07 12:59:30 +08: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-15 07:23:27 +08:00
|
|
|
|
|
|
|
|
|
using osu.Framework.Graphics;
|
2016-10-17 06:45:37 +08:00
|
|
|
|
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
|
|
|
|
|
{
|
2016-10-17 06:45:37 +08:00
|
|
|
|
protected ushort KeysHeld = 0;
|
|
|
|
|
|
2016-10-15 07:23:27 +08:00
|
|
|
|
protected Color4 OriginalColour;
|
|
|
|
|
|
2016-10-17 06:45:37 +08:00
|
|
|
|
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
|
|
|
|
|
2016-11-06 18:13:52 +08:00
|
|
|
|
protected override void LoadComplete()
|
2016-10-15 07:23:27 +08:00
|
|
|
|
{
|
2016-11-06 18:13:52 +08:00
|
|
|
|
base.LoadComplete();
|
2016-10-15 07:23:27 +08:00
|
|
|
|
|
2016-11-19 15:19:54 +08:00
|
|
|
|
PopOutCount.Anchor = Anchor.BottomCentre;
|
|
|
|
|
PopOutCount.Origin = Anchor.Centre;
|
|
|
|
|
PopOutCount.FadeColour(PopOutColor, 0);
|
2016-10-17 06:45:37 +08:00
|
|
|
|
OriginalColour = DisplayedCountSpriteText.Colour;
|
2016-10-15 07:23:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-16 07:06:31 +08:00
|
|
|
|
protected override void OnCountRolling(ulong currentValue, ulong newValue)
|
2016-10-15 07:23:27 +08:00
|
|
|
|
{
|
2016-10-16 07:06:31 +08:00
|
|
|
|
if (!IsRolling && newValue < currentValue)
|
2016-10-15 07:23:27 +08:00
|
|
|
|
{
|
2016-11-19 15:19:54 +08:00
|
|
|
|
PopOutCount.Text = FormatCount(currentValue);
|
2016-10-15 07:23:27 +08:00
|
|
|
|
|
2016-11-19 15:19:54 +08:00
|
|
|
|
PopOutCount.FadeTo(PopOutInitialAlpha);
|
|
|
|
|
PopOutCount.ScaleTo(1.0f);
|
2016-10-15 07:23:27 +08:00
|
|
|
|
|
2016-11-19 15:19:54 +08:00
|
|
|
|
PopOutCount.FadeOut(PopOutDuration, PopOutEasing);
|
|
|
|
|
PopOutCount.ScaleTo(PopOutScale, PopOutDuration, PopOutEasing);
|
2016-10-15 07:23:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-16 07:06:31 +08:00
|
|
|
|
base.OnCountRolling(currentValue, newValue);
|
2016-10-15 07:23:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-17 06:45:37 +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
|
|
|
|
{
|
2016-10-17 06:45:37 +08:00
|
|
|
|
KeysHeld--;
|
|
|
|
|
if (KeysHeld == 0)
|
|
|
|
|
DisplayedCountSpriteText.FadeColour(OriginalColour, TintDuration, TintEasing);
|
2016-10-15 07:23:27 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|