Drag[en]gine Script Module DragonScript
1.23
|
Interface for behaviors supporting compatible persistency. More...
Public Member Functions | |
String | getBehaviorID () |
Unique identifier of behavior. More... | |
void | loadSupportedData (String identifier, PersistencyEnvironment env, FileReader reader, ECBehaviorInstance instance) |
Load instance data of another behavior. More... | |
bool | supportsBehaviorID (String identifier) |
Behavior supports loading instance data of another behavior. More... | |
Interface for behaviors supporting compatible persistency.
Compatible persistency behaviors allow BehaviorElement to persist behavior instances in a backward and future expansion compatible way. Such behaviors needs to provide a unique behavior identifier saved together with the behavior instance data. While loading the behavior data is matched by using this behavior identifier.
Furthermore if a behavior data block does not match any behavior all behaviors are asked if they know how to load the behavior data block although not belonging to them. This is required if a user replaces a behavior with another behavior providing the same but enhanced behavior. Typically these behaviors are subclass of the replaced behavior. They can be written to support reading the behavior data block of the super class they enhance to avoid breaking save files if possible.
String Dragengine.Scenery.BehaviorCompatiblePersistency.getBehaviorID | ( | ) |
Unique identifier of behavior.
Has to return a string which is unique in the owner BehaviorElementClass. This string will be stored while persisting BehaviorElement instances. This allows to assign restored behavior instance data to the correct behavior instance if present.
Implemented in Dragengine.Scenery.DefaultECBehavior.
void Dragengine.Scenery.BehaviorCompatiblePersistency.loadSupportedData | ( | String | identifier, |
PersistencyEnvironment | env, | ||
FileReader | reader, | ||
ECBehaviorInstance | instance | ||
) |
Load instance data of another behavior.
Called if supportsBehaviorID(String) returns true for identifier. BehaviorElement requests behavior to load the supported instance data block into instance.
Implemented in Dragengine.Scenery.DefaultECBehavior.
bool Dragengine.Scenery.BehaviorCompatiblePersistency.supportsBehaviorID | ( | String | identifier | ) |
Behavior supports loading instance data of another behavior.
Returns true if thie behavior supports loading instance data of another behavior matching behavior identifier. Called for all behaviors if BehaviorElement encountered an instance data block with a behavior identifier not matching any behavior instances.
Implemented in Dragengine.Scenery.DefaultECBehavior.