load hollywoo assets BEFORE starting
This commit is contained in:
@@ -42,13 +42,13 @@ class AsyncEmbeddedScript {
|
||||
|
||||
#if macro
|
||||
public static function build(dslHaxelib:String, dslFile:String, scriptFile:String):Array<Field> {
|
||||
//trace('AsyncEmbeddedScript.build $dslHaxelib $dslFile $scriptFile');
|
||||
var k = Kiss.defaultKissState();
|
||||
|
||||
var classPath = Context.getPosInfos(Context.currentPos()).file;
|
||||
var loadingDirectory = Path.directory(classPath);
|
||||
var classFields = []; // Kiss.build() will already include Context.getBuildFields()
|
||||
|
||||
|
||||
var commandList:Array<Expr> = [];
|
||||
|
||||
if (dslHaxelib.length > 0) {
|
||||
@@ -74,10 +74,6 @@ class AsyncEmbeddedScript {
|
||||
return;
|
||||
});
|
||||
|
||||
for (command in commandList) {
|
||||
Sys.println(command.toString());
|
||||
}
|
||||
|
||||
classFields = classFields.concat(k.fieldList);
|
||||
|
||||
classFields.push({
|
||||
|
@@ -0,0 +1 @@
|
||||
(loadFrom "hollywoo" "src/hollywoo/HollywooDSL.kiss")
|
@@ -1 +1,8 @@
|
||||
(defNew [director] (super director))
|
||||
(collectBlocks preload (cc))
|
||||
|
||||
(defMacro end []
|
||||
`(method doPreload [:Void->Void cc]
|
||||
(set isLoading true)
|
||||
(collectedBlocks preload)
|
||||
(set isLoading false)
|
||||
(cc)))
|
@@ -1,12 +1,17 @@
|
||||
// Mostly immutable, reusable resources:
|
||||
(prop :Map<String,Set> sets (new Map))
|
||||
(prop :Map<String,Actor> actors (new Map))
|
||||
(prop :Map<String,Sound> sounds (new Map))
|
||||
|
||||
// TODO for some reason this won't work when declared in Kiss syntax:
|
||||
// Mutable representation of frames in time:
|
||||
// var scenes:Map<String, Scene<Set, StagePosition, StageFacing, ScreenPosition, Actor>> = [];
|
||||
(prop :Map<String,Bool> shownScenes (new Map))
|
||||
(prop :Map<String,Bool> shownCharacters (new Map))
|
||||
|
||||
// This is set and unset by doPreload defined in HollywooDSL.kiss
|
||||
(prop &mut isLoading false)
|
||||
|
||||
(function :Appearance appearanceFlag [:Map<String,Bool> map :String key]
|
||||
(if (dictGet map key)
|
||||
ReAppearance
|
||||
@@ -21,16 +26,17 @@
|
||||
(defNew
|
||||
[
|
||||
// "View" in the Model-View-Controller architecture:
|
||||
&prop :Director<Set,StagePosition,StageFacing,ScreenPosition,Actor> director
|
||||
&prop :Director<Set,StagePosition,StageFacing,ScreenPosition,Actor,Sound> director
|
||||
]
|
||||
|
||||
(super))
|
||||
|
||||
(method newSet [name :Set set :Continuation cc]
|
||||
(dictSet sets name set)
|
||||
(cc))
|
||||
(method newSet [name :Set set]
|
||||
(assert isLoading)
|
||||
(dictSet sets name set))
|
||||
|
||||
(method newSceneFromSet [name :String setKey :SceneTime time :ScenePerspective perspective :Continuation cc]
|
||||
(method newSceneFromSet [name :String setKey :SceneTime time :ScenePerspective perspective]
|
||||
(assert isLoading)
|
||||
(dictSet scenes name (objectWith
|
||||
[
|
||||
set
|
||||
@@ -39,12 +45,11 @@
|
||||
(new Map)
|
||||
]
|
||||
time
|
||||
perspective))
|
||||
(cc))
|
||||
perspective)))
|
||||
|
||||
(method newScene [name :Scene<Set,StagePosition,StageFacing,ScreenPosition,Actor> scene :Continuation cc]
|
||||
(dictSet scenes name scene)
|
||||
(cc))
|
||||
(method newScene [name :Scene<Set,StagePosition,StageFacing,ScreenPosition,Actor> scene]
|
||||
(assert isLoading)
|
||||
(dictSet scenes name scene))
|
||||
|
||||
(method setScene [name :Continuation cc]
|
||||
(set sceneKey name)
|
||||
@@ -53,9 +58,18 @@
|
||||
(appearanceFlag shownScenes name)
|
||||
cc))
|
||||
|
||||
(method newActor [name :Actor actor :Continuation cc]
|
||||
(dictSet actors name actor)
|
||||
(cc))
|
||||
(method newSound [name :Sound s]
|
||||
(assert isLoading)
|
||||
(dictSet sounds name s))
|
||||
|
||||
(method playSound [name :Continuation cc &opt :Float volumeMod]
|
||||
(set volumeMod (or volumeMod 1))
|
||||
(assert (<= 0 volumeMod 1))
|
||||
(director.playSound (dictGet sounds name) volumeMod cc))
|
||||
|
||||
(method newActor [name :Actor actor]
|
||||
(assert isLoading)
|
||||
(dictSet actors name actor))
|
||||
|
||||
(method addCharacter [actorName :StagePosition position :StageFacing facing :Continuation cc]
|
||||
(let [character (object stagePosition position stageFacing facing actor (dictGet actors actorName))]
|
||||
@@ -75,6 +89,8 @@
|
||||
// TODO moveCharacter remove them, add them to another scene
|
||||
// TODO moveCharacterAndFollow remove them, add them to another scene, set that the scene
|
||||
|
||||
// Dialogue:
|
||||
|
||||
(method normalSpeech [actorName wryly text cc]
|
||||
(director.showDialog actorName (OnScreen (dictGet .characters (_currentScene) actorName)) wryly text cc))
|
||||
|
||||
|
Reference in New Issue
Block a user