Movies support skippable timed delays
This commit is contained in:
@@ -7,6 +7,7 @@ import flixel.FlxSprite;
|
|||||||
import flixel.input.actions.FlxAction;
|
import flixel.input.actions.FlxAction;
|
||||||
import flixel.input.actions.FlxActionManager;
|
import flixel.input.actions.FlxActionManager;
|
||||||
import flixel.input.mouse.FlxMouseButton;
|
import flixel.input.mouse.FlxMouseButton;
|
||||||
|
import hollywoo.Movie;
|
||||||
import hollywoo.Scene;
|
import hollywoo.Scene;
|
||||||
import hollywoo.Director;
|
import hollywoo.Director;
|
||||||
import hollywoo_flixel.FlxMovie;
|
import hollywoo_flixel.FlxMovie;
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
(prop :FlxActionDigital continueAction)
|
(prop :FlxActionDigital continueAction)
|
||||||
(prop actionManager (new FlxActionManager))
|
(prop actionManager (new FlxActionManager))
|
||||||
|
(prop &mut :Movie<String,FlxStagePosition,FlxStageFacing,FlxScreenPosition,ActorFlxSprite,FlxSound,String> movie)
|
||||||
|
|
||||||
(defNew []
|
(defNew []
|
||||||
(set continueAction (new FlxActionDigital "Continue" onContinue))
|
(set continueAction (new FlxActionDigital "Continue" onContinue))
|
||||||
@@ -44,15 +45,11 @@
|
|||||||
(set nextCC null)
|
(set nextCC null)
|
||||||
(cc)))
|
(cc)))
|
||||||
|
|
||||||
(method :Void waitForInputOrDelay [:Float delaySeconds :Continuation cc]
|
(method :Void startWaitForInput [:Continuation cc]
|
||||||
// TODO allow user to choose between automatic delays and continue checks
|
(set nextCC cc))
|
||||||
(if true
|
|
||||||
//{
|
(method :Void stopWaitForInput []
|
||||||
(set nextCC cc)
|
(set nextCC null))
|
||||||
// TODO show an indicator that input is needed
|
|
||||||
//}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
(var DIALOG_X 300)
|
(var DIALOG_X 300)
|
||||||
(var DIALOG_WIDTH (- 1280 ACTOR_WIDTH ACTOR_WIDTH))
|
(var DIALOG_WIDTH (- 1280 ACTOR_WIDTH ACTOR_WIDTH))
|
||||||
@@ -95,9 +92,10 @@
|
|||||||
(set dialogText.y DIALOG_Y))
|
(set dialogText.y DIALOG_Y))
|
||||||
(dialogText.revive)
|
(dialogText.revive)
|
||||||
|
|
||||||
// wait for input
|
// wait for input or delay
|
||||||
// TODO customize the delay to the dialog length or voice-over length
|
// TODO customize the delay in a more sophisticated way to the dialog length or voice-over length,
|
||||||
(waitForInputOrDelay 5
|
// or rely on FlxTypeText to add breathing room
|
||||||
|
(movie.delay .length (text.split " ")
|
||||||
->{
|
->{
|
||||||
(dialogText.kill)
|
(dialogText.kill)
|
||||||
(speakerNameText.kill)
|
(speakerNameText.kill)
|
||||||
|
@@ -10,11 +10,13 @@ enum Appearance {
|
|||||||
typedef Continuation = Void -> Void;
|
typedef Continuation = Void -> Void;
|
||||||
|
|
||||||
interface Director<Set, StagePosition, StageFacing, ScreenPosition, Actor, Sound, Song> {
|
interface Director<Set, StagePosition, StageFacing, ScreenPosition, Actor, Sound, Song> {
|
||||||
|
var movie(default, default):Movie<Set, StagePosition, StageFacing, ScreenPosition, Actor, Sound, Song>;
|
||||||
function showScene(scene:Scene<Set, StagePosition, StageFacing, ScreenPosition, Actor>, appearance:Appearance, cc:Continuation):Void;
|
function showScene(scene:Scene<Set, StagePosition, StageFacing, ScreenPosition, Actor>, appearance:Appearance, cc:Continuation):Void;
|
||||||
function showCharacter(character:Character<StagePosition, StageFacing, Actor>, appearance:Appearance, cc:Continuation):Void;
|
function showCharacter(character:Character<StagePosition, StageFacing, Actor>, appearance:Appearance, cc:Continuation):Void;
|
||||||
function playSound(sound:Sound, volumeMod:Float, waitForEnd:Bool, cc:Continuation):Void;
|
function playSound(sound:Sound, volumeMod:Float, waitForEnd:Bool, cc:Continuation):Void;
|
||||||
function playSong(song:Song, volumeMod:Float, loop:Bool, waitForEnd:Bool, cc:Continuation):Void;
|
function playSong(song:Song, volumeMod:Float, loop:Bool, waitForEnd:Bool, cc:Continuation):Void;
|
||||||
function stopSong():Void;
|
function stopSong():Void;
|
||||||
function waitForInputOrDelay(delaySeconds:Float, cc:Continuation):Void;
|
function startWaitForInput(cc:Continuation):Void;
|
||||||
|
function stopWaitForInput():Void;
|
||||||
function showDialog(speakerName:String, type:SpeechType<StagePosition, StageFacing, Actor>, wryly:String, dialog:String, cc:Continuation):Void;
|
function showDialog(speakerName:String, type:SpeechType<StagePosition, StageFacing, Actor>, wryly:String, dialog:String, cc:Continuation):Void;
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +1,18 @@
|
|||||||
package hollywoo;
|
package hollywoo;
|
||||||
|
|
||||||
import haxe.Constraints.Function;
|
import haxe.Constraints.Function;
|
||||||
|
import haxe.Timer;
|
||||||
import kiss.AsyncEmbeddedScript;
|
import kiss.AsyncEmbeddedScript;
|
||||||
import kiss.Prelude;
|
import kiss.Prelude;
|
||||||
import hollywoo.Scene;
|
import hollywoo.Scene;
|
||||||
import hollywoo.Director;
|
import hollywoo.Director;
|
||||||
|
|
||||||
|
enum DelayHandling {
|
||||||
|
Auto;
|
||||||
|
AutoWithSkip;
|
||||||
|
Manual;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model/controller of a Hollywoo film, and main execution script
|
* Model/controller of a Hollywoo film, and main execution script
|
||||||
*/
|
*/
|
||||||
|
@@ -4,6 +4,8 @@
|
|||||||
(prop :Map<String,Sound> sounds (new Map))
|
(prop :Map<String,Sound> sounds (new Map))
|
||||||
(prop :Map<String,Song> songs (new Map))
|
(prop :Map<String,Song> songs (new Map))
|
||||||
|
|
||||||
|
(prop &mut :DelayHandling delayHandling AutoWithSkip)
|
||||||
|
|
||||||
// TODO for some reason this won't work when declared in Kiss syntax:
|
// TODO for some reason this won't work when declared in Kiss syntax:
|
||||||
// Mutable representation of frames in time:
|
// Mutable representation of frames in time:
|
||||||
// var scenes:Map<String, Scene<Set, StagePosition, StageFacing, ScreenPosition, Actor>> = [];
|
// var scenes:Map<String, Scene<Set, StagePosition, StageFacing, ScreenPosition, Actor>> = [];
|
||||||
@@ -30,8 +32,29 @@
|
|||||||
&prop :Director<Set,StagePosition,StageFacing,ScreenPosition,Actor,Sound,Song> director
|
&prop :Director<Set,StagePosition,StageFacing,ScreenPosition,Actor,Sound,Song> director
|
||||||
]
|
]
|
||||||
|
|
||||||
|
(set director.movie this)
|
||||||
|
|
||||||
(super))
|
(super))
|
||||||
|
|
||||||
|
(method :Void delay [sec :Continuation cc]
|
||||||
|
(case delayHandling
|
||||||
|
(Auto
|
||||||
|
(Timer.delay cc (* 1000 sec)))
|
||||||
|
(AutoWithSkip
|
||||||
|
(director.startWaitForInput cc)
|
||||||
|
(Timer.delay
|
||||||
|
->{
|
||||||
|
(director.stopWaitForInput)
|
||||||
|
(cc)
|
||||||
|
}
|
||||||
|
(* 1000 sec)))
|
||||||
|
(Manual
|
||||||
|
(director.startWaitForInput
|
||||||
|
->{
|
||||||
|
(director.stopWaitForInput)
|
||||||
|
(cc)
|
||||||
|
}))))
|
||||||
|
|
||||||
(method newSet [name :Set set]
|
(method newSet [name :Set set]
|
||||||
(assert isLoading)
|
(assert isLoading)
|
||||||
(dictSet sets name set))
|
(dictSet sets name set))
|
||||||
|
Reference in New Issue
Block a user