diff --git a/src/hollywoo_flixel/FlxDirector.hx b/src/hollywoo_flixel/FlxDirector.hx index e6e7139..d970103 100644 --- a/src/hollywoo_flixel/FlxDirector.hx +++ b/src/hollywoo_flixel/FlxDirector.hx @@ -17,4 +17,4 @@ import flixel.system.FlxSound; import flixel.util.FlxTimer; @:build(kiss.Kiss.build()) -class FlxDirector implements Director {} +class FlxDirector implements Director {} diff --git a/src/hollywoo_flixel/FlxDirector.kiss b/src/hollywoo_flixel/FlxDirector.kiss index 1927305..ee4c200 100644 --- a/src/hollywoo_flixel/FlxDirector.kiss +++ b/src/hollywoo_flixel/FlxDirector.kiss @@ -1,6 +1,6 @@ (prop :FlxActionDigital continueAction) (prop actionManager (new FlxActionManager)) -(prop &mut :Movie movie) +(prop &mut :Movie movie) (defNew [] (set continueAction (new FlxActionDigital "Continue" onContinue)) @@ -105,17 +105,12 @@ } (set dialogText.y DIALOG_Y)) (dialogText.revive) + (startWaitForInput cc)) - // wait for input or delay - // TODO customize the delay in a more sophisticated way to the dialog length or voice-over length, - // or rely on FlxTypeText to add breathing room - (movie.delay (+ 5 (* 0.5 .length (text.split " "))) - ->{ - (dialogText.kill) - (speakerNameText.kill) - (dialogBox.kill) - (cc) - })) +(method :Void hideDialog [] + (dialogText.kill) + (speakerNameText.kill) + (dialogBox.kill)) (method :Void playSound [:FlxSound sound :Float volumeMod :Bool waitForEnd :Continuation cc] (let [originalVolume sound.volume @@ -128,6 +123,13 @@ (sound.play) (unless waitForEnd (cc))) +(method :Void playVoiceTrack [:FlxSound track :Float volumeMod :Float start :Float end :Continuation cc] + (let [originalVolume track.volume + restoreOriginalVolume ->(set track.volume originalVolume)] + (*= track.volume volumeMod) + (set track.onComplete ->{(restoreOriginalVolume) (cc)})) + (track.play false (* 1000 start) (* 1000 end))) + (prop &mut :FlxSound music) (prop MUSIC_FADE_SEC 1) (prop MUSIC_FADE_STEPS 10) diff --git a/src/hollywoo_flixel/FlxMovie.hx b/src/hollywoo_flixel/FlxMovie.hx index 341cbfc..fe44d71 100644 --- a/src/hollywoo_flixel/FlxMovie.hx +++ b/src/hollywoo_flixel/FlxMovie.hx @@ -31,4 +31,4 @@ enum FlxScreenPosition { /** * Model/controller of a Hollywoo-Flixel film, and main execution script */ -class FlxMovie extends Movie {} +class FlxMovie extends Movie {}