First commit
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
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
|
||||
|
||||
data = '{"name":null,"assets":"aoy4:pathy23:sprites%2Fcharacter.pngy4:sizei161y4:typey5:IMAGEy2:idR1y7:preloadtgh","rootPath":null,"version":2,"libraryArgs":[],"libraryType":null}';
|
||||
manifest = AssetManifest.parse (data, rootPath);
|
||||
library = AssetLibrary.fromManifest (manifest);
|
||||
Assets.registerLibrary ("default", library);
|
||||
|
||||
|
||||
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)
|
||||
|
||||
@:keep @:image("res/sprites/character.png") @:noCompletion #if display private #end class __ASSET__sprites_character_png extends lime.graphics.Image {}
|
||||
@:keep @:file("") @:noCompletion #if display private #end class __ASSET__manifest_default_json extends haxe.io.Bytes {}
|
||||
|
||||
|
||||
|
||||
#else
|
||||
|
||||
|
||||
|
||||
#end
|
||||
|
||||
#if (openfl && !flash)
|
||||
|
||||
#if html5
|
||||
|
||||
#else
|
||||
|
||||
#end
|
||||
|
||||
#end
|
||||
#end
|
||||
|
||||
#end
|
||||
Reference in New Issue
Block a user