WIP checkpoint: Implement avatar loader and customization UI in Godot
This commit is contained in:
@@ -41,12 +41,14 @@ func load_catalog(path: String = _catalog_path) -> Error:
|
|||||||
var json_text: String = file.get_as_text()
|
var json_text: String = file.get_as_text()
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
var json: JSONParseResult = JSON.parse_string(json_text)
|
var result: Variant = JSON.parse_string(json_text)
|
||||||
if json == null:
|
if result == null or not result is Dictionary:
|
||||||
catalog_load_failed.emit("Invalid JSON in catalog: %s" % path)
|
catalog_load_failed.emit("Invalid JSON in catalog: %s" % path)
|
||||||
return ERR_PARSE_ERROR
|
return ERR_PARSE_ERROR
|
||||||
|
|
||||||
if not json is Dictionary or not json.has("assets"):
|
var json: Dictionary = result as Dictionary
|
||||||
|
|
||||||
|
if not json.has("assets"):
|
||||||
catalog_load_failed.emit("Catalog missing 'assets' key")
|
catalog_load_failed.emit("Catalog missing 'assets' key")
|
||||||
return ERR_INVALID_DATA
|
return ERR_INVALID_DATA
|
||||||
|
|
||||||
@@ -56,6 +58,11 @@ func load_catalog(path: String = _catalog_path) -> Error:
|
|||||||
return OK
|
return OK
|
||||||
|
|
||||||
|
|
||||||
|
## Check if the catalog has been loaded.
|
||||||
|
func is_loaded() -> bool:
|
||||||
|
return _loaded
|
||||||
|
|
||||||
|
|
||||||
## Resolve an asset by its ID.
|
## Resolve an asset by its ID.
|
||||||
## Returns a Dictionary with keys: type, slot, path, version, etc.
|
## Returns a Dictionary with keys: type, slot, path, version, etc.
|
||||||
## Returns null if the asset ID is not found.
|
## Returns null if the asset ID is not found.
|
||||||
|
|||||||
Reference in New Issue
Block a user