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> {
|
class FlxMovie extends Movie<FlxSprite, ActorFlxSprite, FlxSound, String, FlxSprite, FlxSound, FlxCamera, FlxLightSource> {
|
||||||
// Think of HollywooFlixelDSL.kiss as the corresponding Kiss file for this class!
|
// 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) {
|
public function new(director:FlxDirector, lightSourceJsonFile:String, positionsJson:String, delayLengthsJson:String, voiceLineMatchesJson:String) {
|
||||||
var voiceLinesJson = null;
|
super(director, lightSourceJsonFile, new FlxLightSource([], FlxColor.TRANSPARENT), positionsJson, delayLengthsJson, voiceLineMatchesJson);
|
||||||
if (voiceLinesAssetPath != null) {
|
|
||||||
voiceLinesJson = Assets.getText(voiceLinesAssetPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
super(director, lightSourceJsonFile, new FlxLightSource([], FlxColor.TRANSPARENT), positionsJson, delayLengthsJson, voiceLinesJson);
|
|
||||||
}
|
}
|
||||||
public var uiCamera:FlxCamera;
|
public var uiCamera:FlxCamera;
|
||||||
public var screenCamera:FlxCamera;
|
public var screenCamera:FlxCamera;
|
||||||
|
@@ -14,6 +14,7 @@ import uuid.Uuid;
|
|||||||
import haxe.ds.Option;
|
import haxe.ds.Option;
|
||||||
import kiss_tools.JsonMap;
|
import kiss_tools.JsonMap;
|
||||||
import kiss_tools.JsonableArray;
|
import kiss_tools.JsonableArray;
|
||||||
|
import kiss_tools.JsonableString;
|
||||||
import kiss_tools.TimerWithPause;
|
import kiss_tools.TimerWithPause;
|
||||||
|
|
||||||
using kiss.FuzzyMapTools;
|
using kiss.FuzzyMapTools;
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
(prop :FuzzyMap<Song> songs (new FuzzyMap<Song>))
|
(prop :FuzzyMap<Song> songs (new FuzzyMap<Song>))
|
||||||
(prop :FuzzyMap<Prop> props (new FuzzyMap<Prop>))
|
(prop :FuzzyMap<Prop> props (new FuzzyMap<Prop>))
|
||||||
(prop :Map<String,VoiceTrack> voiceTracks (new Map))
|
(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
|
// Used to give unique, persistent IDs to voice tracks
|
||||||
(prop :Map<String,Int> voiceTracksPerActor (new Map))
|
(prop :Map<String,Int> voiceTracksPerActor (new Map))
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
// When an actorName is given, check for a voiced line to play.
|
// When an actorName is given, check for a voiced line to play.
|
||||||
// Otherwise, assume it is un-voiced super text
|
// Otherwise, assume it is un-voiced super text
|
||||||
(when (and actorName (< 0 (count voiceTracks)))
|
(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)
|
((objectWith trackKey start end alts)
|
||||||
(case (dictGet altIdx "$actorName $text")
|
(case (dictGet altIdx "$actorName $text")
|
||||||
(null
|
(null
|
||||||
@@ -88,7 +88,9 @@
|
|||||||
(if line.alts
|
(if line.alts
|
||||||
(for alt (the Array<Dynamic> line.alts) (objectWith [start alt.start end alt.end] trackKey))
|
(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]
|
(method _ccForEach <>[T] [:Iterable<T> collection :(T,Continuation)->Void do_ :Continuation finalCC]
|
||||||
(let [:Iterator<T> iter (collection.iterator)]
|
(let [:Iterator<T> iter (collection.iterator)]
|
||||||
@@ -175,7 +177,7 @@
|
|||||||
:LightSource defaultLightSource
|
:LightSource defaultLightSource
|
||||||
:String stagePositionsJson
|
:String stagePositionsJson
|
||||||
:String delayLengthsJson
|
:String delayLengthsJson
|
||||||
&opt :String voiceLinesJson
|
:String voiceLineMatchesJson
|
||||||
]
|
]
|
||||||
[
|
[
|
||||||
:JsonMap<StagePosition> stagePositions
|
:JsonMap<StagePosition> stagePositions
|
||||||
@@ -184,12 +186,11 @@
|
|||||||
(new JsonMap lightSourceJsonFile (new JsonableArray [] defaultLightSource))
|
(new JsonMap lightSourceJsonFile (new JsonableArray [] defaultLightSource))
|
||||||
:JsonMap<DelayLength> delayLengths
|
:JsonMap<DelayLength> delayLengths
|
||||||
(new JsonMap delayLengthsJson (new DelayLength 0.5))
|
(new JsonMap delayLengthsJson (new DelayLength 0.5))
|
||||||
|
:JsonStringMap voiceLineMatches
|
||||||
|
(new JsonMap voiceLineMatchesJson (new JsonableString ""))
|
||||||
]
|
]
|
||||||
|
|
||||||
(set director.movie this)
|
(set director.movie this)
|
||||||
(voiceLines.serializeMatches "matchedVoiceLines.json")
|
|
||||||
(when voiceLinesJson
|
|
||||||
(voiceLines.loadMatches voiceLinesJson))
|
|
||||||
|
|
||||||
(let [shortcutHandler (director.shortcutHandler)
|
(let [shortcutHandler (director.shortcutHandler)
|
||||||
cc ->(resume)]
|
cc ->(resume)]
|
||||||
|
@@ -16,5 +16,7 @@ typedef Jsonable<T> = {
|
|||||||
function parse(s:String):T;
|
function parse(s:String):T;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef JsonStringMap = JsonMap<JsonableString>;
|
||||||
|
|
||||||
@:build(kiss.Kiss.build())
|
@:build(kiss.Kiss.build())
|
||||||
class JsonMap<T:Jsonable<T>> {}
|
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