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

Merge pull request #23434 from peppy/tick-rate-adjust

Add the ability to change the beatmap tick rate in the editor
This commit is contained in:
Bartłomiej Dach 2023-05-09 22:12:23 +02:00 committed by GitHub
commit 6604b9f1e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 16 deletions

View File

@ -384,11 +384,11 @@ namespace osu.Game.Beatmaps.Formats
break; break;
case @"SliderMultiplier": case @"SliderMultiplier":
difficulty.SliderMultiplier = Parsing.ParseDouble(pair.Value); difficulty.SliderMultiplier = Math.Clamp(Parsing.ParseDouble(pair.Value), 0.4, 3.6);
break; break;
case @"SliderTickRate": case @"SliderTickRate":
difficulty.SliderTickRate = Parsing.ParseDouble(pair.Value); difficulty.SliderTickRate = Math.Clamp(Parsing.ParseDouble(pair.Value), 0.5, 8);
break; break;
} }
} }

View File

@ -42,8 +42,7 @@ namespace osu.Game.Localisation
/// <summary> /// <summary>
/// "If enabled, an &quot;Are you ready? 3, 2, 1, GO!&quot; countdown will be inserted at the beginning of the beatmap, assuming there is enough time to do so." /// "If enabled, an &quot;Are you ready? 3, 2, 1, GO!&quot; countdown will be inserted at the beginning of the beatmap, assuming there is enough time to do so."
/// </summary> /// </summary>
public static LocalisableString CountdownDescription => new TranslatableString(getKey(@"countdown_description"), public static LocalisableString CountdownDescription => new TranslatableString(getKey(@"countdown_description"), @"If enabled, an ""Are you ready? 3, 2, 1, GO!"" countdown will be inserted at the beginning of the beatmap, assuming there is enough time to do so.");
@"If enabled, an ""Are you ready? 3, 2, 1, GO!"" countdown will be inserted at the beginning of the beatmap, assuming there is enough time to do so.");
/// <summary> /// <summary>
/// "Countdown speed" /// "Countdown speed"
@ -53,8 +52,7 @@ namespace osu.Game.Localisation
/// <summary> /// <summary>
/// "If the countdown sounds off-time, use this to make it appear one or more beats early." /// "If the countdown sounds off-time, use this to make it appear one or more beats early."
/// </summary> /// </summary>
public static LocalisableString CountdownOffsetDescription => public static LocalisableString CountdownOffsetDescription => new TranslatableString(getKey(@"countdown_offset_description"), @"If the countdown sounds off-time, use this to make it appear one or more beats early.");
new TranslatableString(getKey(@"countdown_offset_description"), @"If the countdown sounds off-time, use this to make it appear one or more beats early.");
/// <summary> /// <summary>
/// "Countdown offset" /// "Countdown offset"
@ -69,8 +67,7 @@ namespace osu.Game.Localisation
/// <summary> /// <summary>
/// "Allows storyboards to use the full screen space, rather than be confined to a 4:3 area." /// "Allows storyboards to use the full screen space, rather than be confined to a 4:3 area."
/// </summary> /// </summary>
public static LocalisableString WidescreenSupportDescription => public static LocalisableString WidescreenSupportDescription => new TranslatableString(getKey(@"widescreen_support_description"), @"Allows storyboards to use the full screen space, rather than be confined to a 4:3 area.");
new TranslatableString(getKey(@"widescreen_support_description"), @"Allows storyboards to use the full screen space, rather than be confined to a 4:3 area.");
/// <summary> /// <summary>
/// "Epilepsy warning" /// "Epilepsy warning"
@ -80,8 +77,7 @@ namespace osu.Game.Localisation
/// <summary> /// <summary>
/// "Recommended if the storyboard or video contain scenes with rapidly flashing colours." /// "Recommended if the storyboard or video contain scenes with rapidly flashing colours."
/// </summary> /// </summary>
public static LocalisableString EpilepsyWarningDescription => public static LocalisableString EpilepsyWarningDescription => new TranslatableString(getKey(@"epilepsy_warning_description"), @"Recommended if the storyboard or video contain scenes with rapidly flashing colours.");
new TranslatableString(getKey(@"epilepsy_warning_description"), @"Recommended if the storyboard or video contain scenes with rapidly flashing colours.");
/// <summary> /// <summary>
/// "Letterbox during breaks" /// "Letterbox during breaks"
@ -91,8 +87,7 @@ namespace osu.Game.Localisation
/// <summary> /// <summary>
/// "Adds horizontal letterboxing to give a cinematic look during breaks." /// "Adds horizontal letterboxing to give a cinematic look during breaks."
/// </summary> /// </summary>
public static LocalisableString LetterboxDuringBreaksDescription => public static LocalisableString LetterboxDuringBreaksDescription => new TranslatableString(getKey(@"letterbox_during_breaks_description"), @"Adds horizontal letterboxing to give a cinematic look during breaks.");
new TranslatableString(getKey(@"letterbox_during_breaks_description"), @"Adds horizontal letterboxing to give a cinematic look during breaks.");
/// <summary> /// <summary>
/// "Samples match playback rate" /// "Samples match playback rate"
@ -102,8 +97,7 @@ namespace osu.Game.Localisation
/// <summary> /// <summary>
/// "When enabled, all samples will speed up or slow down when rate-changing mods are enabled." /// "When enabled, all samples will speed up or slow down when rate-changing mods are enabled."
/// </summary> /// </summary>
public static LocalisableString SamplesMatchPlaybackRateDescription => new TranslatableString(getKey(@"samples_match_playback_rate_description"), public static LocalisableString SamplesMatchPlaybackRateDescription => new TranslatableString(getKey(@"samples_match_playback_rate_description"), @"When enabled, all samples will speed up or slow down when rate-changing mods are enabled.");
@"When enabled, all samples will speed up or slow down when rate-changing mods are enabled.");
/// <summary> /// <summary>
/// "The size of all hit objects" /// "The size of all hit objects"
@ -123,8 +117,17 @@ namespace osu.Game.Localisation
/// <summary> /// <summary>
/// "The harshness of hit windows and difficulty of special objects (ie. spinners)" /// "The harshness of hit windows and difficulty of special objects (ie. spinners)"
/// </summary> /// </summary>
public static LocalisableString OverallDifficultyDescription => public static LocalisableString OverallDifficultyDescription => new TranslatableString(getKey(@"overall_difficulty_description"), @"The harshness of hit windows and difficulty of special objects (ie. spinners)");
new TranslatableString(getKey(@"overall_difficulty_description"), @"The harshness of hit windows and difficulty of special objects (ie. spinners)");
/// <summary>
/// "Tick Rate"
/// </summary>
public static LocalisableString TickRate => new TranslatableString(getKey(@"tick_rate"), @"Tick Rate");
/// <summary>
/// "Determines how many &quot;ticks&quot; are generated within long hit objects. A tick rate of 1 will generate ticks on each beat, 2 would be twice per beat, etc."
/// </summary>
public static LocalisableString TickRateDescription => new TranslatableString(getKey(@"tick_rate_description"), @"Determines how many ""ticks"" are generated within long hit objects. A tick rate of 1 will generate ticks on each beat, 2 would be twice per beat, etc.");
/// <summary> /// <summary>
/// "Base Velocity" /// "Base Velocity"

