121 lines
1.9 KiB
Haxe
121 lines
1.9 KiB
Haxe
package;
|
|
|
|
|
|
import haxe.io.Bytes;
|
|
import lime.utils.AssetBundle;
|
|
import lime.utils.AssetLibrary;
|
|
import lime.utils.AssetManifest;
|
|
import lime.utils.Assets;
|
|
|
|
#if sys
|
|
import sys.FileSystem;
|
|
#end
|
|
|
|
@:access(lime.utils.Assets)
|
|
|
|
|
|
@:keep @:dox(hide) class ManifestResources {
|
|
|
|
|
|
public static var preloadLibraries:Array<AssetLibrary>;
|
|
public static var preloadLibraryNames:Array<String>;
|
|
public static var rootPath:String;
|
|
|
|
|
|
public static function init (config:Dynamic):Void {
|
|
|
|
preloadLibraries = new Array ();
|
|
preloadLibraryNames = new Array ();
|
|
|
|
rootPath = null;
|
|
|
|
if (config != null && Reflect.hasField (config, "rootPath")) {
|
|
|
|
rootPath = Reflect.field (config, "rootPath");
|
|
|
|
}
|
|
|
|
if (rootPath == null) {
|
|
|
|
#if (ios || tvos || emscripten)
|
|
rootPath = "assets/";
|
|
#elseif android
|
|
rootPath = "";
|
|
#elseif console
|
|
rootPath = lime.system.System.applicationDirectory;
|
|
#else
|
|
rootPath = "./";
|
|
#end
|
|
|
|
}
|
|
|
|
#if (openfl && !flash && !display)
|
|
|
|
#end
|
|
|
|
var data, manifest, library, bundle;
|
|
|
|
#if kha
|
|
|
|
null
|
|
library = AssetLibrary.fromManifest (manifest);
|
|
Assets.registerLibrary ("null", library);
|
|
|
|
if (library != null) preloadLibraries.push (library);
|
|
else preloadLibraryNames.push ("null");
|
|
|
|
#else
|
|
|
|
Assets.libraryPaths["default"] = rootPath + "manifest/default.json";
|
|
|
|
|
|
library = Assets.getLibrary ("default");
|
|
if (library != null) preloadLibraries.push (library);
|
|
else preloadLibraryNames.push ("default");
|
|
|
|
|
|
#end
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#if kha
|
|
|
|
null
|
|
|
|
#else
|
|
|
|
#if !display
|
|
#if flash
|
|
|
|
@:keep @:bind @:noCompletion #if display private #end class __ASSET__sprites_character_png extends flash.display.BitmapData { public function new () { super (0, 0, true, 0); } }
|
|
@:keep @:bind @:noCompletion #if display private #end class __ASSET__manifest_default_json extends null { }
|
|
|
|
|
|
#elseif (desktop || cpp)
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#end
|
|
|
|
#if (openfl && !flash)
|
|
|
|
#if html5
|
|
|
|
#else
|
|
|
|
#end
|
|
|
|
#end
|
|
#end
|
|
|
|
#end
|