1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 00:02:56 +08:00

Update bindable flow to expose every spin, even after max bonus is reached

This commit is contained in:
Dean Herbert 2023-10-20 15:37:51 +09:00
parent f36a671eb4
commit f16400929d
No known key found for this signature in database
4 changed files with 26 additions and 27 deletions

View File

@ -48,9 +48,16 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
/// <summary> /// <summary>
/// The amount of bonus score gained from spinning after the required number of spins, for display purposes. /// The amount of bonus score gained from spinning after the required number of spins, for display purposes.
/// </summary> /// </summary>
public IBindable<double> GainedBonus => gainedBonus; public double CurrentBonusScore => score_per_tick * (completedFullSpins.Value - HitObject.SpinsRequiredForBonus);
private readonly Bindable<double> gainedBonus = new BindableDouble(); /// <summary>
/// The maximum amount of bonus score which can be achieved from extra spins.
/// </summary>
public double MaximumBonusScore => score_per_tick * HitObject.MaximumBonusSpins;
public IBindable<int> CompletedFullSpins => completedFullSpins;
private readonly Bindable<int> completedFullSpins = new Bindable<int>();
/// <summary> /// <summary>
/// The number of spins per minute this spinner is spinning at, for display purposes. /// The number of spins per minute this spinner is spinning at, for display purposes.
@ -286,8 +293,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
private static readonly int score_per_tick = new SpinnerBonusTick.OsuSpinnerBonusTickJudgement().MaxNumericResult; private static readonly int score_per_tick = new SpinnerBonusTick.OsuSpinnerBonusTickJudgement().MaxNumericResult;
private int completedFullSpins;
private void updateBonusScore() private void updateBonusScore()
{ {
if (ticks.Count == 0) if (ticks.Count == 0)
@ -295,27 +300,21 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
int spins = (int)(Result.TotalRotation / 360); int spins = (int)(Result.TotalRotation / 360);
if (spins < completedFullSpins) if (spins < completedFullSpins.Value)
{ {
// rewinding, silently handle // rewinding, silently handle
completedFullSpins = spins; completedFullSpins.Value = spins;
return; return;
} }
while (completedFullSpins != spins) while (completedFullSpins.Value != spins)
{ {
var tick = ticks.FirstOrDefault(t => !t.Result.HasResult); var tick = ticks.FirstOrDefault(t => !t.Result.HasResult);
// tick may be null if we've hit the spin limit. // tick may be null if we've hit the spin limit.
if (tick != null) tick?.TriggerResult(true);
{
tick.TriggerResult(true);
if (tick is DrawableSpinnerBonusTick) completedFullSpins.Value++;
gainedBonus.Value = score_per_tick * (spins - HitObject.SpinsRequiredForBonus);
}
completedFullSpins++;
} }
} }
} }

View File

@ -85,17 +85,17 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
}; };
} }
private IBindable<double> gainedBonus = null!; private IBindable<int> completedSpins = null!;
private IBindable<double> spinsPerMinute = null!; private IBindable<double> spinsPerMinute = null!;
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
gainedBonus = drawableSpinner.GainedBonus.GetBoundCopy(); completedSpins = drawableSpinner.CompletedFullSpins.GetBoundCopy();
gainedBonus.BindValueChanged(bonus => completedSpins.BindValueChanged(bonus =>
{ {
bonusCounter.Text = bonus.NewValue.ToString(NumberFormatInfo.InvariantInfo); bonusCounter.Text = drawableSpinner.CurrentBonusScore.ToString(NumberFormatInfo.InvariantInfo);
bonusCounter.FadeOutFromOne(1500); bonusCounter.FadeOutFromOne(1500);
bonusCounter.ScaleTo(1.5f).Then().ScaleTo(1f, 1000, Easing.OutQuint); bonusCounter.ScaleTo(1.5f).Then().ScaleTo(1f, 1000, Easing.OutQuint);
}); });

View File

@ -80,17 +80,17 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
}); });
} }
private IBindable<double> gainedBonus = null!; private IBindable<int> completedSpins = null!;
private IBindable<double> spinsPerMinute = null!; private IBindable<double> spinsPerMinute = null!;
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
gainedBonus = drawableSpinner.GainedBonus.GetBoundCopy(); completedSpins = drawableSpinner.CompletedFullSpins.GetBoundCopy();
gainedBonus.BindValueChanged(bonus => completedSpins.BindValueChanged(bonus =>
{ {
bonusCounter.Text = bonus.NewValue.ToString(NumberFormatInfo.InvariantInfo); bonusCounter.Text = drawableSpinner.CurrentBonusScore.ToString(NumberFormatInfo.InvariantInfo);
bonusCounter.FadeOutFromOne(1500); bonusCounter.FadeOutFromOne(1500);
bonusCounter.ScaleTo(1.5f).Then().ScaleTo(1f, 1000, Easing.OutQuint); bonusCounter.ScaleTo(1.5f).Then().ScaleTo(1f, 1000, Easing.OutQuint);
}); });

View File

@ -107,7 +107,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
}); });
} }
private IBindable<double> gainedBonus = null!; private IBindable<int> completedSpins = null!;
private IBindable<double> spinsPerMinute = null!; private IBindable<double> spinsPerMinute = null!;
private readonly Bindable<bool> completed = new Bindable<bool>(); private readonly Bindable<bool> completed = new Bindable<bool>();
@ -116,10 +116,10 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
{ {
base.LoadComplete(); base.LoadComplete();
gainedBonus = DrawableSpinner.GainedBonus.GetBoundCopy(); completedSpins = DrawableSpinner.CompletedFullSpins.GetBoundCopy();
gainedBonus.BindValueChanged(bonus => completedSpins.BindValueChanged(bonus =>
{ {
bonusCounter.Text = bonus.NewValue.ToString(NumberFormatInfo.InvariantInfo); bonusCounter.Text = DrawableSpinner.CurrentBonusScore.ToString(NumberFormatInfo.InvariantInfo);
bonusCounter.FadeOutFromOne(800, Easing.Out); bonusCounter.FadeOutFromOne(800, Easing.Out);
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);
}); });