mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 23:12:56 +08:00
Extract duplicated conditionals
This commit is contained in:
parent
55737226a3
commit
ff7f65de27
@ -12,6 +12,7 @@ using osu.Framework.Graphics.Audio;
|
|||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
@ -124,10 +125,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
drawable.OnNewResult += (o, result) =>
|
drawable.OnNewResult += (o, result) =>
|
||||||
{
|
{
|
||||||
if (dequeuedRates.ContainsKey(result.HitObject)) return;
|
if (dequeuedRates.ContainsKey(result.HitObject)) return;
|
||||||
|
if (!shouldProcessResult(result)) return;
|
||||||
if (!result.IsHit) return;
|
|
||||||
if (!result.Type.AffectsAccuracy()) return;
|
|
||||||
if (!previousEndTimes.ContainsKey(result.HitObject)) return;
|
|
||||||
|
|
||||||
double prevEndTime = previousEndTimes[result.HitObject];
|
double prevEndTime = previousEndTimes[result.HitObject];
|
||||||
|
|
||||||
@ -141,10 +139,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
drawable.OnRevertResult += (o, result) =>
|
drawable.OnRevertResult += (o, result) =>
|
||||||
{
|
{
|
||||||
if (!dequeuedRates.ContainsKey(result.HitObject)) return;
|
if (!dequeuedRates.ContainsKey(result.HitObject)) return;
|
||||||
|
if (!shouldProcessResult(result)) return;
|
||||||
if (!result.IsHit) return;
|
|
||||||
if (!result.Type.AffectsAccuracy()) return;
|
|
||||||
if (!previousEndTimes.ContainsKey(result.HitObject)) return;
|
|
||||||
|
|
||||||
recentRates.Insert(0, dequeuedRates[result.HitObject]);
|
recentRates.Insert(0, dequeuedRates[result.HitObject]);
|
||||||
recentRates.RemoveAt(recentRates.Count - 1);
|
recentRates.RemoveAt(recentRates.Count - 1);
|
||||||
@ -179,5 +174,14 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
yield return nested;
|
yield return nested;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool shouldProcessResult(JudgementResult result)
|
||||||
|
{
|
||||||
|
if (!result.IsHit) return false;
|
||||||
|
if (!result.Type.AffectsAccuracy()) return false;
|
||||||
|
if (!previousEndTimes.ContainsKey(result.HitObject)) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user