mirror of
https://github.com/ppy/osu.git
synced 2026-05-24 22:00:57 +08:00
define general checks with a bool in CheckMetadata instead of an interface
This commit is contained in:
@@ -14,9 +14,9 @@ using File = TagLib.File;
|
||||
|
||||
namespace osu.Game.Rulesets.Edit.Checks
|
||||
{
|
||||
public class CheckAudioInVideo : IGeneralCheck
|
||||
public class CheckAudioInVideo : ICheck
|
||||
{
|
||||
public CheckMetadata Metadata => new CheckMetadata(CheckCategory.Audio, "Audio track in video files");
|
||||
public CheckMetadata Metadata => new CheckMetadata(CheckCategory.Audio, "Audio track in video files", CheckScope.Beatmapset);
|
||||
|
||||
public IEnumerable<IssueTemplate> PossibleTemplates => new IssueTemplate[]
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ using osu.Game.Rulesets.Edit.Checks.Components;
|
||||
|
||||
namespace osu.Game.Rulesets.Edit.Checks
|
||||
{
|
||||
public class CheckAudioQuality : IGeneralCheck
|
||||
public class CheckAudioQuality : ICheck
|
||||
{
|
||||
// This is a requirement as stated in the Ranking Criteria.
|
||||
// See https://osu.ppy.sh/wiki/en/Ranking_criteria#audio
|
||||
@@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Edit.Checks
|
||||
// There not existing a version with a bitrate of 128 kbps or higher is extremely rare.
|
||||
private const int min_bitrate = 128;
|
||||
|
||||
public CheckMetadata Metadata { get; } = new CheckMetadata(CheckCategory.Audio, "Too high or low audio bitrate");
|
||||
public CheckMetadata Metadata { get; } = new CheckMetadata(CheckCategory.Audio, "Too high or low audio bitrate", CheckScope.Beatmapset);
|
||||
|
||||
public IEnumerable<IssueTemplate> PossibleTemplates => new IssueTemplate[]
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@ using osu.Game.Rulesets.Edit.Checks.Components;
|
||||
|
||||
namespace osu.Game.Rulesets.Edit.Checks
|
||||
{
|
||||
public class CheckBackgroundQuality : IGeneralCheck
|
||||
public class CheckBackgroundQuality : ICheck
|
||||
{
|
||||
// These are the requirements as stated in the Ranking Criteria.
|
||||
// See https://osu.ppy.sh/wiki/en/Ranking_Criteria#rules.5
|
||||
@@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Edit.Checks
|
||||
private const int low_width = 960;
|
||||
private const int low_height = 540;
|
||||
|
||||
public CheckMetadata Metadata { get; } = new CheckMetadata(CheckCategory.Resources, "Too high or low background resolution");
|
||||
public CheckMetadata Metadata { get; } = new CheckMetadata(CheckCategory.Resources, "Too high or low background resolution", CheckScope.Beatmapset);
|
||||
|
||||
public IEnumerable<IssueTemplate> PossibleTemplates => new IssueTemplate[]
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ using osu.Game.Rulesets.Edit.Checks.Components;
|
||||
|
||||
namespace osu.Game.Rulesets.Edit.Checks
|
||||
{
|
||||
public class CheckDelayedHitsounds : IGeneralCheck
|
||||
public class CheckDelayedHitsounds : ICheck
|
||||
{
|
||||
/// <summary>
|
||||
/// Threshold at which point the sample is considered silent.
|
||||
@@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Edit.Checks
|
||||
private const int delay_threshold = 5;
|
||||
private const int delay_threshold_negligible = 1;
|
||||
|
||||
public CheckMetadata Metadata => new CheckMetadata(CheckCategory.Audio, "Delayed hit sounds.");
|
||||
public CheckMetadata Metadata => new CheckMetadata(CheckCategory.Audio, "Delayed hit sounds.", CheckScope.Beatmapset);
|
||||
|
||||
public IEnumerable<IssueTemplate> PossibleTemplates => new IssueTemplate[]
|
||||
{
|
||||
|
||||
@@ -7,13 +7,13 @@ using osu.Game.Rulesets.Edit.Checks.Components;
|
||||
|
||||
namespace osu.Game.Rulesets.Edit.Checks
|
||||
{
|
||||
public abstract class CheckFilePresence : IGeneralCheck
|
||||
public abstract class CheckFilePresence : ICheck
|
||||
{
|
||||
protected abstract CheckCategory Category { get; }
|
||||
protected abstract string TypeOfFile { get; }
|
||||
protected abstract string? GetFilename(IBeatmap beatmap);
|
||||
|
||||
public CheckMetadata Metadata => new CheckMetadata(Category, $"Missing {TypeOfFile}");
|
||||
public CheckMetadata Metadata => new CheckMetadata(Category, $"Missing {TypeOfFile}", CheckScope.Beatmapset);
|
||||
|
||||
public IEnumerable<IssueTemplate> PossibleTemplates => new IssueTemplate[]
|
||||
{
|
||||
|
||||
@@ -11,9 +11,9 @@ using osu.Game.Rulesets.Edit.Checks.Components;
|
||||
|
||||
namespace osu.Game.Rulesets.Edit.Checks
|
||||
{
|
||||
public class CheckHitsoundsFormat : IGeneralCheck
|
||||
public class CheckHitsoundsFormat : ICheck
|
||||
{
|
||||
public CheckMetadata Metadata => new CheckMetadata(CheckCategory.Audio, "Checks for hitsound formats.");
|
||||
public CheckMetadata Metadata => new CheckMetadata(CheckCategory.Audio, "Checks for hitsound formats.", CheckScope.Beatmapset);
|
||||
|
||||
public IEnumerable<IssueTemplate> PossibleTemplates => new IssueTemplate[]
|
||||
{
|
||||
|
||||
@@ -9,9 +9,9 @@ using osu.Game.Rulesets.Edit.Checks.Components;
|
||||
|
||||
namespace osu.Game.Rulesets.Edit.Checks
|
||||
{
|
||||
public class CheckInconsistentMetadata : IGeneralCheck
|
||||
public class CheckInconsistentMetadata : ICheck
|
||||
{
|
||||
public CheckMetadata Metadata => new CheckMetadata(CheckCategory.Metadata, "Inconsistent metadata");
|
||||
public CheckMetadata Metadata => new CheckMetadata(CheckCategory.Metadata, "Inconsistent metadata", CheckScope.Beatmapset);
|
||||
|
||||
public IEnumerable<IssueTemplate> PossibleTemplates => new IssueTemplate[]
|
||||
{
|
||||
|
||||
@@ -9,9 +9,9 @@ using osu.Game.Rulesets.Edit.Checks.Components;
|
||||
|
||||
namespace osu.Game.Rulesets.Edit.Checks
|
||||
{
|
||||
public class CheckSongFormat : IGeneralCheck
|
||||
public class CheckSongFormat : ICheck
|
||||
{
|
||||
public CheckMetadata Metadata => new CheckMetadata(CheckCategory.Audio, "Checks for song formats.");
|
||||
public CheckMetadata Metadata => new CheckMetadata(CheckCategory.Audio, "Checks for song formats.", CheckScope.Beatmapset);
|
||||
|
||||
public IEnumerable<IssueTemplate> PossibleTemplates => new IssueTemplate[]
|
||||
{
|
||||
|
||||
@@ -8,9 +8,9 @@ using osu.Game.Rulesets.Edit.Checks.Components;
|
||||
|
||||
namespace osu.Game.Rulesets.Edit.Checks
|
||||
{
|
||||
public class CheckTitleMarkers : IGeneralCheck
|
||||
public class CheckTitleMarkers : ICheck
|
||||
{
|
||||
public CheckMetadata Metadata => new CheckMetadata(CheckCategory.Metadata, "Checks for incorrect formats of (TV Size) / (Game Ver.) / (Short Ver.) / (Cut Ver.) / (Sped Up Ver.) / etc in title.");
|
||||
public CheckMetadata Metadata => new CheckMetadata(CheckCategory.Metadata, "Checks for incorrect formats of (TV Size) / (Game Ver.) / (Short Ver.) / (Cut Ver.) / (Sped Up Ver.) / etc in title.", CheckScope.Beatmapset);
|
||||
|
||||
public IEnumerable<IssueTemplate> PossibleTemplates => new IssueTemplate[]
|
||||
{
|
||||
|
||||
@@ -10,11 +10,11 @@ using osu.Game.Rulesets.Edit.Checks.Components;
|
||||
|
||||
namespace osu.Game.Rulesets.Edit.Checks
|
||||
{
|
||||
public class CheckTooShortAudioFiles : IGeneralCheck
|
||||
public class CheckTooShortAudioFiles : ICheck
|
||||
{
|
||||
private const int ms_threshold = 25;
|
||||
|
||||
public CheckMetadata Metadata => new CheckMetadata(CheckCategory.Audio, "Too short audio files");
|
||||
public CheckMetadata Metadata => new CheckMetadata(CheckCategory.Audio, "Too short audio files", CheckScope.Beatmapset);
|
||||
|
||||
public IEnumerable<IssueTemplate> PossibleTemplates => new IssueTemplate[]
|
||||
{
|
||||
|
||||
@@ -14,13 +14,13 @@ using File = TagLib.File;
|
||||
|
||||
namespace osu.Game.Rulesets.Edit.Checks
|
||||
{
|
||||
public class CheckVideoResolution : IGeneralCheck
|
||||
public class CheckVideoResolution : ICheck
|
||||
{
|
||||
private const int max_video_width = 1280;
|
||||
|
||||
private const int max_video_height = 720;
|
||||
|
||||
public CheckMetadata Metadata => new CheckMetadata(CheckCategory.Resources, "Too high video resolution.");
|
||||
public CheckMetadata Metadata => new CheckMetadata(CheckCategory.Resources, "Too high video resolution.", CheckScope.Beatmapset);
|
||||
|
||||
public IEnumerable<IssueTemplate> PossibleTemplates => new IssueTemplate[]
|
||||
{
|
||||
|
||||
@@ -8,9 +8,9 @@ using osu.Game.Rulesets.Edit.Checks.Components;
|
||||
|
||||
namespace osu.Game.Rulesets.Edit.Checks
|
||||
{
|
||||
public class CheckZeroByteFiles : IGeneralCheck
|
||||
public class CheckZeroByteFiles : ICheck
|
||||
{
|
||||
public CheckMetadata Metadata => new CheckMetadata(CheckCategory.Files, "Zero-byte files");
|
||||
public CheckMetadata Metadata => new CheckMetadata(CheckCategory.Files, "Zero-byte files", CheckScope.Beatmapset);
|
||||
|
||||
public IEnumerable<IssueTemplate> PossibleTemplates => new IssueTemplate[]
|
||||
{
|
||||
|
||||
@@ -15,10 +15,16 @@ namespace osu.Game.Rulesets.Edit.Checks.Components
|
||||
/// </summary>
|
||||
public readonly string Description;
|
||||
|
||||
public CheckMetadata(CheckCategory category, string description)
|
||||
/// <summary>
|
||||
/// Specifies whether this check is difficulty-specific or applies to the entire beatmapset. Set to <see cref="CheckScope.Difficulty"/> by default.
|
||||
/// </summary>
|
||||
public readonly CheckScope Scope;
|
||||
|
||||
public CheckMetadata(CheckCategory category, string description, CheckScope scope = CheckScope.Difficulty)
|
||||
{
|
||||
Category = category;
|
||||
Description = description;
|
||||
Scope = scope;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ using osu.Game.Localisation;
|
||||
|
||||
namespace osu.Game.Rulesets.Edit.Checks.Components
|
||||
{
|
||||
public enum VerifyChecksScope
|
||||
public enum CheckScope
|
||||
{
|
||||
/// <summary>
|
||||
/// Run checks that apply to the current difficulty.
|
||||
@@ -1,12 +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.
|
||||
|
||||
namespace osu.Game.Rulesets.Edit.Checks.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// A general check that can be run on a beatmap to verify or find issues that apply across the beatmapset itself.
|
||||
/// </summary>
|
||||
public interface IGeneralCheck : ICheck
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -106,11 +106,11 @@ namespace osu.Game.Screens.Edit.Verify
|
||||
|
||||
switch (verify.VerifyChecksScope.Value)
|
||||
{
|
||||
case VerifyChecksScope.Beatmapset:
|
||||
case CheckScope.Beatmapset:
|
||||
issues = filterByScope(generalVerifier.Run(context), true);
|
||||
break;
|
||||
|
||||
case VerifyChecksScope.Difficulty:
|
||||
case CheckScope.Difficulty:
|
||||
var generalIssues = filterByScope(generalVerifier.Run(context), false);
|
||||
var rulesetIssues = rulesetVerifier?.Run(context) ?? Enumerable.Empty<Issue>();
|
||||
issues = generalIssues.Concat(rulesetIssues);
|
||||
@@ -139,7 +139,7 @@ namespace osu.Game.Screens.Edit.Verify
|
||||
private IEnumerable<Issue> filterByScope(IEnumerable<Issue> issues, bool generalOnly)
|
||||
{
|
||||
return issues.Where(issue =>
|
||||
generalOnly ? issue.Check is IGeneralCheck : issue.Check is not IGeneralCheck);
|
||||
generalOnly ? issue.Check.Metadata.Scope == CheckScope.Beatmapset : issue.Check.Metadata.Scope == CheckScope.Difficulty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace osu.Game.Screens.Edit.Verify
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(VerifyScreen verify)
|
||||
{
|
||||
Flow.Add(new SettingsEnumDropdown<VerifyChecksScope>
|
||||
Flow.Add(new SettingsEnumDropdown<CheckScope>
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace osu.Game.Screens.Edit.Verify
|
||||
|
||||
public readonly Bindable<DifficultyRating> InterpretedDifficulty = new Bindable<DifficultyRating>();
|
||||
|
||||
public readonly Bindable<VerifyChecksScope> VerifyChecksScope = new Bindable<VerifyChecksScope>();
|
||||
public readonly Bindable<CheckScope> VerifyChecksScope = new Bindable<CheckScope>();
|
||||
|
||||
public readonly BindableList<IssueType> HiddenIssueTypes = new BindableList<IssueType> { IssueType.Negligible };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user