Move shortcut labels and skip to shortcutHandler
This commit is contained in:
@@ -39,29 +39,7 @@
|
|||||||
`(new FlxSprite 0 0 ,(b.field (symbolNameValue asset) (b.symbol "AssetPaths"))))
|
`(new FlxSprite 0 0 ,(b.field (symbolNameValue asset) (b.symbol "AssetPaths"))))
|
||||||
|
|
||||||
(method :Void update [:Float elapsed]
|
(method :Void update [:Float elapsed]
|
||||||
(.update (cast (director.shortcutHandler) kiss_tools.FlxKeyShortcutHandler<Dynamic>))
|
(.update (cast (director.shortcutHandler) kiss_tools.FlxKeyShortcutHandler<Dynamic>)))
|
||||||
**(#when debug
|
|
||||||
(when FlxG.keys.justPressed.N
|
|
||||||
(skipToNextLabel))
|
|
||||||
(when FlxG.keys.justPressed.L
|
|
||||||
(showLabelSkipButtons))))
|
|
||||||
|
|
||||||
(method :Void showLabelSkipButtons []
|
|
||||||
(let [runners (labelRunners)]
|
|
||||||
(localVar &mut buttonY 0)
|
|
||||||
(localVar buttonsPerColumn 25)
|
|
||||||
(kiss_flixel.SimpleWindow.promptForChoice
|
|
||||||
"Skip to scene?"
|
|
||||||
(sort (collect (runners.keys)))
|
|
||||||
->label ((dictGet runners label))
|
|
||||||
FlxColor.BLACK
|
|
||||||
FlxColor.WHITE
|
|
||||||
0.8
|
|
||||||
0.8
|
|
||||||
true
|
|
||||||
"escape"
|
|
||||||
"left"
|
|
||||||
"right")))
|
|
||||||
|
|
||||||
(defAlias &ident flxDirector (cast director FlxDirector))
|
(defAlias &ident flxDirector (cast director FlxDirector))
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ interface Director<Set:Cloneable<Set>, Actor, Sound, Song, Prop, VoiceTrack, Cam
|
|||||||
function resume():Void;
|
function resume():Void;
|
||||||
function showPauseMenu(resume:Continuation):Void;
|
function showPauseMenu(resume:Continuation):Void;
|
||||||
|
|
||||||
|
function chooseString(prompt:String, choices:Array<String>, submit:String->Void):Void;
|
||||||
|
|
||||||
function defineLightSource(submit:LightSource->Void):Void;
|
function defineLightSource(submit:LightSource->Void):Void;
|
||||||
|
|
||||||
function showSet(set:Set, time:SceneTime, perspective:ScenePerspective, appearance:Appearance, camera:Camera, cc:Continuation):Void;
|
function showSet(set:Set, time:SceneTime, perspective:ScenePerspective, appearance:Appearance, camera:Camera, cc:Continuation):Void;
|
||||||
|
|||||||
@@ -140,6 +140,19 @@
|
|||||||
(director.showProp p.prop p.position cc)
|
(director.showProp p.prop p.position cc)
|
||||||
cc))))))
|
cc))))))
|
||||||
|
|
||||||
|
(prop &mut :Bool paused false)
|
||||||
|
|
||||||
|
(method pause []
|
||||||
|
(unless paused
|
||||||
|
// TODO pause all delays (which will require ditching haxe.Timer!!!)
|
||||||
|
(set paused true)
|
||||||
|
(director.pause)))
|
||||||
|
|
||||||
|
(method resume []
|
||||||
|
(when paused
|
||||||
|
(set paused false)
|
||||||
|
(director.resume)))
|
||||||
|
|
||||||
(method resolvePosition [:Dynamic position]
|
(method resolvePosition [:Dynamic position]
|
||||||
(typeCase [position]
|
(typeCase [position]
|
||||||
([:String positionKey]
|
([:String positionKey]
|
||||||
@@ -173,11 +186,12 @@
|
|||||||
(voiceLines.loadMatches voiceLinesJson))
|
(voiceLines.loadMatches voiceLinesJson))
|
||||||
|
|
||||||
(let [shortcutHandler (director.shortcutHandler)
|
(let [shortcutHandler (director.shortcutHandler)
|
||||||
cc ->(director.resume)]
|
cc ->(resume)]
|
||||||
(set shortcutHandler.onSelectItem
|
(set shortcutHandler.onSelectItem
|
||||||
->process {
|
->process {
|
||||||
// TODO pause all delays (which will require ditching haxe.Timer!!!)
|
(pause)
|
||||||
(director.pause)
|
// TODO this is dicey but it allows processes to use the handler:
|
||||||
|
(shortcutHandler.start)
|
||||||
(process cc)
|
(process cc)
|
||||||
})
|
})
|
||||||
(shortcutHandler.registerItem "{escape} Pause the movie"
|
(shortcutHandler.registerItem "{escape} Pause the movie"
|
||||||
@@ -193,6 +207,20 @@
|
|||||||
(director.showLighting .time (_currentScene) arr.elements .camera (_currentScene))
|
(director.showLighting .time (_currentScene) arr.elements .camera (_currentScene))
|
||||||
(cc))
|
(cc))
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
(shortcutHandler.registerItem "[n]ext label"
|
||||||
|
->cc
|
||||||
|
(skipToNextLabel))
|
||||||
|
(shortcutHandler.registerItem "skip to [l]abel"
|
||||||
|
->cc
|
||||||
|
(let [runners (labelRunners)]
|
||||||
|
(localVar &mut buttonY 0)
|
||||||
|
(localVar buttonsPerColumn 25)
|
||||||
|
(director.chooseString
|
||||||
|
"Skip to scene?"
|
||||||
|
(sort (collect (runners.keys)))
|
||||||
|
->label ((dictGet runners label)))))
|
||||||
|
|
||||||
(shortcutHandler.start))
|
(shortcutHandler.start))
|
||||||
|
|
||||||
(super)))
|
(super)))
|
||||||
|
|||||||
Reference in New Issue
Block a user