Separate FuzzyMaps for each actor. Close #110
This commit is contained in:
@@ -19,13 +19,8 @@ import flixel.tweens.FlxTween;
|
||||
class FlxMovie extends Movie<FlxSprite, ActorFlxSprite, FlxSound, String, FlxSprite, FlxSound, FlxCamera, FlxLightSource> {
|
||||
// Think of HollywooFlixelDSL.kiss as the corresponding Kiss file for this class!
|
||||
|
||||
public function new(director:FlxDirector, lightSourceJsonFile:String, positionsJson:String, delayLengthsJson:String, ?voiceLinesAssetPath:String) {
|
||||
var voiceLinesJson = null;
|
||||
if (voiceLinesAssetPath != null) {
|
||||
voiceLinesJson = Assets.getText(voiceLinesAssetPath);
|
||||
}
|
||||
|
||||
super(director, lightSourceJsonFile, new FlxLightSource([], FlxColor.TRANSPARENT), positionsJson, delayLengthsJson, voiceLinesJson);
|
||||
public function new(director:FlxDirector, lightSourceJsonFile:String, positionsJson:String, delayLengthsJson:String, voiceLineMatchesJson:String) {
|
||||
super(director, lightSourceJsonFile, new FlxLightSource([], FlxColor.TRANSPARENT), positionsJson, delayLengthsJson, voiceLineMatchesJson);
|
||||
}
|
||||
public var uiCamera:FlxCamera;
|
||||
public var screenCamera:FlxCamera;
|
||||
|
@@ -14,6 +14,7 @@ import uuid.Uuid;
|
||||
import haxe.ds.Option;
|
||||
import kiss_tools.JsonMap;
|
||||
import kiss_tools.JsonableArray;
|
||||
import kiss_tools.JsonableString;
|
||||
import kiss_tools.TimerWithPause;
|
||||
|
||||
using kiss.FuzzyMapTools;
|
||||
|
@@ -11,7 +11,7 @@
|
||||
(prop :FuzzyMap<Song> songs (new FuzzyMap<Song>))
|
||||
(prop :FuzzyMap<Prop> props (new FuzzyMap<Prop>))
|
||||
(prop :Map<String,VoiceTrack> voiceTracks (new Map))
|
||||
(prop :FuzzyMap<VoiceLine> voiceLines (new FuzzyMap<VoiceLine>))
|
||||
(prop :FuzzyMap<FuzzyMap<VoiceLine>> voiceLines (new FuzzyMap<FuzzyMap<VoiceLine>>))
|
||||
// Used to give unique, persistent IDs to voice tracks
|
||||
(prop :Map<String,Int> voiceTracksPerActor (new Map))
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
// When an actorName is given, check for a voiced line to play.
|
||||
// Otherwise, assume it is un-voiced super text
|
||||
(when (and actorName (< 0 (count voiceTracks)))
|
||||
(case (try (dictGet voiceLines "$actorName $text") (catch [e] (print e) null))
|
||||
(case (try (dictGet (dictGet voiceLines actorName) text) (catch [e] (print e) null))
|
||||
((objectWith trackKey start end alts)
|
||||
(case (dictGet altIdx "$actorName $text")
|
||||
(null
|
||||
@@ -88,7 +88,9 @@
|
||||
(if line.alts
|
||||
(for alt (the Array<Dynamic> line.alts) (objectWith [start alt.start end alt.end] trackKey))
|
||||
[])]
|
||||
(dictSet voiceLines "$actorName $key" (objectWith [start line.start end line.end] trackKey alts))))))
|
||||
(unless (voiceLines.exists actorName)
|
||||
(dictSet voiceLines actorName (new FuzzyMap<VoiceLine>)))
|
||||
(dictSet (dictGet voiceLines actorName) key (objectWith [start line.start end line.end] trackKey alts))))))
|
||||
|
||||
(method _ccForEach <>[T] [:Iterable<T> collection :(T,Continuation)->Void do_ :Continuation finalCC]
|
||||
(let [:Iterator<T> iter (collection.iterator)]
|
||||
@@ -175,7 +177,7 @@
|
||||
:LightSource defaultLightSource
|
||||
:String stagePositionsJson
|
||||
:String delayLengthsJson
|
||||
&opt :String voiceLinesJson
|
||||
:String voiceLineMatchesJson
|
||||
]
|
||||
[
|
||||
:JsonMap<StagePosition> stagePositions
|
||||
@@ -184,12 +186,11 @@
|
||||
(new JsonMap lightSourceJsonFile (new JsonableArray [] defaultLightSource))
|
||||
:JsonMap<DelayLength> delayLengths
|
||||
(new JsonMap delayLengthsJson (new DelayLength 0.5))
|
||||
:JsonStringMap voiceLineMatches
|
||||
(new JsonMap voiceLineMatchesJson (new JsonableString ""))
|
||||
]
|
||||
|
||||
(set director.movie this)
|
||||
(voiceLines.serializeMatches "matchedVoiceLines.json")
|
||||
(when voiceLinesJson
|
||||
(voiceLines.loadMatches voiceLinesJson))
|
||||
|
||||
(let [shortcutHandler (director.shortcutHandler)
|
||||
cc ->(resume)]
|
||||
|
@@ -16,5 +16,7 @@ typedef Jsonable<T> = {
|
||||
function parse(s:String):T;
|
||||
}
|
||||
|
||||
typedef JsonStringMap = JsonMap<JsonableString>;
|
||||
|
||||
@:build(kiss.Kiss.build())
|
||||
class JsonMap<T:Jsonable<T>> {}
|
||||
|
8
projects/kiss-tools/src/kiss_tools/JsonableString.hx
Normal file
8
projects/kiss-tools/src/kiss_tools/JsonableString.hx
Normal file
@@ -0,0 +1,8 @@
|
||||
package kiss_tools;
|
||||
|
||||
import kiss.Prelude;
|
||||
import kiss.List;
|
||||
import haxe.Json;
|
||||
|
||||
@:build(kiss.Kiss.build())
|
||||
class JsonableString {}
|
7
projects/kiss-tools/src/kiss_tools/JsonableString.kiss
Normal file
7
projects/kiss-tools/src/kiss_tools/JsonableString.kiss
Normal file
@@ -0,0 +1,7 @@
|
||||
(defNew [&prop :String value])
|
||||
|
||||
(method parse [:String representation]
|
||||
(new JsonableString (Json.parse representation)))
|
||||
|
||||
(method stringify []
|
||||
(Json.stringify value))
|
Reference in New Issue
Block a user