buttons to skip to labels
This commit is contained in:
@@ -120,7 +120,17 @@ class AsyncEmbeddedScript {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO skip to label by name
|
||||
public function skipToLabel(name:String) {
|
||||
var ip = labels[name];
|
||||
if (lastInstructionPointer > ip) {
|
||||
throw "Rewinding AsyncEmbeddedScript is not implemented";
|
||||
}
|
||||
skipToInstruction(ip);
|
||||
}
|
||||
|
||||
public function labelRunners():Map<String,Void->Void> {
|
||||
return [for (label => ip in labels) label => () -> skipToInstruction(ip)];
|
||||
}
|
||||
|
||||
#if macro
|
||||
public static function build(dslHaxelib:String, dslFile:String, scriptFile:String):Array<Field> {
|
||||
|
||||
@@ -33,6 +33,8 @@ enum FlxScreenPosition {
|
||||
* Model/controller of a Hollywoo-Flixel film, and main execution script
|
||||
*/
|
||||
class FlxMovie extends Movie<String, FlxStagePosition, FlxStageFacing, FlxScreenPosition, ActorFlxSprite, FlxSound, String, FlxSprite, FlxSound> {
|
||||
// Think of HollywooFlixelDSL.kiss as the corresponding Kiss file for this class!
|
||||
|
||||
public function new(director:FlxDirector, ?voiceLinesAssetPath:String) {
|
||||
var voiceLinesJson = null;
|
||||
if (voiceLinesAssetPath != null) {
|
||||
|
||||
@@ -33,4 +33,16 @@
|
||||
(method :Void update [:Float elapsed]
|
||||
(#when debug
|
||||
(when FlxG.keys.justPressed.N
|
||||
(skipToNextLabel))))
|
||||
(skipToNextLabel))
|
||||
(when FlxG.keys.justPressed.L
|
||||
(showLabelSkipButtons))))
|
||||
|
||||
(method :Void showLabelSkipButtons []
|
||||
(let [runners (labelRunners)
|
||||
buttons (new flixel.group.FlxGroup.FlxTypedGroup<flixel.ui.FlxButton>)]
|
||||
(localVar &mut buttonY 0)
|
||||
(doFor =>label runner runners
|
||||
(let [b (new flixel.ui.FlxButton 0 buttonY label ->{(FlxG.state.remove buttons)(runner)})]
|
||||
(buttons.add b))
|
||||
(+= buttonY 20))
|
||||
(FlxG.state.add buttons)))
|
||||
Reference in New Issue
Block a user