1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 15:03:13 +08:00

Fix migration not working correctly when applying on a default skin

This commit is contained in:
Dean Herbert 2022-04-28 14:09:41 +09:00
parent aabe586578
commit 7c1b0b41ff

View File

@ -162,7 +162,6 @@ namespace osu.Game.Screens.Play
if (!configShowGraph.IsDefault)
{
ShowGraph.Value = configShowGraph.Value;
configShowGraph.SetDefault();
// This is pretty ugly, but the only way to make this stick...
if (skinManager != null)
@ -171,17 +170,17 @@ namespace osu.Game.Screens.Play
if (skinnableTarget != null)
{
skinManager.EnsureMutableSkin();
// If the skin is not mutable, a mutable instance will be created, causing this migration logic to run again on the correct skin.
// Therefore we want to avoid resetting the config value on this invocation.
if (skinManager.EnsureMutableSkin())
return;
// If `EnsureMutableSkin` actually changed the skin, default layout may take a frame to apply.
// See `SkinnableTargetComponentsContainer`'s use of ScheduleAfterChildren.
ScheduleAfterChildren(() =>
{
var skin = skinManager.CurrentSkin.Value;
skin.UpdateDrawableTarget(skinnableTarget);
var skin = skinManager.CurrentSkin.Value;
skin.UpdateDrawableTarget(skinnableTarget);
skinManager.Save(skin);
});
skinManager.Save(skin);
configShowGraph.SetDefault();
}
}
}