mirror of
https://github.com/osukey/osukey.git
synced 2025-05-20 04:57:38 +09:00
Don't recreate explosion counter each increment
This commit is contained in:
parent
f629c33dc0
commit
a27a65bf03
@ -16,19 +16,14 @@ namespace osu.Game.Rulesets.Catch.Skinning
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class LegacyComboCounter : CompositeDrawable, ICatchComboCounter
|
public class LegacyComboCounter : CompositeDrawable, ICatchComboCounter
|
||||||
{
|
{
|
||||||
private readonly ISkin skin;
|
|
||||||
|
|
||||||
private readonly string fontName;
|
|
||||||
private readonly float fontOverlap;
|
|
||||||
|
|
||||||
private readonly LegacyRollingCounter counter;
|
private readonly LegacyRollingCounter counter;
|
||||||
|
|
||||||
|
private readonly LegacyRollingCounter explosion;
|
||||||
|
|
||||||
public LegacyComboCounter(ISkin skin)
|
public LegacyComboCounter(ISkin skin)
|
||||||
{
|
{
|
||||||
this.skin = skin;
|
var fontName = skin.GetConfig<LegacySetting, string>(LegacySetting.ComboPrefix)?.Value ?? "score";
|
||||||
|
var fontOverlap = skin.GetConfig<LegacySetting, float>(LegacySetting.ComboOverlap)?.Value ?? -2f;
|
||||||
fontName = skin.GetConfig<LegacySetting, string>(LegacySetting.ComboPrefix)?.Value ?? "score";
|
|
||||||
fontOverlap = skin.GetConfig<LegacySetting, float>(LegacySetting.ComboOverlap)?.Value ?? -2f;
|
|
||||||
|
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
|
|
||||||
@ -37,18 +32,27 @@ namespace osu.Game.Rulesets.Catch.Skinning
|
|||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
Scale = new Vector2(0.8f);
|
Scale = new Vector2(0.8f);
|
||||||
|
|
||||||
InternalChild = counter = new LegacyRollingCounter(skin, fontName, fontOverlap)
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
explosion = new LegacyRollingCounter(skin, fontName, fontOverlap)
|
||||||
Origin = Anchor.Centre,
|
{
|
||||||
|
Alpha = 0.65f,
|
||||||
|
Blending = BlendingParameters.Additive,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Scale = new Vector2(1.5f),
|
||||||
|
},
|
||||||
|
counter = new LegacyRollingCounter(skin, fontName, fontOverlap)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DisplayInitialCombo(int combo) => updateCombo(combo, null, true);
|
public void DisplayInitialCombo(int combo) => updateCombo(combo, null, true);
|
||||||
public void UpdateCombo(int combo, Color4? hitObjectColour) => updateCombo(combo, hitObjectColour, false);
|
public void UpdateCombo(int combo, Color4? hitObjectColour) => updateCombo(combo, hitObjectColour, false);
|
||||||
|
|
||||||
private LegacyRollingCounter lastExplosion;
|
|
||||||
|
|
||||||
private void updateCombo(int combo, Color4? hitObjectColour, bool immediate)
|
private void updateCombo(int combo, Color4? hitObjectColour, bool immediate)
|
||||||
{
|
{
|
||||||
// There may still be existing transforms to the counter (including value change after 250ms),
|
// There may still be existing transforms to the counter (including value change after 250ms),
|
||||||
@ -59,17 +63,12 @@ namespace osu.Game.Rulesets.Catch.Skinning
|
|||||||
if (combo == 0)
|
if (combo == 0)
|
||||||
{
|
{
|
||||||
counter.Current.Value = 0;
|
counter.Current.Value = 0;
|
||||||
if (lastExplosion != null)
|
explosion.Current.Value = 0;
|
||||||
lastExplosion.Current.Value = 0;
|
|
||||||
|
|
||||||
this.FadeOut(immediate ? 0.0 : 400.0, Easing.Out);
|
this.FadeOut(immediate ? 0.0 : 400.0, Easing.Out);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove last explosion to not conflict with the upcoming one.
|
|
||||||
if (lastExplosion != null)
|
|
||||||
RemoveInternal(lastExplosion);
|
|
||||||
|
|
||||||
this.FadeIn().Delay(1000.0).FadeOut(300.0);
|
this.FadeIn().Delay(1000.0).FadeOut(300.0);
|
||||||
|
|
||||||
// For simplicity, in the case of rewinding we'll just set the counter to the current combo value.
|
// For simplicity, in the case of rewinding we'll just set the counter to the current combo value.
|
||||||
@ -86,25 +85,11 @@ namespace osu.Game.Rulesets.Catch.Skinning
|
|||||||
|
|
||||||
counter.Delay(250.0).ScaleTo(1f).ScaleTo(1.1f, 60.0).Then().ScaleTo(1f, 30.0);
|
counter.Delay(250.0).ScaleTo(1f).ScaleTo(1.1f, 60.0).Then().ScaleTo(1f, 30.0);
|
||||||
|
|
||||||
var explosion = new LegacyRollingCounter(skin, fontName, fontOverlap)
|
explosion.Colour = hitObjectColour ?? Color4.White;
|
||||||
{
|
|
||||||
Alpha = 0.65f,
|
|
||||||
Blending = BlendingParameters.Additive,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Scale = new Vector2(1.5f),
|
|
||||||
Colour = hitObjectColour ?? Color4.White,
|
|
||||||
Depth = 1f,
|
|
||||||
};
|
|
||||||
|
|
||||||
AddInternal(explosion);
|
|
||||||
|
|
||||||
explosion.SetCountWithoutRolling(combo);
|
explosion.SetCountWithoutRolling(combo);
|
||||||
explosion.ScaleTo(1.9f, 400.0, Easing.Out)
|
explosion.ScaleTo(1.5f).ScaleTo(1.9f, 400.0, Easing.Out)
|
||||||
.FadeOut(400.0)
|
.FadeOutFromOne(400.0);
|
||||||
.Expire(true);
|
|
||||||
|
|
||||||
lastExplosion = explosion;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user