Add the playable beatmap as check argument

This is different from the working beatmap's `.Beatmap` property in that it is mutated by the ruleset/editor.

So hit objects, for example, are actually of type `Slider` and such instead of the legacy `ConvertSlider`.

This should be preferred over `workingBeatmap.Beatmap`.
This commit is contained in:
Naxess
2021-04-20 01:31:51 +02:00
parent 9a69ca34a6
commit 8656176ab8
11 changed files with 36 additions and 29 deletions

View File

@ -23,6 +23,9 @@ namespace osu.Game.Rulesets.Edit
new CheckAudioPresence(),
};
public IEnumerable<Issue> Run(WorkingBeatmap workingBeatmap) => checks.SelectMany(check => check.Run(workingBeatmap));
public IEnumerable<Issue> Run(IBeatmap playableBeatmap, WorkingBeatmap workingBeatmap)
{
return checks.SelectMany(check => check.Run(playableBeatmap, workingBeatmap));
}
}
}

View File

@ -30,9 +30,9 @@ namespace osu.Game.Rulesets.Edit.Checks
new IssueTemplateTooUncompressed(this)
};
public IEnumerable<Issue> Run(IWorkingBeatmap workingBeatmap)
public IEnumerable<Issue> Run(IBeatmap playableBeatmap, IWorkingBeatmap workingBeatmap)
{
var backgroundFile = workingBeatmap.Beatmap.Metadata?.BackgroundFile;
var backgroundFile = playableBeatmap.Metadata?.BackgroundFile;
if (backgroundFile == null)
yield break;
@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Edit.Checks
else if (texture.Width < low_width || texture.Height < low_height)
yield return new IssueTemplateLowResolution(this).Create(texture.Width, texture.Height);
string storagePath = workingBeatmap.Beatmap.BeatmapInfo.BeatmapSet.GetPathForFile(backgroundFile);
string storagePath = playableBeatmap.BeatmapInfo.BeatmapSet.GetPathForFile(backgroundFile);
double filesizeMb = workingBeatmap.GetStream(storagePath).Length / (1024d * 1024d);
if (filesizeMb > max_filesize_mb)

View File

@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Edit.Checks
new IssueTemplateDoesNotExist(this)
};
public IEnumerable<Issue> Run(IWorkingBeatmap workingBeatmap)
public IEnumerable<Issue> Run(IBeatmap playableBeatmap, IWorkingBeatmap workingBeatmap)
{
var filename = GetFilename(workingBeatmap);
@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Edit.Checks
}
// If the file is set, also make sure it still exists.
var storagePath = workingBeatmap.Beatmap.BeatmapInfo.BeatmapSet.GetPathForFile(filename);
var storagePath = playableBeatmap.BeatmapInfo.BeatmapSet.GetPathForFile(filename);
if (storagePath != null)
yield break;

View File

@ -24,7 +24,8 @@ namespace osu.Game.Rulesets.Edit.Checks.Components
/// <summary>
/// Runs this check and returns any issues detected for the provided beatmap.
/// </summary>
/// <param name="workingBeatmap">The beatmap to run the check on.</param>
public IEnumerable<Issue> Run(IWorkingBeatmap workingBeatmap);
/// <param name="playableBeatmap">The playable beatmap of the beatmap to run the check on.</param>
/// <param name="workingBeatmap">The working beatmap of the beatmap to run the check on.</param>
public IEnumerable<Issue> Run(IBeatmap playableBeatmap, IWorkingBeatmap workingBeatmap);
}
}

View File

@ -12,6 +12,6 @@ namespace osu.Game.Rulesets.Edit
/// </summary>
public interface IBeatmapVerifier
{
public IEnumerable<Issue> Run(WorkingBeatmap workingBeatmap);
public IEnumerable<Issue> Run(IBeatmap playableBeatmap, WorkingBeatmap workingBeatmap);
}
}