1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 11:22:54 +08:00

Merge pull request #289 from UselessToucan/JudgementsCapacity

Specify ScoreProcessor.Judgements.Capacity
This commit is contained in:
Dean Herbert 2017-01-23 21:40:00 +09:00 committed by GitHub
commit 3a27178bb1
8 changed files with 18 additions and 13 deletions

View File

@ -18,7 +18,7 @@ namespace osu.Game.Modes.Catch
protected override PlayMode PlayMode => PlayMode.Catch; protected override PlayMode PlayMode => PlayMode.Catch;
public override ScoreProcessor CreateScoreProcessor() => null; public override ScoreProcessor CreateScoreProcessor(int hitObjectCount) => null;
public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser(); public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser();
} }

View File

@ -19,7 +19,7 @@ namespace osu.Game.Modes.Mania
protected override PlayMode PlayMode => PlayMode.Mania; protected override PlayMode PlayMode => PlayMode.Mania;
public override ScoreProcessor CreateScoreProcessor() => null; public override ScoreProcessor CreateScoreProcessor(int hitObjectCount) => null;
public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser(); public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser();
} }

View File

@ -17,7 +17,7 @@ namespace osu.Game.Modes.Osu
public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser(); public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser();
public override ScoreProcessor CreateScoreProcessor() => new OsuScoreProcessor(); public override ScoreProcessor CreateScoreProcessor(int hitObjectCount) => new OsuScoreProcessor(hitObjectCount);
protected override PlayMode PlayMode => PlayMode.Osu; protected override PlayMode PlayMode => PlayMode.Osu;
} }

View File

@ -1,11 +1,6 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>. //Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Objects.Drawables;
using osu.Game.Modes.Osu.Objects.Drawables; using osu.Game.Modes.Osu.Objects.Drawables;
@ -13,6 +8,11 @@ namespace osu.Game.Modes.Osu
{ {
class OsuScoreProcessor : ScoreProcessor class OsuScoreProcessor : ScoreProcessor
{ {
public OsuScoreProcessor(int hitObjectCount)
: base(hitObjectCount)
{
}
protected override void UpdateCalculations(JudgementInfo judgement) protected override void UpdateCalculations(JudgementInfo judgement)
{ {
if (judgement != null) if (judgement != null)

View File

@ -19,7 +19,7 @@ namespace osu.Game.Modes.Taiko
protected override PlayMode PlayMode => PlayMode.Taiko; protected override PlayMode PlayMode => PlayMode.Taiko;
public override ScoreProcessor CreateScoreProcessor() => null; public override ScoreProcessor CreateScoreProcessor(int hitObjectCount) => null;
public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser(); public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser();
} }

View File

@ -18,7 +18,7 @@ namespace osu.Game.Modes
public abstract ScoreOverlay CreateScoreOverlay(); public abstract ScoreOverlay CreateScoreOverlay();
public abstract ScoreProcessor CreateScoreProcessor(); public abstract ScoreProcessor CreateScoreProcessor(int hitObjectCount);
public abstract HitRenderer CreateHitRendererWith(List<HitObject> objects); public abstract HitRenderer CreateHitRendererWith(List<HitObject> objects);

View File

@ -32,11 +32,16 @@ namespace osu.Game.Modes
public readonly BindableInt HighestCombo = new BindableInt(); public readonly BindableInt HighestCombo = new BindableInt();
public readonly List<JudgementInfo> Judgements = new List<JudgementInfo>(); public readonly List<JudgementInfo> Judgements;
public ScoreProcessor() /// <summary>
/// Initializes a new instance of the <see cref="ScoreProcessor"/> class.
/// </summary>
/// <param name="hitObjectCount">Number of HitObjects. It is used for specifying Judgements collection Capacity</param>
public ScoreProcessor(int hitObjectCount = 0)
{ {
Combo.ValueChanged += delegate { HighestCombo.Value = Math.Max(HighestCombo.Value, Combo.Value); }; Combo.ValueChanged += delegate { HighestCombo.Value = Math.Max(HighestCombo.Value, Combo.Value); };
Judgements = new List<JudgementInfo>(hitObjectCount);
} }
public void AddJudgement(JudgementInfo judgement) public void AddJudgement(JudgementInfo judgement)

View File

@ -92,7 +92,7 @@ namespace osu.Game.Screens.Play
ruleset = Ruleset.GetRuleset(usablePlayMode); ruleset = Ruleset.GetRuleset(usablePlayMode);
var scoreOverlay = ruleset.CreateScoreOverlay(); var scoreOverlay = ruleset.CreateScoreOverlay();
scoreOverlay.BindProcessor(scoreProcessor = ruleset.CreateScoreProcessor()); scoreOverlay.BindProcessor(scoreProcessor = ruleset.CreateScoreProcessor(beatmap.HitObjects.Count));
hitRenderer = ruleset.CreateHitRendererWith(beatmap.HitObjects); hitRenderer = ruleset.CreateHitRendererWith(beatmap.HitObjects);