2020-07-21 18:03:17 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2020-09-29 13:35:43 +08:00
|
|
|
using osu.Game.Rulesets.Judgements;
|
2020-07-21 18:03:17 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|
|
|
{
|
|
|
|
/// <summary>
|
2020-07-24 18:41:34 +08:00
|
|
|
/// Shows incremental bonus score achieved for a spinner.
|
2020-07-21 18:03:17 +08:00
|
|
|
/// </summary>
|
|
|
|
public class SpinnerBonusDisplay : CompositeDrawable
|
|
|
|
{
|
|
|
|
private readonly OsuSpriteText bonusCounter;
|
|
|
|
|
|
|
|
public SpinnerBonusDisplay()
|
|
|
|
{
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
|
|
|
|
InternalChild = bonusCounter = new OsuSpriteText
|
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
Font = OsuFont.Numeric.With(size: 24),
|
|
|
|
Alpha = 0,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
private int displayedCount;
|
|
|
|
|
|
|
|
public void SetBonusCount(int count)
|
|
|
|
{
|
|
|
|
if (displayedCount == count)
|
|
|
|
return;
|
|
|
|
|
|
|
|
displayedCount = count;
|
2020-09-29 13:35:43 +08:00
|
|
|
bonusCounter.Text = $"{Judgement.LARGE_BONUS_SCORE * count}";
|
2020-07-21 18:03:17 +08:00
|
|
|
bonusCounter.FadeOutFromOne(1500);
|
|
|
|
bonusCounter.ScaleTo(1.5f).Then().ScaleTo(1f, 1000, Easing.OutQuint);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|