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

Persist the state of "show speed changes" between editor sessions

Addresses https://github.com/ppy/osu/discussions/25149.
This commit is contained in:
Dean Herbert 2023-10-17 16:01:00 +09:00
parent 6f4a2b9889
commit 165cd07428
No known key found for this signature in database
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);
}
}
}