load hollywoo assets BEFORE starting
This commit is contained in:
@@ -42,13 +42,13 @@ class AsyncEmbeddedScript {
|
|||||||
|
|
||||||
#if macro
|
#if macro
|
||||||
public static function build(dslHaxelib:String, dslFile:String, scriptFile:String):Array<Field> {
|
public static function build(dslHaxelib:String, dslFile:String, scriptFile:String):Array<Field> {
|
||||||
|
//trace('AsyncEmbeddedScript.build $dslHaxelib $dslFile $scriptFile');
|
||||||
var k = Kiss.defaultKissState();
|
var k = Kiss.defaultKissState();
|
||||||
|
|
||||||
var classPath = Context.getPosInfos(Context.currentPos()).file;
|
var classPath = Context.getPosInfos(Context.currentPos()).file;
|
||||||
var loadingDirectory = Path.directory(classPath);
|
var loadingDirectory = Path.directory(classPath);
|
||||||
var classFields = []; // Kiss.build() will already include Context.getBuildFields()
|
var classFields = []; // Kiss.build() will already include Context.getBuildFields()
|
||||||
|
|
||||||
|
|
||||||
var commandList:Array<Expr> = [];
|
var commandList:Array<Expr> = [];
|
||||||
|
|
||||||
if (dslHaxelib.length > 0) {
|
if (dslHaxelib.length > 0) {
|
||||||
@@ -74,10 +74,6 @@ class AsyncEmbeddedScript {
|
|||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
|
|
||||||
for (command in commandList) {
|
|
||||||
Sys.println(command.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
classFields = classFields.concat(k.fieldList);
|
classFields = classFields.concat(k.fieldList);
|
||||||
|
|
||||||
classFields.push({
|
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:
|
// Mostly immutable, reusable resources:
|
||||||
(prop :Map<String,Set> sets (new Map))
|
(prop :Map<String,Set> sets (new Map))
|
||||||
(prop :Map<String,Actor> actors (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:
|
// 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>> = [];
|
||||||
(prop :Map<String,Bool> shownScenes (new Map))
|
(prop :Map<String,Bool> shownScenes (new Map))
|
||||||
(prop :Map<String,Bool> shownCharacters (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]
|
(function :Appearance appearanceFlag [:Map<String,Bool> map :String key]
|
||||||
(if (dictGet map key)
|
(if (dictGet map key)
|
||||||
ReAppearance
|
ReAppearance
|
||||||
@@ -21,16 +26,17 @@
|
|||||||
(defNew
|
(defNew
|
||||||
[
|
[
|
||||||
// "View" in the Model-View-Controller architecture:
|
// "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))
|
(super))
|
||||||
|
|
||||||
(method newSet [name :Set set :Continuation cc]
|
(method newSet [name :Set set]
|
||||||
(dictSet sets name set)
|
(assert isLoading)
|
||||||
(cc))
|
(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
|
(dictSet scenes name (objectWith
|
||||||
[
|
[
|
||||||
set
|
set
|
||||||
@@ -39,12 +45,11 @@
|
|||||||
(new Map)
|
(new Map)
|
||||||
]
|
]
|
||||||
time
|
time
|
||||||
perspective))
|
perspective)))
|
||||||
(cc))
|
|
||||||
|
|
||||||
(method newScene [name :Scene<Set,StagePosition,StageFacing,ScreenPosition,Actor> scene :Continuation cc]
|
(method newScene [name :Scene<Set,StagePosition,StageFacing,ScreenPosition,Actor> scene]
|
||||||
(dictSet scenes name scene)
|
(assert isLoading)
|
||||||
(cc))
|
(dictSet scenes name scene))
|
||||||
|
|
||||||
(method setScene [name :Continuation cc]
|
(method setScene [name :Continuation cc]
|
||||||
(set sceneKey name)
|
(set sceneKey name)
|
||||||
@@ -53,9 +58,18 @@
|
|||||||
(appearanceFlag shownScenes name)
|
(appearanceFlag shownScenes name)
|
||||||
cc))
|
cc))
|
||||||
|
|
||||||
(method newActor [name :Actor actor :Continuation cc]
|
(method newSound [name :Sound s]
|
||||||
(dictSet actors name actor)
|
(assert isLoading)
|
||||||
(cc))
|
(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]
|
(method addCharacter [actorName :StagePosition position :StageFacing facing :Continuation cc]
|
||||||
(let [character (object stagePosition position stageFacing facing actor (dictGet actors actorName))]
|
(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 moveCharacter remove them, add them to another scene
|
||||||
// TODO moveCharacterAndFollow remove them, add them to another scene, set that the scene
|
// TODO moveCharacterAndFollow remove them, add them to another scene, set that the scene
|
||||||
|
|
||||||
|
// Dialogue:
|
||||||
|
|
||||||
(method normalSpeech [actorName wryly text cc]
|
(method normalSpeech [actorName wryly text cc]
|
||||||
(director.showDialog actorName (OnScreen (dictGet .characters (_currentScene) actorName)) wryly text cc))
|
(director.showDialog actorName (OnScreen (dictGet .characters (_currentScene) actorName)) wryly text cc))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user