mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 03:02:54 +08:00
Make ScoreProcessors take generic judgements.
This commit is contained in:
parent
a7ba6bbcfe
commit
c82ae011fb
@ -87,8 +87,6 @@ namespace osu.Game.Modes.Catch
|
|||||||
new KeyCounterMouse(MouseButton.Right)
|
new KeyCounterMouse(MouseButton.Right)
|
||||||
};
|
};
|
||||||
|
|
||||||
public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => null;
|
|
||||||
|
|
||||||
public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap) => new CatchDifficultyCalculator(beatmap);
|
public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap) => new CatchDifficultyCalculator(beatmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
21
osu.Game.Modes.Catch/CatchScoreProcessor.cs
Normal file
21
osu.Game.Modes.Catch/CatchScoreProcessor.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Modes.Catch.Judgements;
|
||||||
|
using osu.Game.Modes.Catch.Objects;
|
||||||
|
using osu.Game.Modes.UI;
|
||||||
|
|
||||||
|
namespace osu.Game.Modes.Catch
|
||||||
|
{
|
||||||
|
internal class CatchScoreProcessor : ScoreProcessor<CatchBaseHit, CatchJudgementInfo>
|
||||||
|
{
|
||||||
|
public CatchScoreProcessor(HitRenderer<CatchBaseHit, CatchJudgementInfo> hitRenderer)
|
||||||
|
: base(hitRenderer)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void UpdateCalculations(CatchJudgementInfo newJudgement)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -17,11 +17,13 @@ namespace osu.Game.Modes.Catch.UI
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override ScoreProcessor CreateScoreProcessor() => new CatchScoreProcessor(this);
|
||||||
|
|
||||||
protected override IBeatmapConverter<CatchBaseHit> CreateBeatmapConverter() => new CatchBeatmapConverter();
|
protected override IBeatmapConverter<CatchBaseHit> CreateBeatmapConverter() => new CatchBeatmapConverter();
|
||||||
|
|
||||||
protected override IBeatmapProcessor<CatchBaseHit> CreateBeatmapProcessor() => new CatchBeatmapProcessor();
|
protected override IBeatmapProcessor<CatchBaseHit> CreateBeatmapProcessor() => new CatchBeatmapProcessor();
|
||||||
protected override Playfield<CatchBaseHit, CatchJudgementInfo> CreatePlayfield() => new CatchPlayfield();
|
|
||||||
|
|
||||||
|
protected override Playfield<CatchBaseHit, CatchJudgementInfo> CreatePlayfield() => new CatchPlayfield();
|
||||||
|
|
||||||
protected override DrawableHitObject<CatchBaseHit, CatchJudgementInfo> GetVisualRepresentation(CatchBaseHit h) => null;
|
protected override DrawableHitObject<CatchBaseHit, CatchJudgementInfo> GetVisualRepresentation(CatchBaseHit h) => null;
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
<Compile Include="Beatmaps\CatchBeatmapConverter.cs" />
|
<Compile Include="Beatmaps\CatchBeatmapConverter.cs" />
|
||||||
<Compile Include="Beatmaps\CatchBeatmapProcessor.cs" />
|
<Compile Include="Beatmaps\CatchBeatmapProcessor.cs" />
|
||||||
<Compile Include="CatchDifficultyCalculator.cs" />
|
<Compile Include="CatchDifficultyCalculator.cs" />
|
||||||
|
<Compile Include="CatchScoreProcessor.cs" />
|
||||||
<Compile Include="Judgements\CatchJudgementInfo.cs" />
|
<Compile Include="Judgements\CatchJudgementInfo.cs" />
|
||||||
<Compile Include="Objects\CatchBaseHit.cs" />
|
<Compile Include="Objects\CatchBaseHit.cs" />
|
||||||
<Compile Include="Objects\Drawable\DrawableFruit.cs" />
|
<Compile Include="Objects\Drawable\DrawableFruit.cs" />
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
Copyright (c) 2007-2017 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
|
||||||
|
@ -102,8 +102,6 @@ namespace osu.Game.Modes.Mania
|
|||||||
|
|
||||||
public override IEnumerable<KeyCounter> CreateGameplayKeys() => new KeyCounter[] { /* Todo: Should be keymod specific */ };
|
public override IEnumerable<KeyCounter> CreateGameplayKeys() => new KeyCounter[] { /* Todo: Should be keymod specific */ };
|
||||||
|
|
||||||
public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => null;
|
|
||||||
|
|
||||||
public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap) => new ManiaDifficultyCalculator(beatmap);
|
public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap) => new ManiaDifficultyCalculator(beatmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
21
osu.Game.Modes.Mania/ManiaScoreProcessor.cs
Normal file
21
osu.Game.Modes.Mania/ManiaScoreProcessor.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Modes.Mania.Judgements;
|
||||||
|
using osu.Game.Modes.Mania.Objects;
|
||||||
|
using osu.Game.Modes.UI;
|
||||||
|
|
||||||
|
namespace osu.Game.Modes.Mania
|
||||||
|
{
|
||||||
|
internal class ManiaScoreProcessor : ScoreProcessor<ManiaBaseHit, ManiaJudgementInfo>
|
||||||
|
{
|
||||||
|
public ManiaScoreProcessor(HitRenderer<ManiaBaseHit, ManiaJudgementInfo> hitRenderer)
|
||||||
|
: base(hitRenderer)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void UpdateCalculations(ManiaJudgementInfo newJudgement)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -20,11 +20,13 @@ namespace osu.Game.Modes.Mania.UI
|
|||||||
this.columns = columns;
|
this.columns = columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override ScoreProcessor CreateScoreProcessor() => new ManiaScoreProcessor(this);
|
||||||
|
|
||||||
protected override IBeatmapConverter<ManiaBaseHit> CreateBeatmapConverter() => new ManiaBeatmapConverter();
|
protected override IBeatmapConverter<ManiaBaseHit> CreateBeatmapConverter() => new ManiaBeatmapConverter();
|
||||||
|
|
||||||
protected override IBeatmapProcessor<ManiaBaseHit> CreateBeatmapProcessor() => new ManiaBeatmapProcessor();
|
protected override IBeatmapProcessor<ManiaBaseHit> CreateBeatmapProcessor() => new ManiaBeatmapProcessor();
|
||||||
protected override Playfield<ManiaBaseHit, ManiaJudgementInfo> CreatePlayfield() => new ManiaPlayfield(columns);
|
|
||||||
|
|
||||||
|
protected override Playfield<ManiaBaseHit, ManiaJudgementInfo> CreatePlayfield() => new ManiaPlayfield(columns);
|
||||||
|
|
||||||
protected override DrawableHitObject<ManiaBaseHit, ManiaJudgementInfo> GetVisualRepresentation(ManiaBaseHit h) => null;
|
protected override DrawableHitObject<ManiaBaseHit, ManiaJudgementInfo> GetVisualRepresentation(ManiaBaseHit h) => null;
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
<Compile Include="Beatmaps\ManiaBeatmapProcessor.cs" />
|
<Compile Include="Beatmaps\ManiaBeatmapProcessor.cs" />
|
||||||
<Compile Include="Judgements\ManiaJudgementInfo.cs" />
|
<Compile Include="Judgements\ManiaJudgementInfo.cs" />
|
||||||
<Compile Include="ManiaDifficultyCalculator.cs" />
|
<Compile Include="ManiaDifficultyCalculator.cs" />
|
||||||
|
<Compile Include="ManiaScoreProcessor.cs" />
|
||||||
<Compile Include="Objects\Drawable\DrawableNote.cs" />
|
<Compile Include="Objects\Drawable\DrawableNote.cs" />
|
||||||
<Compile Include="Objects\HoldNote.cs" />
|
<Compile Include="Objects\HoldNote.cs" />
|
||||||
<Compile Include="Objects\ManiaBaseHit.cs" />
|
<Compile Include="Objects\ManiaBaseHit.cs" />
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
Copyright (c) 2007-2017 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
|
||||||
|
@ -95,8 +95,6 @@ namespace osu.Game.Modes.Osu
|
|||||||
|
|
||||||
public override FontAwesome Icon => FontAwesome.fa_osu_osu_o;
|
public override FontAwesome Icon => FontAwesome.fa_osu_osu_o;
|
||||||
|
|
||||||
public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => new OsuScoreProcessor(hitObjectCount);
|
|
||||||
|
|
||||||
public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap) => new OsuDifficultyCalculator(beatmap);
|
public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap) => new OsuDifficultyCalculator(beatmap);
|
||||||
|
|
||||||
protected override PlayMode PlayMode => PlayMode.Osu;
|
protected override PlayMode PlayMode => PlayMode.Osu;
|
||||||
|
@ -1,22 +1,23 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 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 osu.Game.Modes.Judgements;
|
|
||||||
using osu.Game.Modes.Objects.Drawables;
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
using osu.Game.Modes.Osu.Judgements;
|
using osu.Game.Modes.Osu.Judgements;
|
||||||
|
using osu.Game.Modes.Osu.Objects;
|
||||||
|
using osu.Game.Modes.UI;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Osu
|
namespace osu.Game.Modes.Osu
|
||||||
{
|
{
|
||||||
internal class OsuScoreProcessor : ScoreProcessor
|
internal class OsuScoreProcessor : ScoreProcessor<OsuHitObject, OsuJudgementInfo>
|
||||||
{
|
{
|
||||||
public OsuScoreProcessor(int hitObjectCount = 0)
|
public OsuScoreProcessor(HitRenderer<OsuHitObject, OsuJudgementInfo> hitRenderer)
|
||||||
: base(hitObjectCount)
|
: base(hitRenderer)
|
||||||
{
|
{
|
||||||
Health.Value = 1;
|
Health.Value = 1;
|
||||||
Accuracy.Value = 1;
|
Accuracy.Value = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateCalculations(JudgementInfo judgement)
|
protected override void UpdateCalculations(OsuJudgementInfo judgement)
|
||||||
{
|
{
|
||||||
if (judgement != null)
|
if (judgement != null)
|
||||||
{
|
{
|
||||||
@ -38,7 +39,7 @@ namespace osu.Game.Modes.Osu
|
|||||||
|
|
||||||
foreach (var judgementInfo in Judgements)
|
foreach (var judgementInfo in Judgements)
|
||||||
{
|
{
|
||||||
var j = (OsuJudgementInfo)judgementInfo;
|
var j = judgementInfo;
|
||||||
score += j.ScoreValue;
|
score += j.ScoreValue;
|
||||||
maxScore += j.MaxScoreValue;
|
maxScore += j.MaxScoreValue;
|
||||||
}
|
}
|
||||||
|
@ -19,11 +19,13 @@ namespace osu.Game.Modes.Osu.UI
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override ScoreProcessor CreateScoreProcessor() => new OsuScoreProcessor(this);
|
||||||
|
|
||||||
protected override IBeatmapConverter<OsuHitObject> CreateBeatmapConverter() => new OsuBeatmapConverter();
|
protected override IBeatmapConverter<OsuHitObject> CreateBeatmapConverter() => new OsuBeatmapConverter();
|
||||||
|
|
||||||
protected override IBeatmapProcessor<OsuHitObject> CreateBeatmapProcessor() => new OsuBeatmapProcessor();
|
protected override IBeatmapProcessor<OsuHitObject> CreateBeatmapProcessor() => new OsuBeatmapProcessor();
|
||||||
protected override Playfield<OsuHitObject, OsuJudgementInfo> CreatePlayfield() => new OsuPlayfield();
|
|
||||||
|
|
||||||
|
protected override Playfield<OsuHitObject, OsuJudgementInfo> CreatePlayfield() => new OsuPlayfield();
|
||||||
|
|
||||||
protected override KeyConversionInputManager CreateKeyConversionInputManager() => new OsuKeyConversionInputManager();
|
protected override KeyConversionInputManager CreateKeyConversionInputManager() => new OsuKeyConversionInputManager();
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
Copyright (c) 2007-2017 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
|
||||||
|
@ -88,8 +88,6 @@ namespace osu.Game.Modes.Taiko
|
|||||||
new KeyCounterKeyboard(Key.K)
|
new KeyCounterKeyboard(Key.K)
|
||||||
};
|
};
|
||||||
|
|
||||||
public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => null;
|
|
||||||
|
|
||||||
public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap) => new TaikoDifficultyCalculator(beatmap);
|
public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap) => new TaikoDifficultyCalculator(beatmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
21
osu.Game.Modes.Taiko/TaikoScoreProcessor.cs
Normal file
21
osu.Game.Modes.Taiko/TaikoScoreProcessor.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Modes.Taiko.Judgements;
|
||||||
|
using osu.Game.Modes.Taiko.Objects;
|
||||||
|
using osu.Game.Modes.UI;
|
||||||
|
|
||||||
|
namespace osu.Game.Modes.Taiko
|
||||||
|
{
|
||||||
|
internal class TaikoScoreProcessor : ScoreProcessor<TaikoBaseHit, TaikoJudgementInfo>
|
||||||
|
{
|
||||||
|
public TaikoScoreProcessor(HitRenderer<TaikoBaseHit, TaikoJudgementInfo> hitRenderer)
|
||||||
|
: base(hitRenderer)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void UpdateCalculations(TaikoJudgementInfo newJudgement)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -17,11 +17,13 @@ namespace osu.Game.Modes.Taiko.UI
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override ScoreProcessor CreateScoreProcessor() => new TaikoScoreProcessor(this);
|
||||||
|
|
||||||
protected override IBeatmapConverter<TaikoBaseHit> CreateBeatmapConverter() => new TaikoBeatmapConverter();
|
protected override IBeatmapConverter<TaikoBaseHit> CreateBeatmapConverter() => new TaikoBeatmapConverter();
|
||||||
|
|
||||||
protected override IBeatmapProcessor<TaikoBaseHit> CreateBeatmapProcessor() => new TaikoBeatmapProcessor();
|
protected override IBeatmapProcessor<TaikoBaseHit> CreateBeatmapProcessor() => new TaikoBeatmapProcessor();
|
||||||
protected override Playfield<TaikoBaseHit, TaikoJudgementInfo> CreatePlayfield() => new TaikoPlayfield();
|
|
||||||
|
|
||||||
|
protected override Playfield<TaikoBaseHit, TaikoJudgementInfo> CreatePlayfield() => new TaikoPlayfield();
|
||||||
|
|
||||||
protected override DrawableHitObject<TaikoBaseHit, TaikoJudgementInfo> GetVisualRepresentation(TaikoBaseHit h) => null;
|
protected override DrawableHitObject<TaikoBaseHit, TaikoJudgementInfo> GetVisualRepresentation(TaikoBaseHit h) => null;
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,7 @@
|
|||||||
<Compile Include="Objects\Drawable\DrawableTaikoHit.cs" />
|
<Compile Include="Objects\Drawable\DrawableTaikoHit.cs" />
|
||||||
<Compile Include="Objects\TaikoBaseHit.cs" />
|
<Compile Include="Objects\TaikoBaseHit.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="TaikoScoreProcessor.cs" />
|
||||||
<Compile Include="UI\TaikoHitRenderer.cs" />
|
<Compile Include="UI\TaikoHitRenderer.cs" />
|
||||||
<Compile Include="UI\TaikoPlayfield.cs" />
|
<Compile Include="UI\TaikoPlayfield.cs" />
|
||||||
<Compile Include="TaikoRuleset.cs" />
|
<Compile Include="TaikoRuleset.cs" />
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
Copyright (c) 2007-2017 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
|
||||||
|
@ -39,9 +39,8 @@ namespace osu.Game.Database
|
|||||||
using (SerializationReader sr = new SerializationReader(s))
|
using (SerializationReader sr = new SerializationReader(s))
|
||||||
{
|
{
|
||||||
var ruleset = Ruleset.GetRuleset((PlayMode)sr.ReadByte());
|
var ruleset = Ruleset.GetRuleset((PlayMode)sr.ReadByte());
|
||||||
var processor = ruleset.CreateScoreProcessor();
|
|
||||||
|
|
||||||
score = processor.GetScore();
|
score = new Score();
|
||||||
|
|
||||||
/* score.Pass = true;*/
|
/* score.Pass = true;*/
|
||||||
var version = sr.ReadInt32();
|
var version = sr.ReadInt32();
|
||||||
|
@ -29,8 +29,6 @@ namespace osu.Game.Modes
|
|||||||
|
|
||||||
public abstract IEnumerable<Mod> GetModsFor(ModType type);
|
public abstract IEnumerable<Mod> GetModsFor(ModType type);
|
||||||
|
|
||||||
public abstract ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0);
|
|
||||||
|
|
||||||
public abstract HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap);
|
public abstract HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap);
|
||||||
|
|
||||||
public abstract DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap);
|
public abstract DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap);
|
||||||
|
@ -5,6 +5,8 @@ using osu.Framework.Configuration;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Game.Modes.Judgements;
|
using osu.Game.Modes.Judgements;
|
||||||
|
using osu.Game.Modes.UI;
|
||||||
|
using osu.Game.Modes.Objects;
|
||||||
|
|
||||||
namespace osu.Game.Modes
|
namespace osu.Game.Modes
|
||||||
{
|
{
|
||||||
@ -28,36 +30,50 @@ namespace osu.Game.Modes
|
|||||||
public readonly BindableInt Combo = new BindableInt();
|
public readonly BindableInt Combo = new BindableInt();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Are we allowed to fail?
|
/// Keeps track of the highest combo ever achieved in this play.
|
||||||
|
/// This is handled automatically by ScoreProcessor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected bool CanFail => true;
|
public readonly BindableInt HighestCombo = new BindableInt();
|
||||||
|
|
||||||
protected bool HasFailed { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when we reach a failing health of zero.
|
/// Called when we reach a failing health of zero.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action Failed;
|
public event Action Failed;
|
||||||
|
|
||||||
/// <summary>
|
protected void TriggerFailed()
|
||||||
/// Keeps track of the highest combo ever achieved in this play.
|
{
|
||||||
/// This is handled automatically by ScoreProcessor.
|
Failed?.Invoke();
|
||||||
/// </summary>
|
}
|
||||||
public readonly BindableInt HighestCombo = new BindableInt();
|
}
|
||||||
|
|
||||||
public readonly List<JudgementInfo> Judgements;
|
public abstract class ScoreProcessor<TObject, TJudgement> : ScoreProcessor
|
||||||
|
where TObject : HitObject
|
||||||
|
where TJudgement : JudgementInfo
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// All judgements held by this ScoreProcessor.
|
||||||
|
/// </summary>
|
||||||
|
protected List<TJudgement> Judgements;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ScoreProcessor"/> class.
|
/// Are we allowed to fail?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="hitObjectCount">Number of HitObjects. It is used for specifying Judgements collection Capacity</param>
|
protected bool CanFail => true;
|
||||||
protected ScoreProcessor(int hitObjectCount = 0)
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether this ScoreProcessor has already triggered the failed event.
|
||||||
|
/// </summary>
|
||||||
|
protected bool HasFailed { get; private set; }
|
||||||
|
|
||||||
|
protected ScoreProcessor(HitRenderer<TObject, TJudgement> hitRenderer)
|
||||||
{
|
{
|
||||||
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);
|
Judgements = new List<TJudgement>(hitRenderer.Beatmap.HitObjects.Count);
|
||||||
|
|
||||||
|
hitRenderer.OnJudgement += addJudgement;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddJudgement(JudgementInfo judgement)
|
private void addJudgement(TJudgement judgement)
|
||||||
{
|
{
|
||||||
Judgements.Add(judgement);
|
Judgements.Add(judgement);
|
||||||
|
|
||||||
@ -67,7 +83,7 @@ namespace osu.Game.Modes
|
|||||||
if (Health.Value == Health.MinValue && !HasFailed)
|
if (Health.Value == Health.MinValue && !HasFailed)
|
||||||
{
|
{
|
||||||
HasFailed = true;
|
HasFailed = true;
|
||||||
Failed?.Invoke();
|
TriggerFailed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,6 +91,6 @@ namespace osu.Game.Modes
|
|||||||
/// Update any values that potentially need post-processing on a judgement change.
|
/// Update any values that potentially need post-processing on a judgement change.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="newJudgement">A new JudgementInfo that triggered this calculation. May be null.</param>
|
/// <param name="newJudgement">A new JudgementInfo that triggered this calculation. May be null.</param>
|
||||||
protected abstract void UpdateCalculations(JudgementInfo newJudgement);
|
protected abstract void UpdateCalculations(TJudgement newJudgement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,14 +25,6 @@ namespace osu.Game.Modes.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class HitRenderer : Container
|
public abstract class HitRenderer : Container
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// The event that's fired when a hit object is judged.
|
|
||||||
/// </summary>
|
|
||||||
public event Action<JudgementInfo> OnJudgement;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The event that's fired when all hit objects have been judged.
|
|
||||||
/// </summary>
|
|
||||||
public event Action OnAllJudged;
|
public event Action OnAllJudged;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -57,17 +49,16 @@ namespace osu.Game.Modes.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Triggers a judgement for further processing.
|
/// Checks whether all HitObjects have been judged, and invokes OnAllJudged.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="j">The judgement to trigger.</param>
|
protected void CheckAllJudged()
|
||||||
protected void TriggerOnJudgement(JudgementInfo j)
|
|
||||||
{
|
{
|
||||||
OnJudgement?.Invoke(j);
|
|
||||||
|
|
||||||
if (AllObjectsJudged)
|
if (AllObjectsJudged)
|
||||||
OnAllJudged?.Invoke();
|
OnAllJudged?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract ScoreProcessor CreateScoreProcessor();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a key conversion input manager.
|
/// Creates a key conversion input manager.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -141,6 +132,8 @@ namespace osu.Game.Modes.UI
|
|||||||
where TObject : HitObject
|
where TObject : HitObject
|
||||||
where TJudgement : JudgementInfo
|
where TJudgement : JudgementInfo
|
||||||
{
|
{
|
||||||
|
public event Action<TJudgement> OnJudgement;
|
||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
protected override bool AllObjectsJudged => Playfield.HitObjects.Children.All(h => h.Judgement.Result.HasValue);
|
protected override bool AllObjectsJudged => Playfield.HitObjects.Children.All(h => h.Judgement.Result.HasValue);
|
||||||
|
|
||||||
@ -197,8 +190,10 @@ namespace osu.Game.Modes.UI
|
|||||||
/// <param name="judgedObject">The object that Judgement has been updated for.</param>
|
/// <param name="judgedObject">The object that Judgement has been updated for.</param>
|
||||||
private void onJudgement(DrawableHitObject<TObject, TJudgement> judgedObject)
|
private void onJudgement(DrawableHitObject<TObject, TJudgement> judgedObject)
|
||||||
{
|
{
|
||||||
TriggerOnJudgement(judgedObject.Judgement);
|
OnJudgement?.Invoke(judgedObject.Judgement);
|
||||||
Playfield.OnJudgement(judgedObject);
|
Playfield.OnJudgement(judgedObject);
|
||||||
|
|
||||||
|
CheckAllJudged();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -108,10 +108,13 @@ namespace osu.Game.Screens.Play
|
|||||||
});
|
});
|
||||||
|
|
||||||
ruleset = Ruleset.GetRuleset(Beatmap.PlayMode);
|
ruleset = Ruleset.GetRuleset(Beatmap.PlayMode);
|
||||||
|
hitRenderer = ruleset.CreateHitRendererWith(Beatmap);
|
||||||
|
|
||||||
|
scoreProcessor = hitRenderer.CreateScoreProcessor();
|
||||||
|
|
||||||
hudOverlay = new StandardHudOverlay();
|
hudOverlay = new StandardHudOverlay();
|
||||||
hudOverlay.KeyCounter.Add(ruleset.CreateGameplayKeys());
|
hudOverlay.KeyCounter.Add(ruleset.CreateGameplayKeys());
|
||||||
hudOverlay.BindProcessor(scoreProcessor = ruleset.CreateScoreProcessor(beatmap.HitObjects.Count));
|
hudOverlay.BindProcessor(scoreProcessor);
|
||||||
|
|
||||||
pauseOverlay = new PauseOverlay
|
pauseOverlay = new PauseOverlay
|
||||||
{
|
{
|
||||||
@ -125,7 +128,6 @@ namespace osu.Game.Screens.Play
|
|||||||
OnQuit = Exit
|
OnQuit = Exit
|
||||||
};
|
};
|
||||||
|
|
||||||
hitRenderer = ruleset.CreateHitRendererWith(Beatmap);
|
|
||||||
|
|
||||||
if (ReplayInputHandler != null)
|
if (ReplayInputHandler != null)
|
||||||
hitRenderer.InputManager.ReplayInputHandler = ReplayInputHandler;
|
hitRenderer.InputManager.ReplayInputHandler = ReplayInputHandler;
|
||||||
@ -133,7 +135,6 @@ namespace osu.Game.Screens.Play
|
|||||||
hudOverlay.BindHitRenderer(hitRenderer);
|
hudOverlay.BindHitRenderer(hitRenderer);
|
||||||
|
|
||||||
//bind HitRenderer to ScoreProcessor and ourselves (for a pass situation)
|
//bind HitRenderer to ScoreProcessor and ourselves (for a pass situation)
|
||||||
hitRenderer.OnJudgement += scoreProcessor.AddJudgement;
|
|
||||||
hitRenderer.OnAllJudged += onPass;
|
hitRenderer.OnAllJudged += onPass;
|
||||||
|
|
||||||
//bind ScoreProcessor to ourselves (for a fail situation)
|
//bind ScoreProcessor to ourselves (for a fail situation)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
Copyright (c) 2007-2017 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
|
||||||
|
Loading…
Reference in New Issue
Block a user