User Tools

Site Tools


dragengine:modules:dragonscript:behavior_dynamicskin

See also:

ECBehaviorDynamicSkin

Behavior element behavior adding dynamic skin support.

Dynamic skins are used to alter the visual appearance of ECBehaviorComponent. Dynamic skins affect the skin assigned to the ECBehaviorComponent.

This behavior provides the dynamic skin for the component. Other behaviors add renderables to them to provide their functionality. Multiple behaviors should not target the same named renderable unless they are crafted in a specific way to not interfere with each other.

Instance Counts

Multiple ECBehaviorDynamicSkin can be added targeting different ECBehaviorComponent using their identifier. It is not possible to add multiple ECBehaviorDynamicSkin targeting the same ECBehaviorComponent.

Element Class Properties

Element class properties have the prefix dynamicSkin. or dynamicSkin({id}). if id is not empty.

Events

This behavior has no events.

Required Behaviors

Optional Behaviors

This behavior does not support optional behaviors.

Persistency

This behavior does not required element class to be persistable (setPersistable).

API Documentation

ECBehaviorDynamicSkin.

Since DragonScript Module Version 1.0

Use Cases

  • Add dynamic skin other behaviors or game scripts can modify to show dynamic content on components.

Element Class Example

This example defines an element which a dynamic skin.

class MyElement extends BehaviorElementClass
  public var ECBehaviorComponent component
  public var ECBehaviorDynamicSkin dynamicSkin
  func new()
    component = ECBehaviorComponent.new(this, null)
    dynamicSkin = ECBehaviorDynamicSkin.new(this, component)
  end
end

Behavior Factory

Using element class supporting adding behaviors the behavior can be added like this:

<?xml version='1.0' encoding='UTF-8'?>
<elementClass name='MyClass' class='GenericBehaviorElement'>
  <behavior type='ECBehaviorComponent'/>
 
  <behavior type='ECBehaviorDynamicSkin'>
    <!-- optional: use component with id instead of empty string -->
    <string name='component'>second</string>
 
    <!-- set element properties. omit property prefix if used inside behavior tag -->
    <string name='.name'>value</string>
  </behavior>
 
  <!-- for adding multiple behaviors use unique identifiers -->
  <behavior type='ECBehaviorDynamicSkin' id='second'/>
</elementClass>

Live Examples

You could leave a comment if you were logged in.
dragengine/modules/dragonscript/behavior_dynamicskin.txt · Last modified: 2025/03/13 17:12 by dragonlord