Make delayLengths a JsonMap
This commit is contained in:
7
src/hollywoo/DelayLength.hx
Normal file
7
src/hollywoo/DelayLength.hx
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package hollywoo;
|
||||||
|
|
||||||
|
import kiss.Prelude;
|
||||||
|
import kiss.List;
|
||||||
|
|
||||||
|
@:build(kiss.Kiss.build())
|
||||||
|
class DelayLength {}
|
4
src/hollywoo/DelayLength.kiss
Normal file
4
src/hollywoo/DelayLength.kiss
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
(defNew [&prop :Float length])
|
||||||
|
|
||||||
|
(method stringify [] "$length")
|
||||||
|
(method parse [:String data] (new DelayLength (Std.parseFloat data)))
|
@@ -155,6 +155,7 @@
|
|||||||
:String lightSourceJsonFile
|
:String lightSourceJsonFile
|
||||||
:LightSource defaultLightSource
|
:LightSource defaultLightSource
|
||||||
:String stagePositionsJson
|
:String stagePositionsJson
|
||||||
|
:String delayLengthsJson
|
||||||
&opt :String voiceLinesJson
|
&opt :String voiceLinesJson
|
||||||
]
|
]
|
||||||
[
|
[
|
||||||
@@ -162,6 +163,8 @@
|
|||||||
(new JsonMap stagePositionsJson (new StagePosition 0 0 0))
|
(new JsonMap stagePositionsJson (new StagePosition 0 0 0))
|
||||||
:JsonMap<JsonableArray<LightSource>> lightSources
|
:JsonMap<JsonableArray<LightSource>> lightSources
|
||||||
(new JsonMap lightSourceJsonFile (new JsonableArray [] defaultLightSource))
|
(new JsonMap lightSourceJsonFile (new JsonableArray [] defaultLightSource))
|
||||||
|
:JsonMap<DelayLength> delayLengths
|
||||||
|
(new JsonMap delayLengthsJson (new DelayLength 0.5))
|
||||||
]
|
]
|
||||||
|
|
||||||
(set director.movie this)
|
(set director.movie this)
|
||||||
@@ -203,7 +206,11 @@
|
|||||||
(#unless subclass (method ,nameAndType ,argList ,@body))
|
(#unless subclass (method ,nameAndType ,argList ,@body))
|
||||||
}))
|
}))
|
||||||
|
|
||||||
(hollywooMethod :Void delay true [sec :Continuation cc]
|
(hollywooMethod :Void delay true [:Dynamic length :Continuation cc]
|
||||||
|
(let [sec (typeCase [length]
|
||||||
|
([:Float sec] sec)
|
||||||
|
([:String key] .length (delayLengths.get key))
|
||||||
|
(never otherwise))]
|
||||||
(case delayHandling
|
(case delayHandling
|
||||||
(Auto
|
(Auto
|
||||||
(Timer.delay cc (* 1000 sec)))
|
(Timer.delay cc (* 1000 sec)))
|
||||||
@@ -227,7 +234,7 @@
|
|||||||
(director.stopWaitForInput cc)
|
(director.stopWaitForInput cc)
|
||||||
(cc)
|
(cc)
|
||||||
}))
|
}))
|
||||||
(otherwise (throw "Unsupported delay type $delayHandling"))))
|
(otherwise (throw "Unsupported delay type $delayHandling")))))
|
||||||
|
|
||||||
(hollywooMethod newSet true [name :Set set]
|
(hollywooMethod newSet true [name :Set set]
|
||||||
(assert isLoading)
|
(assert isLoading)
|
||||||
|
Reference in New Issue
Block a user