mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 08:52:55 +08:00
Use bindable lease instead of reimplementing the same thing locally
This commit is contained in:
parent
d7b486e2ac
commit
366dd96875
@ -203,7 +203,7 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
}
|
||||
|
||||
private readonly Bindable<bool> beatmapSkins = new Bindable<bool>();
|
||||
private bool beatmapSkinsOriginalState;
|
||||
private LeasedBindable<bool>? leasedBeatmapSkins;
|
||||
|
||||
private void globallyDisableBeatmapSkinSetting()
|
||||
{
|
||||
@ -212,19 +212,14 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
|
||||
// The skin editor doesn't work well if beatmap skins are being applied to the player screen.
|
||||
// To keep things simple, disable the setting game-wide while using the skin editor.
|
||||
beatmapSkinsOriginalState = beatmapSkins.Value;
|
||||
|
||||
beatmapSkins.Value = false;
|
||||
beatmapSkins.Disabled = true;
|
||||
leasedBeatmapSkins = beatmapSkins.BeginLease(true);
|
||||
leasedBeatmapSkins.Value = false;
|
||||
}
|
||||
|
||||
private void globallyReenableBeatmapSkinSetting()
|
||||
{
|
||||
if (!beatmapSkins.Disabled)
|
||||
return;
|
||||
|
||||
beatmapSkins.Disabled = false;
|
||||
beatmapSkins.Value = beatmapSkinsOriginalState;
|
||||
leasedBeatmapSkins?.Return();
|
||||
leasedBeatmapSkins = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user