mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 17:02:57 +08:00
Remove Ruleset parameter from ResetFromReplayFrame()
This commit is contained in:
parent
79a17fc86a
commit
132c94c1b5
@ -61,13 +61,13 @@ namespace osu.Game.Tests.Gameplay
|
||||
Assert.That(scoreProcessor.JudgedHits, Is.EqualTo(1));
|
||||
|
||||
// No header shouldn't cause any change
|
||||
scoreProcessor.ResetFromReplayFrame(new OsuRuleset(), new OsuReplayFrame());
|
||||
scoreProcessor.ResetFromReplayFrame(new OsuReplayFrame());
|
||||
|
||||
Assert.That(scoreProcessor.TotalScore.Value, Is.EqualTo(1_000_000));
|
||||
Assert.That(scoreProcessor.JudgedHits, Is.EqualTo(1));
|
||||
|
||||
// Reset with a miss instead.
|
||||
scoreProcessor.ResetFromReplayFrame(new OsuRuleset(), new OsuReplayFrame
|
||||
scoreProcessor.ResetFromReplayFrame(new OsuReplayFrame
|
||||
{
|
||||
Header = new FrameHeader(0, 0, 0, new Dictionary<HitResult, int> { { HitResult.Miss, 1 } }, DateTimeOffset.Now)
|
||||
});
|
||||
@ -76,7 +76,7 @@ namespace osu.Game.Tests.Gameplay
|
||||
Assert.That(scoreProcessor.JudgedHits, Is.EqualTo(1));
|
||||
|
||||
// Reset with no judged hit.
|
||||
scoreProcessor.ResetFromReplayFrame(new OsuRuleset(), new OsuReplayFrame
|
||||
scoreProcessor.ResetFromReplayFrame(new OsuReplayFrame
|
||||
{
|
||||
Header = new FrameHeader(0, 0, 0, new Dictionary<HitResult, int>(), DateTimeOffset.Now)
|
||||
});
|
||||
|
@ -117,9 +117,8 @@ namespace osu.Game.Rulesets.Scoring
|
||||
/// <remarks>
|
||||
/// If the provided replay frame does not have any header information, this will be a noop.
|
||||
/// </remarks>
|
||||
/// <param name="ruleset">The ruleset to be used for retrieving statistics.</param>
|
||||
/// <param name="frame">The replay frame to read header statistics from.</param>
|
||||
public virtual void ResetFromReplayFrame(Ruleset ruleset, ReplayFrame frame)
|
||||
public virtual void ResetFromReplayFrame(ReplayFrame frame)
|
||||
{
|
||||
if (frame.Header == null)
|
||||
return;
|
||||
|
@ -251,8 +251,7 @@ namespace osu.Game.Rulesets.Scoring
|
||||
if (!ruleset.RulesetInfo.Equals(scoreInfo.Ruleset))
|
||||
throw new ArgumentException($"Unexpected score ruleset. Expected \"{ruleset.RulesetInfo.ShortName}\" but was \"{scoreInfo.Ruleset.ShortName}\".");
|
||||
|
||||
extractFromStatistics(ruleset,
|
||||
scoreInfo.Statistics,
|
||||
extractFromStatistics(scoreInfo.Statistics,
|
||||
out double extractedBaseScore,
|
||||
out double extractedMaxBaseScore,
|
||||
out int extractedMaxCombo,
|
||||
@ -281,8 +280,7 @@ namespace osu.Game.Rulesets.Scoring
|
||||
if (!beatmapApplied)
|
||||
throw new InvalidOperationException($"Cannot compute partial score without calling {nameof(ApplyBeatmap)}.");
|
||||
|
||||
extractFromStatistics(ruleset,
|
||||
scoreInfo.Statistics,
|
||||
extractFromStatistics(scoreInfo.Statistics,
|
||||
out double extractedBaseScore,
|
||||
out _,
|
||||
out _,
|
||||
@ -318,9 +316,7 @@ namespace osu.Game.Rulesets.Scoring
|
||||
// Note: This cannot be applied universally to all legacy scores, as some rulesets (e.g. catch) group multiple judgements together.
|
||||
if (scoreInfo.IsLegacyScore && scoreInfo.Ruleset.OnlineID == 3)
|
||||
{
|
||||
extractFromStatistics(
|
||||
ruleset,
|
||||
scoreInfo.Statistics,
|
||||
extractFromStatistics(scoreInfo.Statistics,
|
||||
out double computedBaseScore,
|
||||
out double computedMaxBaseScore,
|
||||
out _,
|
||||
@ -437,14 +433,14 @@ namespace osu.Game.Rulesets.Scoring
|
||||
score.TotalScore = (long)Math.Round(ComputeFinalScore(ScoringMode.Standardised, score));
|
||||
}
|
||||
|
||||
public override void ResetFromReplayFrame(Ruleset ruleset, ReplayFrame frame)
|
||||
public override void ResetFromReplayFrame(ReplayFrame frame)
|
||||
{
|
||||
base.ResetFromReplayFrame(ruleset, frame);
|
||||
base.ResetFromReplayFrame(frame);
|
||||
|
||||
if (frame.Header == null)
|
||||
return;
|
||||
|
||||
extractFromStatistics(ruleset, frame.Header.Statistics, out baseScore, out rollingMaxBaseScore, out _, out _);
|
||||
extractFromStatistics(frame.Header.Statistics, out baseScore, out rollingMaxBaseScore, out _, out _);
|
||||
HighestCombo.Value = frame.Header.MaxCombo;
|
||||
|
||||
scoreResultCounts.Clear();
|
||||
@ -455,7 +451,7 @@ namespace osu.Game.Rulesets.Scoring
|
||||
OnResetFromReplayFrame?.Invoke();
|
||||
}
|
||||
|
||||
private void extractFromStatistics(Ruleset ruleset, IReadOnlyDictionary<HitResult, int> statistics, out double baseScore, out double maxBaseScore, out int maxCombo,
|
||||
private void extractFromStatistics(IReadOnlyDictionary<HitResult, int> statistics, out double baseScore, out double maxBaseScore, out int maxCombo,
|
||||
out int basicHitObjects)
|
||||
{
|
||||
baseScore = 0;
|
||||
|
@ -27,8 +27,6 @@ namespace osu.Game.Rulesets.UI
|
||||
{
|
||||
public readonly KeyBindingContainer<T> KeyBindingContainer;
|
||||
|
||||
private readonly Ruleset ruleset;
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private ScoreProcessor scoreProcessor { get; set; }
|
||||
|
||||
@ -57,8 +55,6 @@ namespace osu.Game.Rulesets.UI
|
||||
|
||||
protected RulesetInputManager(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique)
|
||||
{
|
||||
this.ruleset = ruleset.CreateInstance();
|
||||
|
||||
InternalChild = KeyBindingContainer =
|
||||
CreateKeyBindingContainer(ruleset, variant, unique)
|
||||
.WithChild(content = new Container { RelativeSizeAxes = Axes.Both });
|
||||
@ -85,7 +81,7 @@ namespace osu.Game.Rulesets.UI
|
||||
break;
|
||||
|
||||
case ReplayStatisticsFrameEvent statisticsStateChangeEvent:
|
||||
scoreProcessor?.ResetFromReplayFrame(ruleset, statisticsStateChangeEvent.Frame);
|
||||
scoreProcessor?.ResetFromReplayFrame(statisticsStateChangeEvent.Frame);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user