mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 17:13:06 +08:00
Add beatmap minimum length checks
This commit is contained in:
parent
8b222dc42b
commit
9a2915f423
@ -34,6 +34,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
new CheckUnsnappedObjects(),
|
new CheckUnsnappedObjects(),
|
||||||
new CheckConcurrentObjects(),
|
new CheckConcurrentObjects(),
|
||||||
new CheckZeroLengthObjects(),
|
new CheckZeroLengthObjects(),
|
||||||
|
new CheckDrainTime(),
|
||||||
|
|
||||||
// Timing
|
// Timing
|
||||||
new CheckPreviewTime(),
|
new CheckPreviewTime(),
|
||||||
|
38
osu.Game/Rulesets/Edit/Checks/CheckDrainTime.cs
Normal file
38
osu.Game/Rulesets/Edit/Checks/CheckDrainTime.cs
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
// 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;
|
||||||
|
using osu.Game.Rulesets.Edit.Checks.Components;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Edit.Checks
|
||||||
|
{
|
||||||
|
public class CheckDrainTime : ICheck
|
||||||
|
{
|
||||||
|
private const int min_drain_threshold = 30 * 1000;
|
||||||
|
public CheckMetadata Metadata => new CheckMetadata(CheckCategory.Compose, "Too short drain time");
|
||||||
|
|
||||||
|
public IEnumerable<IssueTemplate> PossibleTemplates => new IssueTemplate[]
|
||||||
|
{
|
||||||
|
new IssueTemplateTooShort(this)
|
||||||
|
};
|
||||||
|
|
||||||
|
public IEnumerable<Issue> Run(BeatmapVerifierContext context)
|
||||||
|
{
|
||||||
|
double drainTime = context.Beatmap.CalculatePlayableLength();
|
||||||
|
|
||||||
|
if (drainTime < min_drain_threshold)
|
||||||
|
yield return new IssueTemplateTooShort(this).Create((int)(drainTime / 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
public class IssueTemplateTooShort : IssueTemplate
|
||||||
|
{
|
||||||
|
public IssueTemplateTooShort(ICheck check)
|
||||||
|
: base(check, IssueType.Problem, "Less than 30 seconds of drain time, currently {0}.")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public Issue Create(int drainTimeSeconds) => new Issue(this, drainTimeSeconds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user