mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 08:32:57 +08:00
Simplify argon mania combo counter implementation by sharing with base counter
This commit is contained in:
parent
3f20f05801
commit
161734af95
@ -4,41 +4,13 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.UI.Scrolling;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Skinning.Argon
|
||||
{
|
||||
public partial class ArgonManiaComboCounter : ComboCounter
|
||||
public partial class ArgonManiaComboCounter : ArgonComboCounter
|
||||
{
|
||||
private OsuSpriteText text = null!;
|
||||
|
||||
protected override double RollingDuration => 500;
|
||||
protected override Easing RollingEasing => Easing.OutQuint;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(ScoreProcessor scoreProcessor)
|
||||
{
|
||||
Current.BindTo(scoreProcessor.Combo);
|
||||
Current.BindValueChanged(combo =>
|
||||
{
|
||||
if (combo.OldValue == 0 && combo.NewValue > 0)
|
||||
text.FadeIn(200, Easing.OutQuint);
|
||||
else if (combo.OldValue > 0 && combo.NewValue == 0)
|
||||
{
|
||||
if (combo.OldValue > 1)
|
||||
text.FlashColour(Color4.Red, 2000, Easing.OutQuint);
|
||||
|
||||
text.FadeOut(200, Easing.InQuint);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[Resolved]
|
||||
private IScrollingInfo scrollingInfo { get; set; } = null!;
|
||||
|
||||
@ -47,7 +19,6 @@ namespace osu.Game.Rulesets.Mania.Skinning.Argon
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
text.Alpha = Current.Value > 0 ? 1 : 0;
|
||||
|
||||
direction = scrollingInfo.Direction.GetBoundCopy();
|
||||
direction.BindValueChanged(_ => updateAnchor());
|
||||
@ -67,10 +38,5 @@ namespace osu.Game.Rulesets.Mania.Skinning.Argon
|
||||
if ((Y < 0 && direction.Value == ScrollingDirection.Down) || (Y > 0 && direction.Value == ScrollingDirection.Up))
|
||||
Y = -Y;
|
||||
}
|
||||
|
||||
protected override IHasText CreateText() => text = new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.Torus.With(size: 32, fixedWidth: true),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ namespace osu.Game.Rulesets.Mania.Skinning.Argon
|
||||
|
||||
if (combo != null)
|
||||
{
|
||||
combo.ShowLabel.Value = false;
|
||||
combo.Anchor = Anchor.TopCentre;
|
||||
combo.Origin = Anchor.Centre;
|
||||
combo.Y = 200;
|
||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public partial class ArgonComboCounter : ComboCounter
|
||||
{
|
||||
private ArgonCounterTextComponent text = null!;
|
||||
protected ArgonCounterTextComponent Text = null!;
|
||||
|
||||
protected override double RollingDuration => 250;
|
||||
|
||||
@ -43,16 +43,16 @@ namespace osu.Game.Screens.Play.HUD
|
||||
bool wasIncrease = combo.NewValue > combo.OldValue;
|
||||
bool wasMiss = combo.OldValue > 1 && combo.NewValue == 0;
|
||||
|
||||
float newScale = Math.Clamp(text.NumberContainer.Scale.X * (wasIncrease ? 1.1f : 0.8f), 0.6f, 1.4f);
|
||||
float newScale = Math.Clamp(Text.NumberContainer.Scale.X * (wasIncrease ? 1.1f : 0.8f), 0.6f, 1.4f);
|
||||
|
||||
float duration = wasMiss ? 2000 : 500;
|
||||
|
||||
text.NumberContainer
|
||||
Text.NumberContainer
|
||||
.ScaleTo(new Vector2(newScale))
|
||||
.ScaleTo(Vector2.One, duration, Easing.OutQuint);
|
||||
|
||||
if (wasMiss)
|
||||
text.FlashColour(Color4.Red, duration, Easing.OutQuint);
|
||||
Text.FlashColour(Color4.Red, duration, Easing.OutQuint);
|
||||
});
|
||||
}
|
||||
|
||||
@ -70,8 +70,8 @@ namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
int digitsRequiredForDisplayCount = getDigitsRequiredForDisplayCount();
|
||||
|
||||
if (digitsRequiredForDisplayCount != text.WireframeTemplate.Length)
|
||||
text.WireframeTemplate = new string('#', digitsRequiredForDisplayCount);
|
||||
if (digitsRequiredForDisplayCount != Text.WireframeTemplate.Length)
|
||||
Text.WireframeTemplate = new string('#', digitsRequiredForDisplayCount);
|
||||
}
|
||||
|
||||
private int getDigitsRequiredForDisplayCount()
|
||||
@ -86,7 +86,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
|
||||
protected override LocalisableString FormatCount(int count) => $@"{count}x";
|
||||
|
||||
protected override IHasText CreateText() => text = new ArgonCounterTextComponent(Anchor.TopLeft, MatchesStrings.MatchScoreStatsCombo.ToUpper())
|
||||
protected override IHasText CreateText() => Text = new ArgonCounterTextComponent(Anchor.TopLeft, MatchesStrings.MatchScoreStatsCombo.ToUpper())
|
||||
{
|
||||
WireframeOpacity = { BindTarget = WireframeOpacity },
|
||||
ShowLabel = { BindTarget = ShowLabel },
|
||||
|
Loading…
Reference in New Issue
Block a user