1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 13:37:25 +08:00

Make AdjustRank Bindable and fix issue

This commit is contained in:
iiSaLMaN 2019-04-21 17:55:01 +03:00 committed by GitHub
parent 77614189c9
commit b200142afb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -98,20 +98,21 @@ namespace osu.Game.Rulesets.Scoring
/// <summary>
/// Used by specific mods to adjust <see cref="Rank"/>.
/// </summary>
public bool AdjustRank { get; set; }
public BindableBool AdjustRank = new BindableBool();
protected ScoreProcessor()
{
Combo.ValueChanged += delegate { HighestCombo.Value = Math.Max(HighestCombo.Value, Combo.Value); };
Accuracy.ValueChanged += delegate { Rank.Value = rankFrom(Accuracy.Value); };
AdjustRank.ValueChanged += delegate { Rank.Value = rankFrom(Accuracy.Value); }; // Update rank immediately if AdjustRank was changed
}
private ScoreRank rankFrom(double acc)
{
if (acc == 1)
return (AdjustRank ? ScoreRank.XH : ScoreRank.X);
return (AdjustRank.Value ? ScoreRank.XH : ScoreRank.X);
if (acc > 0.95)
return (AdjustRank ? ScoreRank.SH : ScoreRank.S);
return (AdjustRank.Value ? ScoreRank.SH : ScoreRank.S);
if (acc > 0.9)
return ScoreRank.A;
if (acc > 0.8)
@ -128,6 +129,7 @@ namespace osu.Game.Rulesets.Scoring
/// <param name="storeResults">Whether to store the current state of the <see cref="ScoreProcessor"/> for future use.</param>
protected virtual void Reset(bool storeResults)
{
AdjustRank.Value = false;
TotalScore.Value = 0;
Accuracy.Value = 1;
Health.Value = 1;