mirror of
https://github.com/ppy/osu.git
synced 2025-02-16 18:32:56 +08:00
Make BeatmapVerifier
an interface
This commit is contained in:
parent
c8cb4286f6
commit
60c2494b31
@ -10,21 +10,13 @@ using osu.Game.Rulesets.Osu.Edit.Checks;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit
|
namespace osu.Game.Rulesets.Osu.Edit
|
||||||
{
|
{
|
||||||
public class OsuBeatmapVerifier : BeatmapVerifier
|
public class OsuBeatmapVerifier : IBeatmapVerifier
|
||||||
{
|
{
|
||||||
private readonly List<ICheck> checks = new List<ICheck>
|
private readonly List<ICheck> checks = new List<ICheck>
|
||||||
{
|
{
|
||||||
new CheckOffscreenObjects()
|
new CheckOffscreenObjects()
|
||||||
};
|
};
|
||||||
|
|
||||||
public override IEnumerable<Issue> Run(IBeatmap beatmap)
|
public IEnumerable<Issue> Run(IBeatmap beatmap) => checks.SelectMany(check => check.Run(beatmap));
|
||||||
{
|
|
||||||
// Also run mode-invariant checks.
|
|
||||||
foreach (var issue in base.Run(beatmap))
|
|
||||||
yield return issue;
|
|
||||||
|
|
||||||
foreach (var issue in checks.SelectMany(check => check.Run(beatmap)))
|
|
||||||
yield return issue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,7 @@ namespace osu.Game.Rulesets.Osu
|
|||||||
|
|
||||||
public override HitObjectComposer CreateHitObjectComposer() => new OsuHitObjectComposer(this);
|
public override HitObjectComposer CreateHitObjectComposer() => new OsuHitObjectComposer(this);
|
||||||
|
|
||||||
public override BeatmapVerifier CreateBeatmapVerifier() => new OsuBeatmapVerifier();
|
public override IBeatmapVerifier CreateBeatmapVerifier() => new OsuBeatmapVerifier();
|
||||||
|
|
||||||
public override string Description => "osu!";
|
public override string Description => "osu!";
|
||||||
|
|
||||||
|
@ -2,27 +2,13 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Edit.Checks;
|
|
||||||
using osu.Game.Rulesets.Edit.Checks.Components;
|
using osu.Game.Rulesets.Edit.Checks.Components;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Edit
|
namespace osu.Game.Rulesets.Edit
|
||||||
{
|
{
|
||||||
public abstract class BeatmapVerifier
|
public interface IBeatmapVerifier
|
||||||
{
|
{
|
||||||
/// <summary>
|
public IEnumerable<Issue> Run(IBeatmap beatmap);
|
||||||
/// Checks which are performed regardless of ruleset.
|
|
||||||
/// These handle things like beatmap metadata, timing, and other ruleset agnostic elements.
|
|
||||||
/// </summary>
|
|
||||||
private readonly IReadOnlyList<ICheck> generalChecks = new List<ICheck>
|
|
||||||
{
|
|
||||||
new CheckBackground()
|
|
||||||
};
|
|
||||||
|
|
||||||
public virtual IEnumerable<Issue> Run(IBeatmap beatmap)
|
|
||||||
{
|
|
||||||
return generalChecks.SelectMany(check => check.Run(beatmap));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ namespace osu.Game.Rulesets
|
|||||||
|
|
||||||
public virtual HitObjectComposer CreateHitObjectComposer() => null;
|
public virtual HitObjectComposer CreateHitObjectComposer() => null;
|
||||||
|
|
||||||
public virtual BeatmapVerifier CreateBeatmapVerifier() => null;
|
public virtual IBeatmapVerifier CreateBeatmapVerifier() => null;
|
||||||
|
|
||||||
public virtual Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.Solid.QuestionCircle };
|
public virtual Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.Solid.QuestionCircle };
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Screens.Edit.Verify
|
|||||||
public class VerifyScreen : EditorScreen
|
public class VerifyScreen : EditorScreen
|
||||||
{
|
{
|
||||||
private Ruleset ruleset;
|
private Ruleset ruleset;
|
||||||
private static BeatmapVerifier beatmapVerifier;
|
private static IBeatmapVerifier beatmapVerifier;
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
private Bindable<Issue> selectedIssue = new Bindable<Issue>();
|
private Bindable<Issue> selectedIssue = new Bindable<Issue>();
|
||||||
|
Loading…
Reference in New Issue
Block a user