mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 10:02:59 +08:00
Move AllObjectsJudged into ScoreProcessor as AllJudged
Changes to OsuScoreProcessor were required to make sure that ticks and slider heads weren't ignored.
This commit is contained in:
parent
cc6bb81a73
commit
2e0218f388
@ -2,7 +2,6 @@
|
|||||||
// 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.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Configuration;
|
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
@ -38,9 +37,19 @@ namespace osu.Game.Rulesets.Osu.Scoring
|
|||||||
{
|
{
|
||||||
hpDrainRate = beatmap.BeatmapInfo.Difficulty.DrainRate;
|
hpDrainRate = beatmap.BeatmapInfo.Difficulty.DrainRate;
|
||||||
|
|
||||||
foreach (var unused in beatmap.HitObjects)
|
foreach (var obj in beatmap.HitObjects)
|
||||||
{
|
{
|
||||||
// TODO: add support for other object types.
|
var slider = obj as Slider;
|
||||||
|
if (slider != null)
|
||||||
|
{
|
||||||
|
// Head
|
||||||
|
AddJudgement(new OsuJudgement { Result = HitResult.Great });
|
||||||
|
|
||||||
|
// Ticks
|
||||||
|
foreach (var tick in slider.Ticks)
|
||||||
|
AddJudgement(new OsuJudgement { Result = HitResult.Great });
|
||||||
|
}
|
||||||
|
|
||||||
AddJudgement(new OsuJudgement { Result = HitResult.Great });
|
AddJudgement(new OsuJudgement { Result = HitResult.Great });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,11 +14,17 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
public abstract class ScoreProcessor
|
public abstract class ScoreProcessor
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when the ScoreProcessor is in a failed state.
|
/// Invoked when the <see cref="ScoreProcessor"/> is in a failed state.
|
||||||
|
/// This may occur regardless of whether an <see cref="AllJudged"/> event is invoked.
|
||||||
/// Return true if the fail was permitted.
|
/// Return true if the fail was permitted.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Func<bool> Failed;
|
public event Func<bool> Failed;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invoked when all <see cref="HitObject"/>s have been judged.
|
||||||
|
/// </summary>
|
||||||
|
public event Action AllJudged;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when a new judgement has occurred. This occurs after the judgement has been processed by the <see cref="ScoreProcessor"/>.
|
/// Invoked when a new judgement has occurred. This occurs after the judgement has been processed by the <see cref="ScoreProcessor"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -49,6 +55,11 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly BindableInt HighestCombo = new BindableInt();
|
public readonly BindableInt HighestCombo = new BindableInt();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether all <see cref="Judgement"/>s have been processed.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual bool HasCompleted => false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the score is in a failed state.
|
/// Whether the score is in a failed state.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -117,6 +128,9 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
protected void NotifyNewJudgement(Judgement judgement)
|
protected void NotifyNewJudgement(Judgement judgement)
|
||||||
{
|
{
|
||||||
NewJudgement?.Invoke(judgement);
|
NewJudgement?.Invoke(judgement);
|
||||||
|
|
||||||
|
if (HasCompleted)
|
||||||
|
AllJudged?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -141,6 +155,8 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
|
|
||||||
public readonly Bindable<ScoringMode> Mode = new Bindable<ScoringMode>(ScoringMode.Exponential);
|
public readonly Bindable<ScoringMode> Mode = new Bindable<ScoringMode>(ScoringMode.Exponential);
|
||||||
|
|
||||||
|
protected sealed override bool HasCompleted => Hits == MaxHits;
|
||||||
|
|
||||||
protected virtual double ComboPortion => 0.5f;
|
protected virtual double ComboPortion => 0.5f;
|
||||||
protected virtual double AccuracyPortion => 0.5f;
|
protected virtual double AccuracyPortion => 0.5f;
|
||||||
|
|
||||||
|
@ -29,11 +29,6 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class RulesetContainer : Container
|
public abstract class RulesetContainer : Container
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Invoked when all the judgeable HitObjects have been judged.
|
|
||||||
/// </summary>
|
|
||||||
public event Action OnAllJudged;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether to apply adjustments to the child <see cref="Playfield"/> based on our own size.
|
/// Whether to apply adjustments to the child <see cref="Playfield"/> based on our own size.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -77,15 +72,6 @@ namespace osu.Game.Rulesets.UI
|
|||||||
Ruleset = ruleset;
|
Ruleset = ruleset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Checks whether all HitObjects have been judged, and invokes OnAllJudged.
|
|
||||||
/// </summary>
|
|
||||||
protected void CheckAllJudged()
|
|
||||||
{
|
|
||||||
if (AllObjectsJudged)
|
|
||||||
OnAllJudged?.Invoke();
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract ScoreProcessor CreateScoreProcessor();
|
public abstract ScoreProcessor CreateScoreProcessor();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -263,7 +249,6 @@ namespace osu.Game.Rulesets.UI
|
|||||||
{
|
{
|
||||||
Playfield.OnJudgement(d, j);
|
Playfield.OnJudgement(d, j);
|
||||||
OnJudgement?.Invoke(j);
|
OnJudgement?.Invoke(j);
|
||||||
CheckAllJudged();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
drawableObjects.Add(drawableObject);
|
drawableObjects.Add(drawableObject);
|
||||||
|
@ -206,10 +206,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
hudOverlay.ModDisplay.Current.BindTo(working.Mods);
|
hudOverlay.ModDisplay.Current.BindTo(working.Mods);
|
||||||
|
|
||||||
//bind RulesetContainer to ScoreProcessor and ourselves (for a pass situation)
|
// Bind ScoreProcessor to ourselves
|
||||||
RulesetContainer.OnAllJudged += onCompletion;
|
scoreProcessor.AllJudged += onCompletion;
|
||||||
|
|
||||||
//bind ScoreProcessor to ourselves (for a fail situation)
|
|
||||||
scoreProcessor.Failed += onFail;
|
scoreProcessor.Failed += onFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user