View File

@ -20,6 +20,7 @@ namespace osu.Game.Screens.Edit.Setup
private LabelledSliderBar<float> approachRateSlider = null!; private LabelledSliderBar<float> approachRateSlider = null!;
private LabelledSliderBar<float> overallDifficultySlider = null!; private LabelledSliderBar<float> overallDifficultySlider = null!;
private LabelledSliderBar<double> baseVelocitySlider = null!; private LabelledSliderBar<double> baseVelocitySlider = null!;
private LabelledSliderBar<double> tickRateSlider = null!;
public override LocalisableString Title => EditorSetupStrings.DifficultyHeader; public override LocalisableString Title => EditorSetupStrings.DifficultyHeader;
@ -93,6 +94,19 @@ namespace osu.Game.Screens.Edit.Setup
Precision = 0.01f, Precision = 0.01f,
} }
}, },
tickRateSlider = new LabelledSliderBar<double>
{
Label = EditorSetupStrings.TickRate,
FixedLabelWidth = LABEL_WIDTH,
Description = EditorSetupStrings.TickRateDescription,
Current = new BindableDouble(Beatmap.Difficulty.SliderTickRate)
{
Default = 1,
MinValue = 1,
MaxValue = 4,
Precision = 1,
}
},
}; };
foreach (var item in Children.OfType<LabelledSliderBar<float>>()) foreach (var item in Children.OfType<LabelledSliderBar<float>>())
@ -111,6 +125,7 @@ namespace osu.Game.Screens.Edit.Setup
Beatmap.Difficulty.ApproachRate = approachRateSlider.Current.Value; Beatmap.Difficulty.ApproachRate = approachRateSlider.Current.Value;
Beatmap.Difficulty.OverallDifficulty = overallDifficultySlider.Current.Value; Beatmap.Difficulty.OverallDifficulty = overallDifficultySlider.Current.Value;
Beatmap.Difficulty.SliderMultiplier = baseVelocitySlider.Current.Value; Beatmap.Difficulty.SliderMultiplier = baseVelocitySlider.Current.Value;
Beatmap.Difficulty.SliderTickRate = tickRateSlider.Current.Value;
Beatmap.UpdateAllHitObjects(); Beatmap.UpdateAllHitObjects();
Beatmap.SaveState(); Beatmap.SaveState();