|
Drag[en]gine Script Module DragonScript 1.35
|
Public Member Functions | |
| void | addProperty (ElementClassProperty property) |
| Add property. | |
| void | copyPropertyValues (ElementClass eclass) |
| Copy values of properties from another class to properties of this class. | |
| void | createAndAddElement (StubElement stub, GameWorld gameWorld) |
| Create element from given stub and add it to game world. | |
| Element | createElement (StubElement stub) |
| Create element instance from stub. | |
| void | dispose () |
| Dispose of element class. | |
| ElementClass | duplicateNamed (String classname) |
| Create duplicate of class with new name. | |
| bool | equals (Object obj) |
| Element class is equal to another object. | |
| void | failedLoading (String path, ResourceLoaderType resourceType) |
| Resource failed loading. | |
| void | finishedLoading (String path, ResourceLoaderType resourceType, Object resource) |
| Resource finished loading successfully. | |
| void | forEachProperty (Block ablock) |
| Visit properties with block with parameter ElementClass. | |
| String | getBasePath () |
| Base path for relative loading of resource properties. | |
| CodecPropertyString | getCodecPropertyString () |
| Property codec helper. | |
| bool | getIsXmlElementClass () |
| Element class is an XML element class. | |
| bool | getPersistable () |
| Element class is persistable to file writers. | |
| int | getPropertyCount () |
| Number of properties. | |
| ElementClassProperty | getPropertyNamed (String name) |
| Named property or null if absent. | |
| Array | getPropertyNames () |
| List of property names as array of strings. | |
| TSTriggerExpressionParser | getTriggerExpressionParser () |
| Trigger expression parser. | |
| int | hashCode () |
| Hash code. | |
| bool | hasPropertyNamed (String name) |
| Named property is present. | |
| Object | injectProperty (Object injectValue, Block ablock) |
| Process value visiting properties. | |
| void | loadAndAddElement (PersistencyEnvironment env, StubElement stub, FileReader reader, GameWorld gameWorld) |
| Load element from file reader and add it to game world. | |
| Element | loadElement (PersistencyEnvironment env, StubElement stub, FileReader reader) |
| Load element from file reader. | |
| ElementClass | new (String className) |
| Create element class. | |
| void | removeAllProperties () |
| Remove all properties. | |
| void | removeProperty (ElementClassProperty property) |
| Remove property. | |
| void | setBasePath (String path) |
| Set base path for relative loading of resource properties. | |
| void | setIsXmlElementClass (bool isXmlElementClass) |
| Set if element class is an XML element class. | |
| void | setPersistable (bool persistable) |
| Set element class is persistable to file writers. | |
| void | setPropertyValue (String name, Object value) |
| Set value of named property. | |
| Public Member Functions inherited from Dragengine.ResourceListener | |
Static Public Member Functions | |
| static CodecPropertyString | getSharedCodecPropertyString () |
| Shared property codec helper. | |
| static TSTriggerExpressionParser | getSharedTriggerExpressionParser () |
| Shared trigger expression parser. | |
| static void | setSharedCodecPropertyString (CodecPropertyString codec) |
| Set shared property codec helper. | |
| static void | setSharedTriggerExpressionParser (TSTriggerExpressionParser parser) |
| Set shared trigger expression parser. | |
Protected Member Functions | |
| Element | createElement () |
| Create element instance. | |
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.
Referenced by Dragengine.Scenery.RailCornerClass.createAndAddElement(), Dragengine.Scenery.RandomElementClass.dispose(), duplicateNamed(), Dragengine.Scenery.SimpleElementOnRailClass.getCanTrigger(), Dragengine.Scenery.RandomElementClass.getElementClasses(), Dragengine.Scenery.RandomElementClass.getGenerateChance(), Dragengine.Scenery.RandomElementClass.getMaxRandomRotation(), Dragengine.Scenery.RandomElementClass.getMinRandomRotation(), Dragengine.Gui.MainMenus.Interactive.IMMCameraSpotClass.getName(), Dragengine.Scenery.RandomElementClass.getRandomRotScale(), Dragengine.Scenery.RailCornerClass.new(), and Dragengine.Scenery.SpawnPointClass.new().
| 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.
References forEachProperty(), removeAllProperties(), and removeProperty().
Referenced by finishedLoading().
| 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.BehaviorElementClass, Dragengine.Scenery.IgnoreElementClass, Dragengine.Scenery.RailCornerClass, and Dragengine.Scenery.SpawnPointClass.
References getPersistable(), and setPropertyValue().
Referenced by failedLoading().
|
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.Gui.MainMenus.Interactive.IMMCameraSpotClass, Dragengine.Gui.MainMenus.Interactive.IMMEnvironmentMapClass, Dragengine.Gui.MainMenus.Interactive.IMMHotSpotClass, Dragengine.Gui.MainMenus.Interactive.IMMLightClass, Dragengine.Gui.MainMenus.Interactive.IMMParticleEmitterClass, Dragengine.Gui.MainMenus.Interactive.IMMPropClass, Dragengine.Gui.MainMenus.Interactive.IMMSpeakerClass, Dragengine.Scenery.AnimatedElementClass, Dragengine.Scenery.AttachableBaseBillboardClass, Dragengine.Scenery.AttachableBaseForceFieldClass, Dragengine.Scenery.AttachableBaseLightClass, Dragengine.Scenery.AttachableBaseParticleEmitterClass, Dragengine.Scenery.AttachableBaseSpeakerClass, Dragengine.Scenery.AttachSlotClass, Dragengine.Scenery.BaseActorClass, Dragengine.Scenery.BaseBillboardClass, Dragengine.Scenery.BaseForceFieldClass, Dragengine.Scenery.BaseLightClass, Dragengine.Scenery.BaseParticleEmitterClass, Dragengine.Scenery.BaseSkyClass, Dragengine.Scenery.BaseSpeakerClass, Dragengine.Scenery.BaseVRActorClass, Dragengine.Scenery.BaseWorldClass, Dragengine.Scenery.BehaviorElementClass, Dragengine.Scenery.EnvironmentMapClass, Dragengine.Scenery.GhostElementClass, Dragengine.Scenery.HiddenElementClass, Dragengine.Scenery.IgnoreElementClass, Dragengine.Scenery.InfoConvoCoordSystemClass, Dragengine.Scenery.PhysicsElementClass, Dragengine.Scenery.RandomElementClass, Dragengine.Scenery.SimpleElementClass, Dragengine.Scenery.SimpleElementOnRailClass, Dragengine.Scenery.TriggerConversationClass, Dragengine.Scenery.TriggerEvaluateClass, Dragengine.Scenery.TriggerShoutClass, Dragengine.Scenery.TriggerTimerClass, Dragengine.Scenery.TriggerToggleClass, Dragengine.Scenery.TriggerTouchClass, Dragengine.Scenery.TwoStateAnimatedElementClass, Dragengine.TestSystem.TestCaseECBehavior.TestBehaviorElementClass, and Dragengine.TestSystem.TestCaseECBehaviorPersistency.TestBehaviorElementClass.
References injectProperty().
Referenced by failedLoading().
| 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.IgnoreElementClass, and Dragengine.Scenery.RandomElementClass.
| void Dragengine.Scenery.ElementClass.dispose | ( | ) |
Dispose of element class.
Reimplemented in Dragengine.Scenery.BehaviorElementClass, Dragengine.Scenery.RandomElementClass, Dragengine.TestSystem.TestCaseECBehavior.TestBehaviorElementClass, and Dragengine.TestSystem.TestCaseECBehaviorPersistency.TestBehaviorElementClass.
Referenced by setBasePath().
| 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.Gui.MainMenus.Interactive.IMMCameraSpotClass, Dragengine.Gui.MainMenus.Interactive.IMMEnvironmentMapClass, Dragengine.Gui.MainMenus.Interactive.IMMHotSpotClass, Dragengine.Gui.MainMenus.Interactive.IMMLightClass, Dragengine.Gui.MainMenus.Interactive.IMMParticleEmitterClass, Dragengine.Gui.MainMenus.Interactive.IMMPropClass, Dragengine.Gui.MainMenus.Interactive.IMMSpeakerClass, Dragengine.Scenery.AnimatedElementClass, Dragengine.Scenery.AttachableBaseBillboardClass, Dragengine.Scenery.AttachableBaseForceFieldClass, Dragengine.Scenery.AttachableBaseLightClass, Dragengine.Scenery.AttachableBaseParticleEmitterClass, Dragengine.Scenery.AttachableBaseSpeakerClass, Dragengine.Scenery.AttachSlotClass, Dragengine.Scenery.BaseActorClass, Dragengine.Scenery.BaseBillboardClass, Dragengine.Scenery.BaseForceFieldClass, Dragengine.Scenery.BaseLightClass, Dragengine.Scenery.BaseParticleEmitterClass, Dragengine.Scenery.BaseSkyClass, Dragengine.Scenery.BaseSpeakerClass, Dragengine.Scenery.BaseWorldClass, Dragengine.Scenery.EnvironmentMapClass, Dragengine.Scenery.GenericBehaviorElementClass, Dragengine.Scenery.GhostElementClass, Dragengine.Scenery.HiddenElementClass, Dragengine.Scenery.IgnoreElementClass, Dragengine.Scenery.InfoConvoCoordSystemClass, Dragengine.Scenery.PhysicsElementClass, Dragengine.Scenery.RandomElementClass, Dragengine.Scenery.SimpleElementClass, Dragengine.Scenery.SimpleElementOnRailClass, Dragengine.Scenery.TriggerConversationClass, Dragengine.Scenery.TriggerEvaluateClass, Dragengine.Scenery.TriggerShoutClass, Dragengine.Scenery.TriggerTimerClass, Dragengine.Scenery.TriggerToggleClass, Dragengine.Scenery.TriggerTouchClass, and Dragengine.Scenery.TwoStateAnimatedElementClass.
References addProperty(), hasPropertyNamed(), and new().
Referenced by loadAndAddElement().
| 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.
Referenced by failedLoading().
| void Dragengine.Scenery.ElementClass.failedLoading | ( | String | path, |
| ResourceLoaderType | resourceType ) |
Resource failed loading.
Implements Dragengine.ResourceListener.
References createAndAddElement(), createElement(), equals(), failedLoading(), finishedLoading(), hashCode(), loadAndAddElement(), and loadElement().
Referenced by failedLoading().
| void Dragengine.Scenery.ElementClass.finishedLoading | ( | String | path, |
| ResourceLoaderType | resourceType, | ||
| Object | resource ) |
Resource finished loading successfully.
Implements Dragengine.ResourceListener.
References copyPropertyValues().
Referenced by failedLoading().
| void Dragengine.Scenery.ElementClass.forEachProperty | ( | Block | ablock | ) |
Visit properties with block with parameter ElementClass.
References getCodecPropertyString(), and getSharedTriggerExpressionParser().
Referenced by copyPropertyValues().
| String Dragengine.Scenery.ElementClass.getBasePath | ( | ) |
Base path for relative loading of resource properties.
References new().
Referenced by setSharedCodecPropertyString().
| 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.
Referenced by forEachProperty(), and Dragengine.Scenery.RandomElementClass.loadAndAddElement().
| bool Dragengine.Scenery.ElementClass.getIsXmlElementClass | ( | ) |
Element class is an XML element class.
Referenced by setSharedTriggerExpressionParser().
| bool Dragengine.Scenery.ElementClass.getPersistable | ( | ) |
Element class is persistable to file writers.
References getPropertyCount().
Referenced by createAndAddElement(), and Dragengine.Scenery.RandomElementClass.loadAndAddElement().
| int Dragengine.Scenery.ElementClass.getPropertyCount | ( | ) |
Number of properties.
Referenced by getPersistable().
| ElementClassProperty Dragengine.Scenery.ElementClass.getPropertyNamed | ( | String | name | ) |
Named property or null if absent.
Referenced by setPersistable().
| Array Dragengine.Scenery.ElementClass.getPropertyNames | ( | ) |
List of property names as array of strings.
References getSharedCodecPropertyString().
Referenced by setPersistable().
|
static |
Shared property codec helper.
Referenced by getPropertyNames().
|
static |
Shared trigger expression parser.
Referenced by forEachProperty().
| 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.
References setIsXmlElementClass().
Referenced by injectProperty().
| int Dragengine.Scenery.ElementClass.hashCode | ( | ) |
Hash code.
Referenced by failedLoading().
| bool Dragengine.Scenery.ElementClass.hasPropertyNamed | ( | String | name | ) |
Named property is present.
References new(), and setSharedCodecPropertyString().
Referenced by duplicateNamed().
| 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.
References getTriggerExpressionParser(), new(), and setSharedTriggerExpressionParser().
Referenced by createElement().
| 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.IgnoreElementClass, and Dragengine.Scenery.RandomElementClass.
References duplicateNamed().
Referenced by Dragengine.Scenery.BehaviorElementClass.createAndAddElement(), and failedLoading().
| 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.IgnoreElementClass, and Dragengine.Scenery.RandomElementClass.
References setPersistable().
Referenced by failedLoading().
| ElementClass Dragengine.Scenery.ElementClass.new | ( | String | className | ) |
Create element class.
Reimplemented in Dragengine.Scenery.AnimatedElementClass, Dragengine.Scenery.AttachableBaseBillboardClass, Dragengine.Scenery.AttachableBaseForceFieldClass, Dragengine.Scenery.AttachableBaseLightClass, Dragengine.Scenery.AttachableBaseParticleEmitterClass, Dragengine.Scenery.AttachableBaseSpeakerClass, Dragengine.Scenery.AttachSlotClass, Dragengine.Scenery.BaseActorClass, Dragengine.Scenery.BaseBillboardClass, Dragengine.Scenery.BaseForceFieldClass, Dragengine.Scenery.BaseLightClass, Dragengine.Scenery.BaseParticleEmitterClass, Dragengine.Scenery.BaseSkyClass, Dragengine.Scenery.BaseSpeakerClass, Dragengine.Scenery.BaseVRActorClass, Dragengine.Scenery.BaseWorldClass, Dragengine.Scenery.BehaviorElementClass, Dragengine.Scenery.EnvironmentMapClass, Dragengine.Scenery.GenericBehaviorElementClass, Dragengine.Scenery.GhostElementClass, Dragengine.Scenery.HiddenElementClass, Dragengine.Scenery.IgnoreElementClass, Dragengine.Scenery.InfoConvoCoordSystemClass, Dragengine.Scenery.PhysicsElementClass, Dragengine.Scenery.SimpleElementClass, Dragengine.Scenery.SimpleElementOnRailClass, Dragengine.Scenery.SpawnPointClass, and Dragengine.Scenery.TwoStateAnimatedElementClass.
References new().
Referenced by duplicateNamed(), getBasePath(), hasPropertyNamed(), injectProperty(), new(), and setSharedCodecPropertyString().
| void Dragengine.Scenery.ElementClass.removeAllProperties | ( | ) |
Remove all properties.
Referenced by copyPropertyValues().
| void Dragengine.Scenery.ElementClass.removeProperty | ( | ElementClassProperty | property | ) |
Remove property.
Referenced by copyPropertyValues().
| void Dragengine.Scenery.ElementClass.setBasePath | ( | String | path | ) |
Set base path for relative loading of resource properties.
References dispose().
Referenced by setSharedCodecPropertyString().
| void Dragengine.Scenery.ElementClass.setIsXmlElementClass | ( | bool | isXmlElementClass | ) |
Set if element class is an XML element class.
Referenced by getTriggerExpressionParser().
| void Dragengine.Scenery.ElementClass.setPersistable | ( | bool | persistable | ) |
Set element class is persistable to file writers.
References getPropertyNamed(), and getPropertyNames().
Referenced by loadElement(), Dragengine.Scenery.IgnoreElementClass.new(), Dragengine.Scenery.RailCornerClass.new(), and Dragengine.Scenery.SpawnPointClass.new().
| 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. |
Referenced by createAndAddElement().
|
static |
Set shared property codec helper.
References getBasePath(), new(), and setBasePath().
Referenced by hasPropertyNamed().
|
static |
Set shared trigger expression parser.
References getIsXmlElementClass().
Referenced by injectProperty().