mirror of
https://github.com/ppy/osu
synced 2025-01-21 05:20:50 +00:00
Update bindable flow to expose every spin, even after max bonus is reached
This commit is contained in:
parent
f36a671eb4
commit
f16400929d
@ -48,9 +48,16 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
/// <summary>
|
||||
/// The amount of bonus score gained from spinning after the required number of spins, for display purposes.
|
||||
/// </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>
|
||||
/// 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 int completedFullSpins;
|
||||
|
||||
private void updateBonusScore()
|
||||
{
|
||||
if (ticks.Count == 0)
|
||||
@ -295,27 +300,21 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
|
||||
int spins = (int)(Result.TotalRotation / 360);
|
||||
|
||||
if (spins < completedFullSpins)
|
||||
if (spins < completedFullSpins.Value)
|
||||
{
|
||||
// rewinding, silently handle
|
||||
completedFullSpins = spins;
|
||||
completedFullSpins.Value = spins;
|
||||
return;
|
||||
}
|
||||
|
||||
while (completedFullSpins != spins)
|
||||
while (completedFullSpins.Value != spins)
|
||||
{
|
||||
var tick = ticks.FirstOrDefault(t => !t.Result.HasResult);
|
||||
|
||||
// tick may be null if we've hit the spin limit.
|
||||
if (tick != null)
|
||||
{
|
||||
tick.TriggerResult(true);
|
||||
tick?.TriggerResult(true);
|
||||
|
||||
if (tick is DrawableSpinnerBonusTick)
|
||||
gainedBonus.Value = score_per_tick * (spins - HitObject.SpinsRequiredForBonus);
|
||||
}
|
||||
|
||||
completedFullSpins++;
|
||||
completedFullSpins.Value++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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!;
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
gainedBonus = drawableSpinner.GainedBonus.GetBoundCopy();
|
||||
gainedBonus.BindValueChanged(bonus =>
|
||||
completedSpins = drawableSpinner.CompletedFullSpins.GetBoundCopy();
|
||||
completedSpins.BindValueChanged(bonus =>
|
||||
{
|
||||
bonusCounter.Text = bonus.NewValue.ToString(NumberFormatInfo.InvariantInfo);
|
||||
bonusCounter.Text = drawableSpinner.CurrentBonusScore.ToString(NumberFormatInfo.InvariantInfo);
|
||||
bonusCounter.FadeOutFromOne(1500);
|
||||
bonusCounter.ScaleTo(1.5f).Then().ScaleTo(1f, 1000, Easing.OutQuint);
|
||||
});
|
||||
|
@ -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!;
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
gainedBonus = drawableSpinner.GainedBonus.GetBoundCopy();
|
||||
gainedBonus.BindValueChanged(bonus =>
|
||||
completedSpins = drawableSpinner.CompletedFullSpins.GetBoundCopy();
|
||||
completedSpins.BindValueChanged(bonus =>
|
||||
{
|
||||
bonusCounter.Text = bonus.NewValue.ToString(NumberFormatInfo.InvariantInfo);
|
||||
bonusCounter.Text = drawableSpinner.CurrentBonusScore.ToString(NumberFormatInfo.InvariantInfo);
|
||||
bonusCounter.FadeOutFromOne(1500);
|
||||
bonusCounter.ScaleTo(1.5f).Then().ScaleTo(1f, 1000, Easing.OutQuint);
|
||||
});
|
||||
|
@ -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 readonly Bindable<bool> completed = new Bindable<bool>();
|
||||
@ -116,10 +116,10 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
gainedBonus = DrawableSpinner.GainedBonus.GetBoundCopy();
|
||||
gainedBonus.BindValueChanged(bonus =>
|
||||
completedSpins = DrawableSpinner.CompletedFullSpins.GetBoundCopy();
|
||||
completedSpins.BindValueChanged(bonus =>
|
||||
{
|
||||
bonusCounter.Text = bonus.NewValue.ToString(NumberFormatInfo.InvariantInfo);
|
||||
bonusCounter.Text = DrawableSpinner.CurrentBonusScore.ToString(NumberFormatInfo.InvariantInfo);
|
||||
bonusCounter.FadeOutFromOne(800, Easing.Out);
|
||||
bonusCounter.ScaleTo(SPRITE_SCALE * 2f).Then().ScaleTo(SPRITE_SCALE * 1.28f, 800, Easing.Out);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user