APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.badlogic.gdx.graphics.g3d.particles

public Class ResourceData<T>

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
com.badlogic.gdx.utils.Json.Serializable
Imports
com.badlogic.gdx.assets.AssetDescriptor, .AssetManager, com.badlogic.gdx.utils.Array, .GdxRuntimeException, .IntArray, .Json, .JsonValue, .ObjectMap, .ObjectMap.Entry, com.badlogic.gdx.utils.reflect.ClassReflection, .ReflectionException

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 the Configurable interface and obtain a SaveData object to store every required asset or information which will be used during the loading phase. The passed in AssetManager is 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 object SaveData blocks are stored as an Array within the ResourceData , while the global SaveData instances can be accessed in any order because require a unique String and are stored in an ObjectMap.
Author
Inferno

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
ResourceData.AssetData<T>

This class contains all the information related to a given asset

public static interface
ResourceData.Configurable<T>

This interface must be implemented by any class requiring additional assets to be loaded/saved

public static class
ResourceData.SaveData

Contains all the saved data.

Field Summary

Modifier and TypeField and Description
private int
private Array<ResourceData.SaveData>
data

Objects save data, must be loaded in the same saving order

public T
pack-priv Array<ResourceData.AssetData<T>>
sharedAssets

Shared assets among all the configurable objects

private ObjectMap<String, ResourceData.SaveData>
uniqueData

Unique data, can be used to save/load generic data which is not always loaded back after saving.

Constructor Summary

AccessConstructor and Description
public
public
ResourceData(T resource)

Method Summary

Modifier and TypeMethod and Description
public ResourceData.SaveData
createSaveData()

Creates and adds a new SaveData object to the save data list

public ResourceData.SaveData
createSaveData(String key)

Creates and adds a new and unique SaveData object to the save data map

pack-priv <K> int
getAssetData(String filename, Class<K> type)

public Array<AssetDescriptor<T>>
public Array<ResourceData.AssetData<T>>
public ResourceData.SaveData
getSaveData()

Returns: the next save data in the list

public ResourceData.SaveData
getSaveData(String key)

Returns: the unique save data in the map

public void
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

currentLoadIndexback to summary
private int currentLoadIndex
databack to summary
private Array<ResourceData.SaveData> data

Objects save data, must be loaded in the same saving order

resourceback to summary
public T resource
sharedAssetsback to summary
pack-priv Array<ResourceData.AssetData<T>> sharedAssets

Shared assets among all the configurable objects

uniqueDataback to summary
private ObjectMap<String, ResourceData.SaveData> uniqueData

Unique data, can be used to save/load generic data which is not always loaded back after saving. Must be used to store data which is uniquely addressable by a given string (i.e a system configuration).

Constructor Detail

ResourceDataback to summary
public ResourceData()
ResourceDataback to summary
public ResourceData(T resource)

Method Detail

createSaveDataback to summary
public ResourceData.SaveData createSaveData()

Creates and adds a new SaveData object to the save data list

createSaveDataback to summary
public ResourceData.SaveData createSaveData(String key)

Creates and adds a new and unique SaveData object to the save data map

getAssetDataback to summary
pack-priv <K> int getAssetData(String filename, Class<K> type)
getAssetDescriptorsback to summary
public Array<AssetDescriptor<T>> getAssetDescriptors()
getAssetsback to summary
public Array<ResourceData.AssetData<T>> getAssets()
getSaveDataback to summary
public ResourceData.SaveData getSaveData()
Returns:ResourceData.SaveData

the next save data in the list

getSaveDataback to summary
public ResourceData.SaveData getSaveData(String key)
Returns:ResourceData.SaveData

the unique save data in the map

readback to summary
public void read(Json json, JsonValue jsonData)

Implements com.badlogic.gdx.utils.Json.Serializable.read.

Annotations
@Override
writeback to summary
public void write(Json json)

Implements com.badlogic.gdx.utils.Json.Serializable.write.

Annotations
@Override
com.badlogic.gdx.graphics.g3d.particles back to summary

