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 OpenTK.Graphics;
|
|
|
|
|
using osu.Framework;
|
|
|
|
|
using osu.Framework.Graphics;
|
2016-10-17 06:45:37 +08:00
|
|
|
|
using osu.Framework.Graphics.Transformations;
|
2016-10-15 07:23:27 +08:00
|
|
|
|
using osu.Game.GameModes.Play.Taiko;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.GameModes.Play.Mania
|
|
|
|
|
{
|
|
|
|
|
/// <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
|
|
|
|
|
|
|
|
|
public override void Load(BaseGame game)
|
|
|
|
|
{
|
|
|
|
|
base.Load(game);
|
|
|
|
|
|
|
|
|
|
PopOutSpriteText.Anchor = Anchor.BottomCentre;
|
|
|
|
|
PopOutSpriteText.Origin = Anchor.Centre;
|
|
|
|
|
PopOutSpriteText.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-10-16 07:06:31 +08:00
|
|
|
|
PopOutSpriteText.Text = FormatCount(currentValue);
|
2016-10-15 07:23:27 +08:00
|
|
|
|
|
|
|
|
|
PopOutSpriteText.FadeTo(PopOutInitialAlpha);
|
|
|
|
|
PopOutSpriteText.ScaleTo(1.0f);
|
|
|
|
|
|
|
|
|
|
PopOutSpriteText.FadeOut(PopOutDuration, PopOutEasing);
|
|
|
|
|
PopOutSpriteText.ScaleTo(PopOutScale, PopOutDuration, PopOutEasing);
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|