another wip

Co-Authored-By: Ne_Eo <NeeEoo@users.noreply.github.com>
This commit is contained in:
⍚~Nex
2024-04-10 00:08:52 +02:00
co-authored by Ne_Eo
parent e068300cf1
commit 5231b2f7fa
2 changed files with 29 additions and 1 deletions
@@ -4,4 +4,25 @@ enum abstract AssetSource(Null<Bool>) from Bool from Null<Bool> to Null<Bool> {
var SOURCE = true;
var MODS = false;
var BOTH = null;
@:from public static function fromString(string:String):AssetSource
{
return switch (string.trim().toLowerCase())
{
case "source": SOURCE;
case "mods": MODS;
case "both": BOTH;
default: MODS;
}
}
@:to public inline function toString():String
{
return switch (this)
{
case SOURCE: "source";
case MODS: "mods";
case BOTH: "both";
}
}
}
@@ -26,8 +26,10 @@ class AssetsLibraryList extends AssetLibrary {
return true;
for(k=>e in libraries) {
if (shouldSkipLib(e, source)) continue;
if (e.exists(id, type))
if (e.exists(id, type)) {
trace('$k $e ${e.tag.toString()} $id exists');
return true;
}
}
return false;
}
@@ -114,6 +116,11 @@ class AssetsLibraryList extends AssetLibrary {
if (e.exists(id, e.types.get(id))) {
var asset = e.getAsset(id, type);
if (asset != null) {
if(asset.length > 512) {
trace('$k $e ${e.tag.toString()} $id asset of length ${asset.length}');
} else {
trace('$k $e ${e.tag.toString()} $id returned asset $asset');
}
return asset;
}
}