public Class ResourceData.AssetData<T>

extends Object
implements Serializable
Class Inheritance
  • java.lang.Object
  • com.badlogic.gdx.graphics.g3d.particles.ResourceData.AssetData
All Implemented Interfaces
com.badlogic.gdx.utils.Json.Serializable

This class contains all the information related to a given asset

Field Summary

Modifier and TypeField and Description
public String
public Class<T>

Constructor Summary

AccessConstructor and Description
public
public
AssetData(String filename, Class<T> type)

Method Summary

Modifier and TypeMethod and Description
public void
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

filenameback to summary
public String filename
typeback to summary
public Class<T> type

Constructor Detail

AssetDataback to summary
public AssetData()
AssetDataback to summary
public AssetData(String filename, Class<T> type)

Method Detail

readback to summary
public void read(Json json, JsonValue jsonData)

Implements com.badlogic.gdx.utils.Json.Serializable.read.

Annotations
@Override
writeback to summary
public void write(Json json)

Implements com.badlogic.gdx.utils.Json.Serializable.write.

Annotations
@Override
com.badlogic.gdx.graphics.g3d.particles back to summary

public Interface ResourceData.Configurable<T>

Known Direct Subinterfaces
com.badlogic.gdx.graphics.g3d.particles.batches.ParticleBatch
Known Direct Implementers
com.badlogic.gdx.graphics.g3d.particles.values.SpawnShapeValue, com.badlogic.gdx.graphics.g3d.particles.ParticleController, com.badlogic.gdx.graphics.g3d.particles.ParticleControllerComponent, com.badlogic.gdx.graphics.g3d.particles.ParticleEffect

This interface must be implemented by any class requiring additional assets to be loaded/saved

Method Summary

Modifier and TypeMethod and Description
public void
load(AssetManager manager, ResourceData<T> resources)

public void
save(AssetManager manager, ResourceData<T> resources)

Method Detail

loadback to summary
public void load(AssetManager manager, ResourceData<T> resources)
saveback to summary
public void save(AssetManager manager, ResourceData<T> resources)
com.badlogic.gdx.graphics.g3d.particles back to summary

public Class ResourceData.SaveData

extends Object
implements Serializable
Class Inheritance
  • java.lang.Object
  • com.badlogic.gdx.graphics.g3d.particles.ResourceData.SaveData
All Implemented Interfaces
com.badlogic.gdx.utils.Json.Serializable

Contains all the saved data. data is a map which link an asset name to its instance. assets is an array of indices addressing a given com.badlogic.gdx.graphics.g3d.particles.ResourceData.AssetData in the ResourceData

Field Summary

Modifier and TypeField and Description
pack-priv IntArray
pack-priv ObjectMap<String, Object>
private int
protected ResourceData<T>

Constructor Summary

AccessConstructor and Description
public
public
SaveData(ResourceData<T> resources)

Method Summary

Modifier and TypeMethod and Description
public <K> K
load(String key)

public AssetDescriptor<T>
public void
public void
save(String key, Object value)

public <K> void
saveAsset(String filename, Class<K> type)

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

assetsback to summary
pack-priv IntArray assets
databack to summary
pack-priv ObjectMap<String, Object> data
loadIndexback to summary
private int loadIndex
resourcesback to summary
protected ResourceData<T> resources

Constructor Detail

SaveDataback to summary
public SaveData()
SaveDataback to summary
public SaveData(ResourceData<T> resources)

Method Detail

loadback to summary
public <K> K load(String key)
loadAssetback to summary
public AssetDescriptor<T> loadAsset()
readback to summary
public void read(Json json, JsonValue jsonData)

Implements com.badlogic.gdx.utils.Json.Serializable.read.

Annotations
@Override
saveback to summary
public void save(String key, Object value)
saveAssetback to summary
public <K> void saveAsset(String filename, Class<K> type)
writeback to summary
public void write(Json json)

Implements com.badlogic.gdx.utils.Json.Serializable.write.

Annotations
@Override