fix repeated show() calls

This commit is contained in:
2022-08-09 23:38:56 +00:00
parent de175cbdb5
commit 03db108767

View File

@@ -52,18 +52,23 @@
// TODO makeButton // TODO makeButton
// TODO make inputText // TODO make inputText
(prop &mut _shown false)
(method show [] (method show []
(FlxG.state.add this) (unless _shown
(FlxG.state.add controls) (FlxG.state.add this)
(windowStack.push this) (FlxG.state.add controls)
(keyHandler.start)) (windowStack.push this)
(keyHandler.start)
(set _shown true)))
(method hide [] (method hide []
(FlxG.state.remove this) (when _shown
(FlxG.state.remove controls) (FlxG.state.remove this)
(windowStack.remove this) (FlxG.state.remove controls)
(keyHandler.cancel)) (windowStack.remove this)
(keyHandler.cancel)
(set _shown false)))
(method &override update [:Float elapsed] (method &override update [:Float elapsed]
(super.update elapsed) (super.update elapsed)