add lightSources jsonMap to Movie
This commit is contained in:
@@ -4,6 +4,7 @@ import flixel.FlxState;
|
|||||||
import flixel.FlxSprite;
|
import flixel.FlxSprite;
|
||||||
import flixel.system.FlxSound;
|
import flixel.system.FlxSound;
|
||||||
import flixel.FlxCamera;
|
import flixel.FlxCamera;
|
||||||
|
import flixel.util.FlxColor;
|
||||||
import hollywoo.Director;
|
import hollywoo.Director;
|
||||||
import hollywoo.Movie;
|
import hollywoo.Movie;
|
||||||
import hollywoo_flixel.ActorFlxSprite;
|
import hollywoo_flixel.ActorFlxSprite;
|
||||||
@@ -43,13 +44,13 @@ enum FlxScreenPosition {
|
|||||||
class FlxMovie extends Movie<FlxSprite, FlxScreenPosition, ActorFlxSprite, FlxSound, String, FlxSprite, FlxSound, FlxCamera, FlxLightSource> {
|
class FlxMovie extends Movie<FlxSprite, FlxScreenPosition, 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, ?voiceLinesAssetPath:String) {
|
public function new(director:FlxDirector, lightSourceJsonFile:String, ?voiceLinesAssetPath:String, ?positionsJson:String) {
|
||||||
var voiceLinesJson = null;
|
var voiceLinesJson = null;
|
||||||
if (voiceLinesAssetPath != null) {
|
if (voiceLinesAssetPath != null) {
|
||||||
voiceLinesJson = Assets.getText(voiceLinesAssetPath);
|
voiceLinesJson = Assets.getText(voiceLinesAssetPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
super(director, voiceLinesJson);
|
super(director, lightSourceJsonFile, new FlxLightSource([], FlxColor.TRANSPARENT), voiceLinesJson, positionsJson);
|
||||||
}
|
}
|
||||||
public var uiCamera:FlxCamera;
|
public var uiCamera:FlxCamera;
|
||||||
public var screenCamera:FlxCamera;
|
public var screenCamera:FlxCamera;
|
||||||
|
|||||||
@@ -142,6 +142,8 @@
|
|||||||
[
|
[
|
||||||
// "View" in the Model-View-Controller architecture:
|
// "View" in the Model-View-Controller architecture:
|
||||||
&prop :Director<Set,ScreenPosition,Actor,Sound,Song,Prop,VoiceTrack,Camera,LightSource> director
|
&prop :Director<Set,ScreenPosition,Actor,Sound,Song,Prop,VoiceTrack,Camera,LightSource> director
|
||||||
|
:String lightSourceJsonFile
|
||||||
|
:LightSource defaultLightSource
|
||||||
&opt :String voiceLinesJson
|
&opt :String voiceLinesJson
|
||||||
&opt :String positionsJson
|
&opt :String positionsJson
|
||||||
]
|
]
|
||||||
@@ -150,6 +152,7 @@
|
|||||||
(if positionsJson
|
(if positionsJson
|
||||||
(haxe.Json.parse (sys.io.File.getContent positionsJson))
|
(haxe.Json.parse (sys.io.File.getContent positionsJson))
|
||||||
(new Map))
|
(new Map))
|
||||||
|
:JsonMap<JsonableArray<LightSource>> lightSources (new JsonMap lightSourceJsonFile (new JsonableArray [] defaultLightSource))
|
||||||
]
|
]
|
||||||
|
|
||||||
(set director.movie this)
|
(set director.movie this)
|
||||||
@@ -159,6 +162,8 @@
|
|||||||
|
|
||||||
(super)))
|
(super)))
|
||||||
|
|
||||||
|
// END Parent class definitions
|
||||||
|
|
||||||
// Some real magic happens here. This macro defines a method, AND a reader macro
|
// Some real magic happens here. This macro defines a method, AND a reader macro
|
||||||
// for calling it with cc passed automatically if cc is an argument.
|
// for calling it with cc passed automatically if cc is an argument.
|
||||||
// GOTCHA: DO NOT use (method) directly in this file!!
|
// GOTCHA: DO NOT use (method) directly in this file!!
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import haxe.ds.Map;
|
|||||||
import haxe.Json;
|
import haxe.Json;
|
||||||
import haxe.DynamicAccess;
|
import haxe.DynamicAccess;
|
||||||
import sys.io.File;
|
import sys.io.File;
|
||||||
|
import sys.FileSystem;
|
||||||
|
|
||||||
typedef Jsonable<T> = {
|
typedef Jsonable<T> = {
|
||||||
function stringify():String;
|
function stringify():String;
|
||||||
|
|||||||
@@ -12,6 +12,9 @@
|
|||||||
(defNew [&prop :String jsonPath &prop :T defaultVal]
|
(defNew [&prop :String jsonPath &prop :T defaultVal]
|
||||||
[:Map<String,T> m (new Map)]
|
[:Map<String,T> m (new Map)]
|
||||||
|
|
||||||
|
(unless (FileSystem.exists jsonPath)
|
||||||
|
(File.saveContent jsonPath "{}"))
|
||||||
|
|
||||||
(_parseFrom (File.getContent jsonPath)))
|
(_parseFrom (File.getContent jsonPath)))
|
||||||
|
|
||||||
(method put [:String key :T value]
|
(method put [:String key :T value]
|
||||||
|
|||||||
Reference in New Issue
Block a user