mirror of
https://github.com/ppy/osu
synced 2025-01-04 13:22:08 +00: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
|
||||
{
|
||||
public class OsuBeatmapVerifier : BeatmapVerifier
|
||||
public class OsuBeatmapVerifier : IBeatmapVerifier
|
||||
{
|
||||
private readonly List<ICheck> checks = new List<ICheck>
|
||||
{
|
||||
new CheckOffscreenObjects()
|
||||
};
|
||||
|
||||
public override IEnumerable<Issue> Run(IBeatmap 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;
|
||||
}
|
||||
public IEnumerable<Issue> Run(IBeatmap beatmap) => checks.SelectMany(check => check.Run(beatmap));
|
||||
}
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ namespace osu.Game.Rulesets.Osu
|
||||
|
||||
public override HitObjectComposer CreateHitObjectComposer() => new OsuHitObjectComposer(this);
|
||||
|
||||
public override BeatmapVerifier CreateBeatmapVerifier() => new OsuBeatmapVerifier();
|
||||
public override IBeatmapVerifier CreateBeatmapVerifier() => new OsuBeatmapVerifier();
|
||||
|
||||
public override string Description => "osu!";
|
||||
|
||||
|
@ -2,27 +2,13 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Edit.Checks;
|
||||
using osu.Game.Rulesets.Edit.Checks.Components;
|
||||
|
||||
namespace osu.Game.Rulesets.Edit
|
||||
{
|
||||
public abstract class BeatmapVerifier
|
||||
public interface IBeatmapVerifier
|
||||
{
|
||||
/// <summary>
|
||||
/// 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));
|
||||
}
|
||||
public IEnumerable<Issue> Run(IBeatmap beatmap);
|
||||
}
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ namespace osu.Game.Rulesets
|
||||
|
||||
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 };
|
||||
|
||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Screens.Edit.Verify
|
||||
public class VerifyScreen : EditorScreen
|
||||
{
|
||||
private Ruleset ruleset;
|
||||
private static BeatmapVerifier beatmapVerifier;
|
||||
private static IBeatmapVerifier beatmapVerifier;
|
||||
|
||||
[Cached]
|
||||
private Bindable<Issue> selectedIssue = new Bindable<Issue>();
|
||||
|
Loading…
Reference in New Issue
Block a user