Move shortcut labels and skip to shortcutHandler

This commit is contained in:
2023-04-03 07:58:26 -06:00
parent 89e04b791f
commit 2a7183b5fd
2 changed files with 33 additions and 3 deletions

View File

@@ -35,6 +35,8 @@ interface Director<Set:Cloneable<Set>, Actor, Sound, Song, Prop, VoiceTrack, Cam
function resume():Void;
function showPauseMenu(resume:Continuation):Void;
function chooseString(prompt:String, choices:Array<String>, submit:String->Void):Void;
function defineLightSource(submit:LightSource->Void):Void;
function showSet(set:Set, time:SceneTime, perspective:ScenePerspective, appearance:Appearance, camera:Camera, cc:Continuation):Void;

View File

@@ -140,6 +140,19 @@
(director.showProp p.prop p.position 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]
(typeCase [position]
([:String positionKey]
@@ -173,11 +186,12 @@
(voiceLines.loadMatches voiceLinesJson))
(let [shortcutHandler (director.shortcutHandler)
cc ->(director.resume)]
cc ->(resume)]
(set shortcutHandler.onSelectItem
->process {
// TODO pause all delays (which will require ditching haxe.Timer!!!)
(director.pause)
(pause)
// TODO this is dicey but it allows processes to use the handler:
(shortcutHandler.start)
(process cc)
})
(shortcutHandler.registerItem "{escape} Pause the movie"
@@ -193,6 +207,20 @@
(director.showLighting .time (_currentScene) arr.elements .camera (_currentScene))
(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))
(super)))