mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 17:13:06 +08:00
Add back CreateScoreProcessor to Ruleset to instantiate a non-generic ScoreProcessor for ScoreDatabase.
This commit is contained in:
parent
7b66faab9e
commit
5cafec3b6a
@ -88,5 +88,7 @@ namespace osu.Game.Modes.Catch
|
||||
};
|
||||
|
||||
public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap) => new CatchDifficultyCalculator(beatmap);
|
||||
|
||||
public override ScoreProcessor CreateScoreProcessor() => new CatchScoreProcessor();
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,10 @@ namespace osu.Game.Modes.Catch
|
||||
{
|
||||
internal class CatchScoreProcessor : ScoreProcessor<CatchBaseHit, CatchJudgementInfo>
|
||||
{
|
||||
public CatchScoreProcessor()
|
||||
{
|
||||
}
|
||||
|
||||
public CatchScoreProcessor(HitRenderer<CatchBaseHit, CatchJudgementInfo> hitRenderer)
|
||||
: base(hitRenderer)
|
||||
{
|
||||
|
@ -103,5 +103,7 @@ namespace osu.Game.Modes.Mania
|
||||
public override IEnumerable<KeyCounter> CreateGameplayKeys() => new KeyCounter[] { /* Todo: Should be keymod specific */ };
|
||||
|
||||
public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap) => new ManiaDifficultyCalculator(beatmap);
|
||||
|
||||
public override ScoreProcessor CreateScoreProcessor() => new ManiaScoreProcessor();
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,10 @@ namespace osu.Game.Modes.Mania
|
||||
{
|
||||
internal class ManiaScoreProcessor : ScoreProcessor<ManiaBaseHit, ManiaJudgementInfo>
|
||||
{
|
||||
public ManiaScoreProcessor()
|
||||
{
|
||||
}
|
||||
|
||||
public ManiaScoreProcessor(HitRenderer<ManiaBaseHit, ManiaJudgementInfo> hitRenderer)
|
||||
: base(hitRenderer)
|
||||
{
|
||||
|
@ -108,5 +108,7 @@ namespace osu.Game.Modes.Osu
|
||||
new KeyCounterMouse(MouseButton.Left),
|
||||
new KeyCounterMouse(MouseButton.Right)
|
||||
};
|
||||
|
||||
public override ScoreProcessor CreateScoreProcessor() => new OsuScoreProcessor();
|
||||
}
|
||||
}
|
||||
|
@ -10,9 +10,19 @@ namespace osu.Game.Modes.Osu
|
||||
{
|
||||
internal class OsuScoreProcessor : ScoreProcessor<OsuHitObject, OsuJudgementInfo>
|
||||
{
|
||||
public OsuScoreProcessor()
|
||||
{
|
||||
}
|
||||
|
||||
public OsuScoreProcessor(HitRenderer<OsuHitObject, OsuJudgementInfo> hitRenderer)
|
||||
: base(hitRenderer)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
|
||||
Health.Value = 1;
|
||||
Accuracy.Value = 1;
|
||||
}
|
||||
|
@ -89,5 +89,7 @@ namespace osu.Game.Modes.Taiko
|
||||
};
|
||||
|
||||
public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap) => new TaikoDifficultyCalculator(beatmap);
|
||||
|
||||
public override ScoreProcessor CreateScoreProcessor() => new TaikoScoreProcessor();
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,10 @@ namespace osu.Game.Modes.Taiko
|
||||
{
|
||||
internal class TaikoScoreProcessor : ScoreProcessor<TaikoBaseHit, TaikoJudgementInfo>
|
||||
{
|
||||
public TaikoScoreProcessor()
|
||||
{
|
||||
}
|
||||
|
||||
public TaikoScoreProcessor(HitRenderer<TaikoBaseHit, TaikoJudgementInfo> hitRenderer)
|
||||
: base(hitRenderer)
|
||||
{
|
||||
|
@ -38,8 +38,8 @@ namespace osu.Game.Database
|
||||
using (Stream s = storage.GetStream(Path.Combine(replay_folder, replayFilename)))
|
||||
using (SerializationReader sr = new SerializationReader(s))
|
||||
{
|
||||
Ruleset.GetRuleset((PlayMode)sr.ReadByte());
|
||||
score = new Score();
|
||||
var ruleset = Ruleset.GetRuleset((PlayMode)sr.ReadByte());
|
||||
score = ruleset.CreateScoreProcessor().GetScore();
|
||||
|
||||
/* score.Pass = true;*/
|
||||
var version = sr.ReadInt32();
|
||||
|
@ -33,6 +33,8 @@ namespace osu.Game.Modes
|
||||
|
||||
public abstract DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap);
|
||||
|
||||
public abstract ScoreProcessor CreateScoreProcessor();
|
||||
|
||||
public static void Register(Ruleset ruleset) => availableRulesets.TryAdd(ruleset.PlayMode, ruleset.GetType());
|
||||
|
||||
protected abstract PlayMode PlayMode { get; }
|
||||
|
@ -68,11 +68,17 @@ namespace osu.Game.Modes
|
||||
/// </summary>
|
||||
protected bool HasFailed { get; private set; }
|
||||
|
||||
protected ScoreProcessor(HitRenderer<TObject, TJudgement> hitRenderer)
|
||||
protected ScoreProcessor()
|
||||
{
|
||||
Combo.ValueChanged += delegate { HighestCombo.Value = Math.Max(HighestCombo.Value, Combo.Value); };
|
||||
Judgements = new List<TJudgement>(hitRenderer.Beatmap.HitObjects.Count);
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
protected ScoreProcessor(HitRenderer<TObject, TJudgement> hitRenderer)
|
||||
: this()
|
||||
{
|
||||
Judgements = new List<TJudgement>(hitRenderer.Beatmap.HitObjects.Count);
|
||||
hitRenderer.OnJudgement += addJudgement;
|
||||
}
|
||||
|
||||
@ -90,6 +96,11 @@ namespace osu.Game.Modes
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets this ScoreProcessor to a stale state.
|
||||
/// </summary>
|
||||
protected virtual void Reset() { }
|
||||
|
||||
/// <summary>
|
||||
/// Update any values that potentially need post-processing on a judgement change.
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user