Drag[en]gine Script Module DragonScript
1.21
|
Public Member Functions | |
void | addProperty (ElementClassProperty property) |
Add property. More... | |
void | copyPropertyValues (ElementClass eclass) |
Copy values of properties from another class to properties of this class. More... | |
void | createAndAddElement (StubElement stub, GameWorld gameWorld) |
Create element from given stub and add it to game world. More... | |
Element | createElement (StubElement stub) |
Create element instance from stub. More... | |
void | dispose () |
Dispose of element class. More... | |
ElementClass | duplicateNamed (String classname) |
Create duplicate of class with new name. More... | |
bool | equals (Object obj) |
Element class is equal to another object. More... | |
void | failedLoading (String path, ResourceLoaderType resourceType) |
Resource failed loading. More... | |
void | finishedLoading (String path, ResourceLoaderType resourceType, Object resource) |
Resource finished loading successfully. More... | |
void | forEachProperty (Block ablock) |
Visit properties with block with parameter ElementClass. More... | |
String | getBasePath () |
Base path for relative loading of resource properties. More... | |
CodecPropertyString | getCodecPropertyString () |
Property codec helper. More... | |
bool | getIsXmlElementClass () |
Element class is an XML element class. More... | |
bool | getPersistable () |
Element class is persistable to file writers. More... | |
int | getPropertyCount () |
Number of properties. More... | |
ElementClassProperty | getPropertyNamed (String name) |
Named property or null if absent. More... | |
Array | getPropertyNames () |
List of property names as array of strings. More... | |
TSTriggerExpressionParser | getTriggerExpressionParser () |
Trigger expression parser. More... | |
int | hashCode () |
Hash code. More... | |
bool | hasPropertyNamed (String name) |
Named property is present. More... | |
Object | injectProperty (Object injectValue, Block ablock) |
Process value visiting properties. More... | |
void | loadAndAddElement (PersistencyEnvironment env, StubElement stub, FileReader reader, GameWorld gameWorld) |
Load element from file reader and add it to game world. More... | |
Element | loadElement (PersistencyEnvironment env, StubElement stub, FileReader reader) |
Load element from file reader. More... | |
ElementClass | new (String className) |
Create element class. More... | |
void | removeAllProperties () |
Remove all properties. More... | |
void | removeProperty (ElementClassProperty property) |
Remove property. More... | |
void | setBasePath (String path) |
Set base path for relative loading of resource properties. More... | |
void | setIsXmlElementClass (bool isXmlElementClass) |
Set if element class is an XML element class. More... | |
void | setPersistable (bool persistable) |
Set element class is persistable to file writers. More... | |
void | setPropertyValue (String name, Object value) |
Set value of named property. More... | |
Notification |
Static Public Member Functions | |
static CodecPropertyString | getSharedCodecPropertyString () |
Shared property codec helper. More... | |
static TSTriggerExpressionParser | getSharedTriggerExpressionParser () |
Shared trigger expression parser. More... | |
static void | setSharedCodecPropertyString (CodecPropertyString codec) |
Set shared property codec helper. More... | |
static void | setSharedTriggerExpressionParser (TSTriggerExpressionParser parser) |
Set shared trigger expression parser. More... | |
Protected Member Functions | |
Element | createElement () |
Create element instance. More... | |
Element class.
Describes class of elements. Instances of this element classes can be created from stubs and loaded from file readers. Supports class properties suitable for using XML subclassing.
Element classes can be set to not be persistable to file writers (for example save states). By default all element classes are persistable. Persistable element classes are not loaded if the world file is loaded only for the purpose to restore elements from file readers. Not persistable element classes are not written to file writers. Instead they are created if a world is loaded for the purpose to restore elements from file readers. Not persistable element classes are typically static geometry not changing or special elements not producing an element in the world but doing other things. See StaticGeometryClass in the example project for an example on how to use this feature.
void Dragengine.Scenery.ElementClass.addProperty | ( | ElementClassProperty | property | ) |
Add property.
void Dragengine.Scenery.ElementClass.copyPropertyValues | ( | ElementClass | eclass | ) |
Copy values of properties from another class to properties of this class.
Using this function call is required to support nested XML subclassing. Nested XML subclassing means the class duplicateNamed() is called on is not a script class but an XML subclass. In this situation the duplicateNamed() is called on the script class the base XML subclass has been created from and the values set to the properties using the XML file are lost.
void Dragengine.Scenery.ElementClass.createAndAddElement | ( | StubElement | stub, |
GameWorld | gameWorld | ||
) |
Create element from given stub and add it to game world.
Calls createElement(stub) to obtain a new element instance. If the returned element is null no further processing is done. If an element is returned it is added to gameWorld.
Most subclasses overwrite createElement() to create an instance of the subclass. Subclasses not representing actual elements or require special handling should overwrite this method and loadAndAddElement() to provide the specific handling.
Reimplemented in Dragengine.Scenery.SpawnPointClass, Dragengine.Scenery.RailCornerClass, Dragengine.Scenery.IgnoreElementClass, and Dragengine.Scenery.BehaviorElementClass.
|
protected |
Create element instance.
If this element class does not support creating elements, for example because the result is not an element, null has to be returned. The default implementation returns null. Subclasses not intending to create elements or requiring special creation handling should subclass createAndAddElement() and loadAndAddElement() bypassing this method.
Reimplemented in Dragengine.TestSystem.TestCaseECBehaviorPersistency.TestBehaviorElementClass, Dragengine.TestSystem.TestCaseECBehavior.TestBehaviorElementClass, Dragengine.Scenery.TwoStateAnimatedElementClass, Dragengine.Scenery.TriggerTouchClass, Dragengine.Scenery.TriggerToggleClass, Dragengine.Scenery.TriggerTimerClass, Dragengine.Scenery.TriggerShoutClass, Dragengine.Scenery.TriggerEvaluateClass, Dragengine.Scenery.TriggerConversationClass, Dragengine.Scenery.SimpleElementClass, Dragengine.Scenery.RandomElementClass, Dragengine.Scenery.SimpleElementOnRailClass, Dragengine.Scenery.PhysicsElementClass, Dragengine.Scenery.InfoConvoCoordSystemClass, Dragengine.Scenery.IgnoreElementClass, Dragengine.Scenery.HiddenElementClass, Dragengine.Scenery.GhostElementClass, Dragengine.Scenery.EnvironmentMapClass, Dragengine.Scenery.BehaviorElementClass, Dragengine.Scenery.BaseSpeakerClass, Dragengine.Scenery.BaseSkyClass, Dragengine.Scenery.BaseParticleEmitterClass, Dragengine.Scenery.BaseLightClass, Dragengine.Scenery.BaseForceFieldClass, Dragengine.Scenery.BaseBillboardClass, Dragengine.Scenery.AttachSlotClass, Dragengine.Scenery.AttachableBaseSpeakerClass, Dragengine.Scenery.AttachableBaseParticleEmitterClass, Dragengine.Scenery.AttachableBaseLightClass, Dragengine.Scenery.AttachableBaseForceFieldClass, Dragengine.Scenery.AttachableBaseBillboardClass, Dragengine.Scenery.AnimatedElementClass, Dragengine.Scenery.BaseVRActorClass, Dragengine.Scenery.BaseActorClass, Dragengine.Gui.MainMenus.Interactive.IMMSpeakerClass, Dragengine.Gui.MainMenus.Interactive.IMMPropClass, Dragengine.Gui.MainMenus.Interactive.IMMParticleEmitterClass, Dragengine.Gui.MainMenus.Interactive.IMMLightClass, Dragengine.Gui.MainMenus.Interactive.IMMHotSpotClass, Dragengine.Gui.MainMenus.Interactive.IMMEnvironmentMapClass, and Dragengine.Gui.MainMenus.Interactive.IMMCameraSpotClass.
Element Dragengine.Scenery.ElementClass.createElement | ( | StubElement | stub | ) |
Create element instance from stub.
Calls createElement() to create the element. If the returned element is null no further processing is done. If an element is returned init() is called on the element using stub.
This method is used by createAndAddElement() and loadAndAddElement(). It can be used to create fully initialized elements without adding them to the game world.
Reimplemented in Dragengine.Scenery.RandomElementClass, and Dragengine.Scenery.IgnoreElementClass.
void Dragengine.Scenery.ElementClass.dispose | ( | ) |
ElementClass Dragengine.Scenery.ElementClass.duplicateNamed | ( | String | classname | ) |
Create duplicate of class with new name.
This is used for creating element classes using XML element class loading. If this class does not support XML subclassing return null.
The default implementation returns null.
Reimplemented in Dragengine.Scenery.EnvironmentMapClass, Dragengine.Gui.MainMenus.Interactive.IMMSpeakerClass, Dragengine.Gui.MainMenus.Interactive.IMMPropClass, Dragengine.Gui.MainMenus.Interactive.IMMParticleEmitterClass, Dragengine.Gui.MainMenus.Interactive.IMMLightClass, Dragengine.Gui.MainMenus.Interactive.IMMHotSpotClass, Dragengine.Gui.MainMenus.Interactive.IMMEnvironmentMapClass, Dragengine.Gui.MainMenus.Interactive.IMMCameraSpotClass, Dragengine.Scenery.TwoStateAnimatedElementClass, Dragengine.Scenery.TriggerTouchClass, Dragengine.Scenery.TriggerToggleClass, Dragengine.Scenery.TriggerTimerClass, Dragengine.Scenery.TriggerShoutClass, Dragengine.Scenery.TriggerEvaluateClass, Dragengine.Scenery.TriggerConversationClass, Dragengine.Scenery.SimpleElementClass, Dragengine.Scenery.RandomElementClass, Dragengine.Scenery.SimpleElementOnRailClass, Dragengine.Scenery.PhysicsElementClass, Dragengine.Scenery.InfoConvoCoordSystemClass, Dragengine.Scenery.IgnoreElementClass, Dragengine.Scenery.HiddenElementClass, Dragengine.Scenery.GhostElementClass, Dragengine.Scenery.BaseSpeakerClass, Dragengine.Scenery.BaseSkyClass, Dragengine.Scenery.BaseParticleEmitterClass, Dragengine.Scenery.BaseLightClass, Dragengine.Scenery.BaseForceFieldClass, Dragengine.Scenery.BaseBillboardClass, Dragengine.Scenery.AttachSlotClass, Dragengine.Scenery.AttachableBaseSpeakerClass, Dragengine.Scenery.AttachableBaseParticleEmitterClass, Dragengine.Scenery.AttachableBaseLightClass, Dragengine.Scenery.AttachableBaseForceFieldClass, Dragengine.Scenery.AttachableBaseBillboardClass, and Dragengine.Scenery.AnimatedElementClass.
bool Dragengine.Scenery.ElementClass.equals | ( | Object | obj | ) |
Element class is equal to another object.
Two element classes are equal if they have the same class name.
void Dragengine.Scenery.ElementClass.failedLoading | ( | String | path, |
ResourceLoaderType | resourceType | ||
) |
Resource failed loading.
Implements Dragengine.ResourceListener.
void Dragengine.Scenery.ElementClass.finishedLoading | ( | String | path, |
ResourceLoaderType | resourceType, | ||
Object | resource | ||
) |
Resource finished loading successfully.
Implements Dragengine.ResourceListener.
void Dragengine.Scenery.ElementClass.forEachProperty | ( | Block | ablock | ) |
Visit properties with block with parameter ElementClass.
String Dragengine.Scenery.ElementClass.getBasePath | ( | ) |
Base path for relative loading of resource properties.
CodecPropertyString Dragengine.Scenery.ElementClass.getCodecPropertyString | ( | ) |
Property codec helper.
Default implementation uses shared coded property string. Subclass to use a specific codec for this class only.
bool Dragengine.Scenery.ElementClass.getIsXmlElementClass | ( | ) |
bool Dragengine.Scenery.ElementClass.getPersistable | ( | ) |
Element class is persistable to file writers.
int Dragengine.Scenery.ElementClass.getPropertyCount | ( | ) |
Number of properties.
ElementClassProperty Dragengine.Scenery.ElementClass.getPropertyNamed | ( | String | name | ) |
Named property or null if absent.
Array Dragengine.Scenery.ElementClass.getPropertyNames | ( | ) |
List of property names as array of strings.
|
static |
Shared property codec helper.
|
static |
Shared trigger expression parser.
TSTriggerExpressionParser Dragengine.Scenery.ElementClass.getTriggerExpressionParser | ( | ) |
Trigger expression parser.
Default implementation uses shared trigger expression parser. Subclass to use a specific parser for this class only.
int Dragengine.Scenery.ElementClass.hashCode | ( | ) |
Hash code.
bool Dragengine.Scenery.ElementClass.hasPropertyNamed | ( | String | name | ) |
Named property is present.
Object Dragengine.Scenery.ElementClass.injectProperty | ( | Object | injectValue, |
Block | ablock | ||
) |
Process value visiting properties.
Works like Array.inject() . Block receives Object processed value as first argument and ElementClassProperty as second argument. Block return value becomes processed value for the next visited property. First property received initialValue to process.
void Dragengine.Scenery.ElementClass.loadAndAddElement | ( | PersistencyEnvironment | env, |
StubElement | stub, | ||
FileReader | reader, | ||
GameWorld | gameWorld | ||
) |
Load element from file reader and add it to game world.
Calls loadElement(stub) to obtain a new element instance. If the returned element is null no further processing is done. If an element is returned it is added to the gameWorld.
Most subclasses overwrite createElement() to create an instance of the subclass. Subclasses not representing actual elements or require special handling should overwrite this method and createAndAddElement() to provide the specific handling.
Reimplemented in Dragengine.Scenery.RandomElementClass, and Dragengine.Scenery.IgnoreElementClass.
Element Dragengine.Scenery.ElementClass.loadElement | ( | PersistencyEnvironment | env, |
StubElement | stub, | ||
FileReader | reader | ||
) |
Load element from file reader.
Calls createElement(stub) to obtain a new element instance. If the returned element is null no further processing is done. If an element is returned readFromFile(reader) is called on the element. Then the element is added to gameWorld.
This method is used by loadAndAddElement(). It can be used to create fully loaded elements without adding them to the game world.
Reimplemented in Dragengine.Scenery.RandomElementClass, and Dragengine.Scenery.IgnoreElementClass.
ElementClass Dragengine.Scenery.ElementClass.new | ( | String | className | ) |
Create element class.
Reimplemented in Dragengine.Scenery.InfoConvoCoordSystemClass, Dragengine.Scenery.EnvironmentMapClass, Dragengine.Scenery.TwoStateAnimatedElementClass, Dragengine.Scenery.SpawnPointClass, Dragengine.Scenery.SimpleElementClass, Dragengine.Scenery.SimpleElementOnRailClass, Dragengine.Scenery.PhysicsElementClass, Dragengine.Scenery.IgnoreElementClass, Dragengine.Scenery.HiddenElementClass, Dragengine.Scenery.GhostElementClass, Dragengine.Scenery.BehaviorElementClass, Dragengine.Scenery.BaseSpeakerClass, Dragengine.Scenery.BaseSkyClass, Dragengine.Scenery.BaseParticleEmitterClass, Dragengine.Scenery.BaseLightClass, Dragengine.Scenery.BaseForceFieldClass, Dragengine.Scenery.BaseBillboardClass, Dragengine.Scenery.AttachSlotClass, Dragengine.Scenery.AttachableBaseSpeakerClass, Dragengine.Scenery.AttachableBaseParticleEmitterClass, Dragengine.Scenery.AttachableBaseLightClass, Dragengine.Scenery.AttachableBaseForceFieldClass, Dragengine.Scenery.AttachableBaseBillboardClass, Dragengine.Scenery.AnimatedElementClass, Dragengine.Scenery.BaseVRActorClass, and Dragengine.Scenery.BaseActorClass.
void Dragengine.Scenery.ElementClass.removeAllProperties | ( | ) |
Remove all properties.
void Dragengine.Scenery.ElementClass.removeProperty | ( | ElementClassProperty | property | ) |
Remove property.
void Dragengine.Scenery.ElementClass.setBasePath | ( | String | path | ) |
Set base path for relative loading of resource properties.
void Dragengine.Scenery.ElementClass.setIsXmlElementClass | ( | bool | isXmlElementClass | ) |
Set if element class is an XML element class.
void Dragengine.Scenery.ElementClass.setPersistable | ( | bool | persistable | ) |
Set element class is persistable to file writers.
void Dragengine.Scenery.ElementClass.setPropertyValue | ( | String | name, |
Object | value | ||
) |
Set value of named property.
Used by LoadElementClass to set the property value. This is not necessarily the same as the value retrieved from the property for use by Element instances. For example with resources this sets the path to the resource to load while the Element instances get the loaded resource itself.
name | Name of property to set value for. |
value | Value to set. |
basePath | Base path for relative resource loading. |
EInvalidParam | Property is absent. |
Exception | Value is not understood by property. |
|
static |
Set shared property codec helper.
|
static |
Set shared trigger expression parser.