Add storeResults as a parameter to Reset

Whether to store the current state of the ScoreProcessor for future use.
This commit is contained in:
smoogipooo 2017-09-12 22:27:27 +09:00
parent 2e0218f388
commit b5f48c2368
5 changed files with 31 additions and 25 deletions

View File

@ -113,11 +113,7 @@ namespace osu.Game.Rulesets.Mania.Scoring
{
var holdNote = obj as HoldNote;
if (obj is Note)
{
AddJudgement(new ManiaJudgement { Result = HitResult.Perfect });
}
else if (holdNote != null)
if (holdNote != null)
{
// Head
AddJudgement(new ManiaJudgement { Result = HitResult.Perfect });
@ -126,9 +122,9 @@ namespace osu.Game.Rulesets.Mania.Scoring
int tickCount = holdNote.Ticks.Count();
for (int i = 0; i < tickCount; i++)
AddJudgement(new HoldNoteTickJudgement { Result = HitResult.Perfect });
AddJudgement(new HoldNoteTailJudgement { Result = HitResult.Perfect });
}
AddJudgement(new ManiaJudgement { Result = HitResult.Perfect });
}
if (!HasFailed)
@ -137,7 +133,7 @@ namespace osu.Game.Rulesets.Mania.Scoring
hpMultiplier *= 1.01;
hpMissMultiplier *= 0.98;
Reset();
Reset(false);
}
}

View File

@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Osu.Scoring
AddJudgement(new OsuJudgement { Result = HitResult.Great });
// Ticks
foreach (var tick in slider.Ticks)
foreach (var unused in slider.Ticks)
AddJudgement(new OsuJudgement { Result = HitResult.Great });
}
@ -54,9 +54,9 @@ namespace osu.Game.Rulesets.Osu.Scoring
}
}
protected override void Reset()
protected override void Reset(bool storeResults)
{
base.Reset();
base.Reset(storeResults);
scoreResultCounts.Clear();
comboResultCounts.Clear();

View File

@ -137,9 +137,9 @@ namespace osu.Game.Rulesets.Taiko.Scoring
}
}
protected override void Reset()
protected override void Reset(bool storeResults)
{
base.Reset();
base.Reset(storeResults);
Health.Value = 0;
}

View File

@ -25,8 +25,15 @@ namespace osu.Game.Rulesets.Judgements
/// </summary>
public double TimeOffset { get; internal set; }
/// <summary>
/// Whether the <see cref="Result"/> should be considered as a factor in the accuracy percentage and portion.
/// </summary>
public virtual bool AffectsAccuracy => true;
/// <summary>
/// Whether the <see cref="Result"/> should affect the combo portion of the score.
/// If false, the <see cref="Result"/> will be considered for the bonus portion of the score.
/// </summary>
public virtual bool AffectsCombo => true;
/// <summary>

View File

@ -73,8 +73,6 @@ namespace osu.Game.Rulesets.Scoring
protected ScoreProcessor()
{
Combo.ValueChanged += delegate { HighestCombo.Value = Math.Max(HighestCombo.Value, Combo.Value); };
Reset();
}
private ScoreRank rankFrom(double acc)
@ -95,7 +93,8 @@ namespace osu.Game.Rulesets.Scoring
/// <summary>
/// Resets this ScoreProcessor to a default state.
/// </summary>
protected virtual void Reset()
/// <param name="storeResults">Whether to store the current state of the <see cref="ScoreProcessor"/> for future use.</param>
protected virtual void Reset(bool storeResults)
{
TotalScore.Value = 0;
Accuracy.Value = 1;
@ -160,10 +159,11 @@ namespace osu.Game.Rulesets.Scoring
protected virtual double ComboPortion => 0.5f;
protected virtual double AccuracyPortion => 0.5f;
protected readonly int MaxHits;
protected int MaxHits { get; private set; }
protected int Hits { get; private set; }
private readonly double maxComboScore;
private double maxHighestCombo;
private double maxComboScore;
private double comboScore;
protected ScoreProcessor()
@ -175,11 +175,7 @@ namespace osu.Game.Rulesets.Scoring
rulesetContainer.OnJudgement += AddJudgement;
SimulateAutoplay(rulesetContainer.Beatmap);
maxComboScore = comboScore;
MaxHits = Hits;
Reset();
Reset(true);
}
/// <summary>
@ -252,9 +248,16 @@ namespace osu.Game.Rulesets.Scoring
}
}
protected override void Reset()
protected override void Reset(bool storeResults)
{
base.Reset();
if (storeResults)
{
maxHighestCombo = HighestCombo;
maxComboScore = comboScore;
MaxHits = Hits;
}
base.Reset(storeResults);
Hits = 0;
comboScore = 0;