From d370f64ac3e83ece673948b6d9d59804814da615 Mon Sep 17 00:00:00 2001 From: Darius Wattimena Date: Wed, 10 Nov 2021 19:58:36 +0100 Subject: [PATCH] Changed finding the spinner gaps via a dictionary instead of getting the thresholds via an array --- .../Edit/Checks/CheckBananaShowerGap.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Edit/Checks/CheckBananaShowerGap.cs b/osu.Game.Rulesets.Catch/Edit/Checks/CheckBananaShowerGap.cs index d6671cb9db..4b2933c0e1 100644 --- a/osu.Game.Rulesets.Catch/Edit/Checks/CheckBananaShowerGap.cs +++ b/osu.Game.Rulesets.Catch/Edit/Checks/CheckBananaShowerGap.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Checks.Components; @@ -15,8 +16,15 @@ namespace osu.Game.Rulesets.Catch.Edit.Checks /// public class CheckBananaShowerGap : ICheck { - private static readonly int[] spinner_start_delta_threshold = { 250, 250, 125, 125, 62, 62 }; - private static readonly int[] spinner_end_delta_threshold = { 250, 250, 250, 125, 125, 125 }; + private static readonly Dictionary spinner_delta_threshold = new Dictionary + { + [DifficultyRating.Easy] = (250, 250), + [DifficultyRating.Normal] = (250, 250), + [DifficultyRating.Hard] = (125, 250), + [DifficultyRating.Insane] = (125, 125), + [DifficultyRating.Expert] = (62, 125), + [DifficultyRating.ExpertPlus] = (62, 125) + }; public CheckMetadata Metadata { get; } = new CheckMetadata(CheckCategory.Compose, "Too short spinner gap"); @@ -29,9 +37,7 @@ namespace osu.Game.Rulesets.Catch.Edit.Checks public IEnumerable Run(BeatmapVerifierContext context) { var hitObjects = context.Beatmap.HitObjects; - int interpretedDifficulty = (int)context.InterpretedDifficulty; - int expectedStartDelta = spinner_start_delta_threshold[interpretedDifficulty]; - int expectedEndDelta = spinner_end_delta_threshold[interpretedDifficulty]; + (int expectedStartDelta, int expectedEndDelta) = spinner_delta_threshold[context.InterpretedDifficulty]; for (int i = 0; i < hitObjects.Count - 1; ++i) {