mirror of
https://github.com/ppy/osu.git
synced 2024-12-05 03:22:55 +08:00
Fix SkinEditor
potentially initialising change handler while components are not loaded yet
This commit is contained in:
parent
66ca744843
commit
936677f56a
@ -353,9 +353,10 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
return;
|
||||
}
|
||||
|
||||
changeHandler = new SkinEditorChangeHandler(skinComponentsContainer);
|
||||
changeHandler.CanUndo.BindValueChanged(v => undoMenuItem.Action.Disabled = !v.NewValue, true);
|
||||
changeHandler.CanRedo.BindValueChanged(v => redoMenuItem.Action.Disabled = !v.NewValue, true);
|
||||
if (skinComponentsContainer.IsLoaded)
|
||||
bindChangeHandler(skinComponentsContainer);
|
||||
else
|
||||
skinComponentsContainer.OnLoadComplete += d => Schedule(() => bindChangeHandler((SkinnableContainer)d));
|
||||
|
||||
content.Child = new SkinBlueprintContainer(skinComponentsContainer);
|
||||
|
||||
@ -397,6 +398,13 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
SelectedComponents.Clear();
|
||||
placeComponent(component);
|
||||
}
|
||||
|
||||
void bindChangeHandler(SkinnableContainer skinnableContainer)
|
||||
{
|
||||
changeHandler = new SkinEditorChangeHandler(skinnableContainer);
|
||||
changeHandler.CanUndo.BindValueChanged(v => undoMenuItem.Action.Disabled = !v.NewValue, true);
|
||||
changeHandler.CanRedo.BindValueChanged(v => redoMenuItem.Action.Disabled = !v.NewValue, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void skinChanged()
|
||||
|
Loading…
Reference in New Issue
Block a user