Merge pull request #25153 from peppy/store-speed-change-config

Persist the state of "show speed changes" between editor sessions
This commit is contained in:
Bartłomiej Dach 2023-10-17 10:23:00 +02:00 committed by GitHub
commit 5833c20be5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View File

@ -184,6 +184,7 @@ namespace osu.Game.Configuration
SetDefault(OsuSetting.EditorShowHitMarkers, true);
SetDefault(OsuSetting.EditorAutoSeekOnPlacement, true);
SetDefault(OsuSetting.EditorLimitedDistanceSnap, false);
SetDefault(OsuSetting.EditorShowSpeedChanges, false);
SetDefault(OsuSetting.LastProcessedMetadataId, -1);
@ -407,5 +408,6 @@ namespace osu.Game.Configuration
EditorLimitedDistanceSnap,
ReplaySettingsOverlay,
AutomaticallyDownloadMissingBeatmaps,
EditorShowSpeedChanges
}
}

View File

@ -6,6 +6,7 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.UI.Scrolling;
@ -18,6 +19,7 @@ namespace osu.Game.Rulesets.Edit
where TObject : HitObject
{
private readonly Bindable<TernaryState> showSpeedChanges = new Bindable<TernaryState>();
private Bindable<bool> configShowSpeedChanges = null!;
protected ScrollingHitObjectComposer(Ruleset ruleset)
: base(ruleset)
@ -25,7 +27,7 @@ namespace osu.Game.Rulesets.Edit
}
[BackgroundDependencyLoader]
private void load()
private void load(OsuConfigManager config)
{
if (DrawableRuleset is ISupportConstantAlgorithmToggle toggleRuleset)
{
@ -44,7 +46,16 @@ namespace osu.Game.Rulesets.Edit
},
});
showSpeedChanges.BindValueChanged(state => toggleRuleset.ShowSpeedChanges.Value = state.NewValue == TernaryState.True, true);
configShowSpeedChanges = config.GetBindable<bool>(OsuSetting.EditorShowSpeedChanges);
configShowSpeedChanges.BindValueChanged(enabled => showSpeedChanges.Value = enabled.NewValue ? TernaryState.True : TernaryState.False, true);
showSpeedChanges.BindValueChanged(state =>
{
bool enabled = state.NewValue == TernaryState.True;
toggleRuleset.ShowSpeedChanges.Value = enabled;
configShowSpeedChanges.Value = enabled;
}, true);
}
}
}