Class ResourceData<T>
- java.lang.Object
-
- com.badlogic.gdx.graphics.g3d.particles.ResourceData<T>
-
- All Implemented Interfaces:
Json.Serializable
public class ResourceData<T> extends java.lang.Object implements Json.Serializable
This class handles the assets and configurations required by a given resource when de/serialized. It's handy when a given object or one of its members requires some assets to be loaded to work properly after being deserialized. To save the assets, the object should implement theResourceData.Configurableinterface and obtain aResourceData.SaveDataobject to store every required asset or information which will be used during the loading phase. The passed inAssetManageris generally used to find the asset file name for a given resource of a given type. The class can also store global configurations, this is useful when dealing with objects which should be allocated once (i.e singleton). The deserialization process must happen in the same order of serialization, because the per objectResourceData.SaveDatablocks are stored as anArraywithin theResourceData, while the globalResourceData.SaveDatainstances can be accessed in any order because require a uniqueStringand are stored in anObjectMap.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classResourceData.AssetData<T>This class contains all the information related to a given assetstatic interfaceResourceData.Configurable<T>This interface must be implemented by any class requiring additional assets to be loaded/savedstatic classResourceData.SaveDataContains all the saved data.
-
Constructor Summary
Constructors Constructor Description ResourceData()ResourceData(T resource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResourceData.SaveDatacreateSaveData()Creates and adds a new SaveData object to the save data listResourceData.SaveDatacreateSaveData(java.lang.String key)Creates and adds a new and unique SaveData object to the save data mapArray<AssetDescriptor>getAssetDescriptors()Array<ResourceData.AssetData>getAssets()ResourceData.SaveDatagetSaveData()ResourceData.SaveDatagetSaveData(java.lang.String key)voidread(Json json, JsonValue jsonData)voidwrite(Json json)
-
-
-
Field Detail
-
resource
public T resource
-
-
Constructor Detail
-
ResourceData
public ResourceData()
-
ResourceData
public ResourceData(T resource)
-
-
Method Detail
-
getAssetDescriptors
public Array<AssetDescriptor> getAssetDescriptors()
-
getAssets
public Array<ResourceData.AssetData> getAssets()
-
createSaveData
public ResourceData.SaveData createSaveData()
Creates and adds a new SaveData object to the save data list
-
createSaveData
public ResourceData.SaveData createSaveData(java.lang.String key)
Creates and adds a new and unique SaveData object to the save data map
-
getSaveData
public ResourceData.SaveData getSaveData()
- Returns:
- the next save data in the list
-
getSaveData
public ResourceData.SaveData getSaveData(java.lang.String key)
- Returns:
- the unique save data in the map
-
write
public void write(Json json)
- Specified by:
writein interfaceJson.Serializable
-
read
public void read(Json json, JsonValue jsonData)
- Specified by:
readin interfaceJson.Serializable
-
-