1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 15:17:44 +08:00
osu-lazer/osu.Game/Screens/Play/HUD/ArgonComboCounter.cs

48 lines
1.6 KiB
C#
Raw Normal View History

2023-10-26 13:59:04 +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.Allocation;
using osu.Framework.Bindables;
2023-10-26 13:59:04 +08:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Configuration;
2023-10-26 13:59:04 +08:00
using osu.Game.Rulesets.Scoring;
2023-11-10 14:06:07 +08:00
using osuTK;
2023-10-26 13:59:04 +08:00
namespace osu.Game.Screens.Play.HUD
{
public partial class ArgonComboCounter : ComboCounter
{
2023-11-10 14:06:07 +08:00
protected override double RollingDuration => 500;
protected override Easing RollingEasing => Easing.OutQuint;
[SettingSource("Wireframe opacity", "Controls the opacity of the wire frames behind the digits.")]
public BindableFloat WireframeOpacity { get; } = new BindableFloat(0.4f)
{
Precision = 0.01f,
MinValue = 0,
MaxValue = 1,
};
2023-10-26 13:59:04 +08:00
[BackgroundDependencyLoader]
private void load(ScoreProcessor scoreProcessor)
{
Current.BindTo(scoreProcessor.Combo);
2023-11-10 14:06:07 +08:00
Current.BindValueChanged(combo =>
{
bool wasIncrease = combo.NewValue > combo.OldValue;
DrawableCount.ScaleTo(new Vector2(1, wasIncrease ? 1.2f : 0.8f))
.ScaleTo(Vector2.One, 600, Easing.OutQuint);
});
2023-10-26 13:59:04 +08:00
}
protected override LocalisableString FormatCount(int count) => $@"{count}x";
2023-10-26 13:59:04 +08:00
protected override IHasText CreateText() => new ArgonCounterTextComponent(Anchor.TopLeft, "COMBO")
2023-10-26 13:59:04 +08:00
{
WireframeOpacity = { BindTarget = WireframeOpacity },
};
2023-10-26 13:59:04 +08:00
}
}