diff --git a/src/hollywoo/Director.hx b/src/hollywoo/Director.hx index 297d2cc..9deca7a 100644 --- a/src/hollywoo/Director.hx +++ b/src/hollywoo/Director.hx @@ -13,4 +13,5 @@ interface Director { function showScene(scene:Scene, appearance:Appearance, cc:Continuation):Void; function showCharacter(character:Character, appearance:Appearance, cc:Continuation):Void; function waitForInputOrDelay(delaySeconds:Float, cc:Continuation):Void; + function showDialog(character:Character, dialog:String, cc:Continuation):Void; } diff --git a/src/hollywoo/Movie.hx b/src/hollywoo/Movie.hx index 2b48382..a5af2a0 100644 --- a/src/hollywoo/Movie.hx +++ b/src/hollywoo/Movie.hx @@ -1,6 +1,8 @@ package hollywoo; import kiss.AsyncEmbeddedScript; +import kiss.Prelude; +import hollywoo.Scene; /** * Model/controller of a Hollywoo film, and main execution script diff --git a/src/hollywoo/Movie.kiss b/src/hollywoo/Movie.kiss index a16e8f0..87a5cf7 100644 --- a/src/hollywoo/Movie.kiss +++ b/src/hollywoo/Movie.kiss @@ -1,6 +1,47 @@ // Mostly immutable, reusable resources: (prop :Map sets (new Map)) (prop :Map actors (new Map)) - -// "View" in the Model-View-Controller architecture: -(defNew [&prop :Director director] (super)) \ No newline at end of file + +// TODO for some reason this won't work when declared in Kiss syntax: +// Mutable representation of frames in time: +// var scenes:Map> = []; +(prop :Map shownScenes (new Map)) + +(defNew + [ + // "View" in the Model-View-Controller architecture: + &prop :Director director + ] + + (super)) + +(method newSet [name :Set set :Continuation cc] + (dictSet sets name set) + (cc)) + +(method newSceneFromSet [name :String setKey :SceneTime time :ScenePerspective perspective :Continuation cc] + (dictSet scenes name (objectWith + [ + set + (dictGet sets setKey) + characters + (new Map) + ] + time + perspective)) + (cc)) + +(method newScene [name :Scene scene :Continuation cc] + (dictSet scenes name scene) + (cc)) + +(method setScene [name :Continuation cc] + (director.showScene + (dictGet scenes name) + (if (dictGet shownScenes name) + ReAppearance + { + (dictSet shownScenes name true) + FirstAppearance + }) + cc)) \ No newline at end of file