mirror of
https://github.com/ppy/osu.git
synced 2025-03-28 20:47:22 +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 readonly Bindable<bool> beatmapSkins = new Bindable<bool>();
|
||||||
private bool beatmapSkinsOriginalState;
|
private LeasedBindable<bool>? leasedBeatmapSkins;
|
||||||
|
|
||||||
private void globallyDisableBeatmapSkinSetting()
|
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.
|
// 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.
|
// To keep things simple, disable the setting game-wide while using the skin editor.
|
||||||
beatmapSkinsOriginalState = beatmapSkins.Value;
|
leasedBeatmapSkins = beatmapSkins.BeginLease(true);
|
||||||
|
leasedBeatmapSkins.Value = false;
|
||||||
beatmapSkins.Value = false;
|
|
||||||
beatmapSkins.Disabled = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void globallyReenableBeatmapSkinSetting()
|
private void globallyReenableBeatmapSkinSetting()
|
||||||
{
|
{
|
||||||
if (!beatmapSkins.Disabled)
|
leasedBeatmapSkins?.Return();
|
||||||
return;
|
leasedBeatmapSkins = null;
|
||||||
|
|
||||||
beatmapSkins.Disabled = false;
|
|
||||||
beatmapSkins.Value = beatmapSkinsOriginalState;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user