2021-03-03 02:49:38 +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.
|
|
|
|
|
2021-03-15 16:05:29 +08:00
|
|
|
using System.Globalization;
|
2021-03-03 02:49:38 +08:00
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Bindables;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
|
|
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Skinning.Default
|
|
|
|
{
|
2021-03-12 07:38:40 +08:00
|
|
|
public class DefaultSpinner : CompositeDrawable
|
2021-03-03 02:49:38 +08:00
|
|
|
{
|
|
|
|
private DrawableSpinner drawableSpinner;
|
|
|
|
|
2021-03-12 07:38:40 +08:00
|
|
|
private OsuSpriteText bonusCounter;
|
|
|
|
|
|
|
|
public DefaultSpinner()
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
Anchor = Anchor.Centre;
|
|
|
|
Origin = Anchor.Centre;
|
|
|
|
}
|
2021-03-03 02:49:38 +08:00
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(DrawableHitObject drawableHitObject)
|
|
|
|
{
|
|
|
|
drawableSpinner = (DrawableSpinner)drawableHitObject;
|
|
|
|
|
2021-03-12 07:38:40 +08:00
|
|
|
AddRangeInternal(new Drawable[]
|
2021-03-03 02:49:38 +08:00
|
|
|
{
|
2021-03-12 07:38:40 +08:00
|
|
|
new DefaultSpinnerDisc
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
},
|
|
|
|
bonusCounter = new OsuSpriteText
|
|
|
|
{
|
|
|
|
Alpha = 0,
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
Font = OsuFont.Numeric.With(size: 24),
|
|
|
|
Y = -120,
|
|
|
|
}
|
|
|
|
});
|
2021-03-03 02:49:38 +08:00
|
|
|
}
|
|
|
|
|
2021-03-12 07:38:40 +08:00
|
|
|
private IBindable<double> gainedBonus;
|
|
|
|
|
2021-03-03 02:49:38 +08:00
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
gainedBonus = drawableSpinner.GainedBonus.GetBoundCopy();
|
|
|
|
gainedBonus.BindValueChanged(bonus =>
|
|
|
|
{
|
2021-03-15 16:05:29 +08:00
|
|
|
bonusCounter.Text = bonus.NewValue.ToString(NumberFormatInfo.InvariantInfo);
|
2021-03-03 02:49:38 +08:00
|
|
|
bonusCounter.FadeOutFromOne(1500);
|
|
|
|
bonusCounter.ScaleTo(1.5f).Then().ScaleTo(1f, 1000, Easing.OutQuint);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|