Identify scrolling rulesets using temporary DrawableRuleset instances

This commit is contained in:
Salman Ahmed 2022-11-20 04:12:50 +03:00
parent 58296bd4f0
commit 4b0ba86bd0

View File

@ -7,7 +7,9 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Rulesets.UI.Scrolling;
namespace osu.Game.Screens.Edit.Timing
{
@ -41,10 +43,8 @@ namespace osu.Game.Screens.Edit.Timing
omitBarLine.Current.BindValueChanged(_ => saveChanges());
scrollSpeedSlider.Current.BindValueChanged(_ => saveChanges());
// adjusting scroll speed on osu/catch rulesets results in undefined behaviour during legacy beatmap decoding, and generally shouldn't be shown.
// todo: there should be proper way to identify such rulesets, but this should do for now.
var ruleset = Beatmap.BeatmapInfo.Ruleset;
if (ruleset.OnlineID == 0 || ruleset.OnlineID == 2)
var drawableRuleset = Beatmap.BeatmapInfo.Ruleset.CreateInstance().CreateDrawableRulesetWith(Beatmap.PlayableBeatmap);
if (drawableRuleset is not IDrawableScrollingRuleset scrollingRuleset || scrollingRuleset.VisualisationMethod == ScrollVisualisationMethod.Constant)
scrollSpeedSlider.Hide();
void saveChanges()