Skip to content

Commit

Permalink
Merge pull request #25153 from peppy/store-speed-change-config
Browse files Browse the repository at this point in the history
Persist the state of "show speed changes" between editor sessions
  • Loading branch information
bdach committed Oct 17, 2023
2 parents 6f4a2b9 + 165cd07 commit 5833c20
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 2 additions & 0 deletions osu.Game/Configuration/OsuConfigManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ protected override void InitialiseDefaults()
SetDefault(OsuSetting.EditorShowHitMarkers, true);
SetDefault(OsuSetting.EditorAutoSeekOnPlacement, true);
SetDefault(OsuSetting.EditorLimitedDistanceSnap, false);
SetDefault(OsuSetting.EditorShowSpeedChanges, false);

SetDefault(OsuSetting.LastProcessedMetadataId, -1);

Expand Down Expand Up @@ -407,5 +408,6 @@ public enum OsuSetting
EditorLimitedDistanceSnap,
ReplaySettingsOverlay,
AutomaticallyDownloadMissingBeatmaps,
EditorShowSpeedChanges
}
}
15 changes: 13 additions & 2 deletions osu.Game/Rulesets/Edit/ScrollingHitObjectComposer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
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;
Expand All @@ -18,14 +19,15 @@ public abstract partial class ScrollingHitObjectComposer<TObject> : HitObjectCom
where TObject : HitObject
{
private readonly Bindable<TernaryState> showSpeedChanges = new Bindable<TernaryState>();
private Bindable<bool> configShowSpeedChanges = null!;

protected ScrollingHitObjectComposer(Ruleset ruleset)
: base(ruleset)
{
}

[BackgroundDependencyLoader]
private void load()
private void load(OsuConfigManager config)
{
if (DrawableRuleset is ISupportConstantAlgorithmToggle toggleRuleset)
{
Expand All @@ -44,7 +46,16 @@ private void load()
},
});

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);
}
}
}
Expand Down

0 comments on commit 5833c20

Please sign in to comment.