Keep loading when focus is lost
This commit is contained in:
@@ -302,7 +302,10 @@
|
|||||||
(FlxG.state.add titleCard)
|
(FlxG.state.add titleCard)
|
||||||
(cc))
|
(cc))
|
||||||
|
|
||||||
|
(prop &mut :Bool isLoading false)
|
||||||
(method :Void doLoading [:Array<Void->Void> _load :Continuation cc]
|
(method :Void doLoading [:Array<Void->Void> _load :Continuation cc]
|
||||||
|
(set isLoading true)
|
||||||
|
(set FlxG.autoPause false)
|
||||||
(set FlxG.mouse.visible false)
|
(set FlxG.mouse.visible false)
|
||||||
(let [doneFuncs []
|
(let [doneFuncs []
|
||||||
bar (new FlxBar 0 0 LEFT_TO_RIGHT (iThird FlxG.width) SimpleWindow.textSize doneFuncs "length" 0 _load.length true)
|
bar (new FlxBar 0 0 LEFT_TO_RIGHT (iThird FlxG.width) SimpleWindow.textSize doneFuncs "length" 0 _load.length true)
|
||||||
@@ -315,6 +318,10 @@
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
(set FlxG.mouse.visible true)
|
(set FlxG.mouse.visible true)
|
||||||
|
(set isLoading false)
|
||||||
|
(unless MovieFlxState.focused
|
||||||
|
(pause))
|
||||||
|
(set FlxG.autoPause true)
|
||||||
(FlxG.state.remove bar)
|
(FlxG.state.remove bar)
|
||||||
(cc)
|
(cc)
|
||||||
}) 1)]
|
}) 1)]
|
||||||
|
|||||||
@@ -4,3 +4,15 @@
|
|||||||
(set destroySubStates false)
|
(set destroySubStates false)
|
||||||
(super.create)
|
(super.create)
|
||||||
(set director (new FlxDirector)))
|
(set director (new FlxDirector)))
|
||||||
|
|
||||||
|
(var &mut focused true)
|
||||||
|
|
||||||
|
(method &override :Void onFocusLost []
|
||||||
|
(when FlxG.autoPause
|
||||||
|
(director.pause))
|
||||||
|
(set focused false))
|
||||||
|
|
||||||
|
(method &override :Void onFocus []
|
||||||
|
(when (and FlxG.autoPause !director.movie.paused)
|
||||||
|
(director.resume))
|
||||||
|
(set focused true))
|
||||||
Reference in New Issue
Block a user