1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 11:35:35 +08:00

Merge Check and BeatmapCheck

We're probably not going to need GeneralChecks or BeatmapsetChecks.

The verify tab is only available to a single difficulty at a time, and we already have access to the rest of the set through `IBeatmap`.
This commit is contained in:
Naxess 2021-04-10 14:56:30 +02:00
parent 747e0f00dc
commit 3289bb0379
6 changed files with 14 additions and 35 deletions

View File

@ -9,7 +9,7 @@ using osuTK;
namespace osu.Game.Rulesets.Osu.Edit.Checks
{
public class CheckOffscreenObjects : BeatmapCheck
public class CheckOffscreenObjects : Check
{
// These are close approximates to the edges of the screen
// in gameplay on a 4:3 aspect ratio for osu!stable.

View File

@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Osu.Edit
{
public class OsuChecker : Checker
{
public readonly List<BeatmapCheck> beatmapChecks = new List<BeatmapCheck>
public readonly List<Check> beatmapChecks = new List<Check>
{
new CheckOffscreenObjects()
};

View File

@ -12,14 +12,14 @@ namespace osu.Game.Rulesets.Edit
public abstract class Checker
{
// These are all ruleset-invariant, hence here instead of in e.g. `OsuChecker`.
private readonly List<BeatmapCheck> beatmapChecks = new List<BeatmapCheck>
private readonly IReadOnlyList<Check> checks = new List<Check>
{
new CheckBackground()
};
public virtual IEnumerable<Issue> Run(IBeatmap beatmap)
{
return beatmapChecks.SelectMany(check => check.Run(beatmap));
return checks.SelectMany(check => check.Run(beatmap));
}
}
}

View File

@ -8,7 +8,7 @@ using osu.Game.Rulesets.Edit.Checks.Components;
namespace osu.Game.Rulesets.Edit.Checks
{
public class CheckBackground : BeatmapCheck
public class CheckBackground : Check
{
public override CheckMetadata Metadata() => new CheckMetadata
(

View File

@ -1,19 +0,0 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using osu.Game.Beatmaps;
namespace osu.Game.Rulesets.Edit.Checks.Components
{
public abstract class BeatmapCheck : Check<IBeatmap>
{
/// <summary>
/// Returns zero, one, or several issues detected by this
/// check on the given beatmap.
/// </summary>
/// <param name="beatmap">The beatmap to run the check on.</param>
/// <returns></returns>
public abstract override IEnumerable<Issue> Run(IBeatmap beatmap);
}
}

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using osu.Game.Beatmaps;
namespace osu.Game.Rulesets.Edit.Checks.Components
{
@ -21,21 +22,18 @@ namespace osu.Game.Rulesets.Edit.Checks.Components
/// <returns></returns>
public abstract IEnumerable<IssueTemplate> Templates();
/// <summary>
/// Returns zero, one, or several issues detected by this
/// check on the given beatmap.
/// </summary>
/// <param name="beatmap">The beatmap to run the check on.</param>
/// <returns></returns>
public abstract IEnumerable<Issue> Run(IBeatmap beatmap);
protected Check()
{
foreach (var template in Templates())
template.Origin = this;
}
}
public abstract class Check<T> : Check
{
/// <summary>
/// Returns zero, one, or several issues detected by
/// this check on the given object.
/// </summary>
/// <param name="obj">The object to run the check on.</param>
/// <returns></returns>
public abstract IEnumerable<Issue> Run(T obj);
}
}