mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 20:03:21 +08:00
Add legacy spinner SPM counter support
This commit is contained in:
parent
0bf84e473d
commit
f848ef5347
@ -28,6 +28,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
|
|
||||||
protected const float SPRITE_SCALE = 0.625f;
|
protected const float SPRITE_SCALE = 0.625f;
|
||||||
|
|
||||||
|
private const float spm_hide_offset = 50f;
|
||||||
|
|
||||||
protected DrawableSpinner DrawableSpinner { get; private set; }
|
protected DrawableSpinner DrawableSpinner { get; private set; }
|
||||||
|
|
||||||
private Sprite spin;
|
private Sprite spin;
|
||||||
@ -35,6 +37,9 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
|
|
||||||
private LegacySpriteText bonusCounter;
|
private LegacySpriteText bonusCounter;
|
||||||
|
|
||||||
|
private Sprite spmBackground;
|
||||||
|
private LegacySpriteText spmCounter;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(DrawableHitObject drawableHitObject, ISkinSource source)
|
private void load(DrawableHitObject drawableHitObject, ISkinSource source)
|
||||||
{
|
{
|
||||||
@ -79,11 +84,27 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
Scale = new Vector2(SPRITE_SCALE),
|
Scale = new Vector2(SPRITE_SCALE),
|
||||||
Y = SPINNER_TOP_OFFSET + 299,
|
Y = SPINNER_TOP_OFFSET + 299,
|
||||||
}.With(s => s.Font = s.Font.With(fixedWidth: false)),
|
}.With(s => s.Font = s.Font.With(fixedWidth: false)),
|
||||||
|
spmBackground = new Sprite
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.TopLeft,
|
||||||
|
Texture = source.GetTexture("spinner-rpm"),
|
||||||
|
Scale = new Vector2(SPRITE_SCALE),
|
||||||
|
Position = new Vector2(-87, 445 + spm_hide_offset),
|
||||||
|
},
|
||||||
|
spmCounter = new LegacySpriteText(source, LegacyFont.Score)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
Scale = new Vector2(SPRITE_SCALE * 0.9f),
|
||||||
|
Position = new Vector2(80, 448 + spm_hide_offset),
|
||||||
|
}.With(s => s.Font = s.Font.With(fixedWidth: false)),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private IBindable<double> gainedBonus;
|
private IBindable<double> gainedBonus;
|
||||||
|
private IBindable<double> spinsPerMinute;
|
||||||
|
|
||||||
private readonly Bindable<bool> completed = new Bindable<bool>();
|
private readonly Bindable<bool> completed = new Bindable<bool>();
|
||||||
|
|
||||||
@ -99,6 +120,12 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
bonusCounter.ScaleTo(SPRITE_SCALE * 2f).Then().ScaleTo(SPRITE_SCALE * 1.28f, 800, Easing.Out);
|
bonusCounter.ScaleTo(SPRITE_SCALE * 2f).Then().ScaleTo(SPRITE_SCALE * 1.28f, 800, Easing.Out);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
spinsPerMinute = DrawableSpinner.SpinsPerMinute.GetBoundCopy();
|
||||||
|
spinsPerMinute.BindValueChanged(spm =>
|
||||||
|
{
|
||||||
|
spmCounter.Text = Math.Truncate(spm.NewValue).ToString(@"#0");
|
||||||
|
}, true);
|
||||||
|
|
||||||
completed.BindValueChanged(onCompletedChanged, true);
|
completed.BindValueChanged(onCompletedChanged, true);
|
||||||
|
|
||||||
DrawableSpinner.ApplyCustomUpdateState += UpdateStateTransforms;
|
DrawableSpinner.ApplyCustomUpdateState += UpdateStateTransforms;
|
||||||
@ -142,10 +169,16 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
switch (drawableHitObject)
|
switch (drawableHitObject)
|
||||||
{
|
{
|
||||||
case DrawableSpinner d:
|
case DrawableSpinner d:
|
||||||
double fadeOutLength = Math.Min(400, d.HitObject.Duration);
|
using (BeginAbsoluteSequence(d.HitObject.StartTime - d.HitObject.TimeFadeIn))
|
||||||
|
{
|
||||||
|
spmBackground.MoveToOffset(new Vector2(0, -spm_hide_offset), d.HitObject.TimeFadeIn, Easing.Out);
|
||||||
|
spmCounter.MoveToOffset(new Vector2(0, -spm_hide_offset), d.HitObject.TimeFadeIn, Easing.Out);
|
||||||
|
}
|
||||||
|
|
||||||
using (BeginAbsoluteSequence(drawableHitObject.HitStateUpdateTime - fadeOutLength, true))
|
double spinFadeOutLength = Math.Min(400, d.HitObject.Duration);
|
||||||
spin.FadeOutFromOne(fadeOutLength);
|
|
||||||
|
using (BeginAbsoluteSequence(drawableHitObject.HitStateUpdateTime - spinFadeOutLength, true))
|
||||||
|
spin.FadeOutFromOne(spinFadeOutLength);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DrawableSpinnerTick d:
|
case DrawableSpinnerTick d:
|
||||||
|
Loading…
Reference in New Issue
Block a user