Drag[en]gine Script Module DragonScript
1.23
|
Behavior instance. More...
Classes | |
class | LinkStateListener |
Link state if connection is added. More... | |
class | StateUpdateListener |
State update listener. More... | |
Public Member Functions | |
void | addListener (Listener listener) |
Add listener. More... | |
int | addMessage (MessageListener listener) |
Add message listener. More... | |
int | addValue (NetworkStateValueType type, NetworkStateValueFormat format, ValueListener listener) |
Add value. More... | |
void | dispose () |
Dispose of composeable instance. More... | |
Connection | getConnection () |
Connection to server or null if not connected. More... | |
ConnectionTracker | getConnectionTracker () |
Connection tracker or null if not connected. More... | |
ECBehaviorNetworkState | getECBehavior () |
Behavior. More... | |
bool | getIsServer () |
Network state is the server state. More... | |
NetworkState | getNetworkState () |
Network state or null if not tracked. More... | |
NetworkStateTracker | getNetworkStateTracker () |
Network state tracker or null if not connected. More... | |
bool | getReadOnly () |
Network state is read only. More... | |
void | init (StubElement stub) |
Initialize element from stub. More... | |
void | linkState (Connection connection) |
Link state to connection if server. More... | |
void | linkState (Connection connection, bool readOnly) |
Link state to connection if server. More... | |
void | linkStateAllConnections () |
Link state to all tracked connections if server. More... | |
void | messageReceived (Connection connection, FileReader message) |
Process message received using ECBehaviorNetworkState.getMessageCode() . More... | |
Instance | new (ECBehaviorNetworkState ecbehavior, BehaviorElement element) |
Create element. More... | |
void | onStateValueChanged (int value) |
State value changed on the remote side. More... | |
void | readFromLinkMessage (FileReader reader) |
Call readFromLinkMessage for all listeners. More... | |
void | removeListener (Listener listener) |
Remove listener. More... | |
void | sendMessage (int message, NetworkMessage content, int maxDelay) |
Send unreliable message. More... | |
void | sendReliableMessage (int message, NetworkMessage content) |
Send reliable message. More... | |
void | setMessageListener (int message, ValueListener listener) |
Set listener for message. More... | |
void | setReadOnly (bool readOnly) |
Set if network state is read only. More... | |
void | setValueListener (int value, ValueListener listener) |
Set listener for value. More... | |
void | writeRequestLinkMessage (StubElement stub, Connection connection, FileWriter writer) |
Create network message to request linking state with server. More... | |
Public Member Functions inherited from Dragengine.Scenery.DefaultECBehaviorInstance | |
void | addToGameWorld () |
Add element to game world. More... | |
void | attachToParent (Element parent) |
Attach element to object set by the mapper in the IGDE World Editor. More... | |
void | enterFrame () |
Frame update started. More... | |
void | geometryChanged () |
Position or orientation changed. More... | |
BehaviorElement | getElement () |
Behavior element to apply behavior to. More... | |
int | getInstanceIndex () |
Behavior instance index. More... | |
DefaultECBehaviorInstance | new (BehaviorElement element) |
Create default composeable instance. More... | |
void | postThink (float elapsed) |
Post thinking after physics processing is finished. More... | |
void | readFromFile (PersistencyEnvironment env, FileReader reader) |
Read behavior instance from file. More... | |
void | removeFromGameWorld () |
Remove element from game world. More... | |
bool | requiresEnterFrame () |
Behavior instance requires enterFrame() to be called. More... | |
bool | requiresThink () |
Behavior instance requires think() to be called. More... | |
void | stateChanged () |
State changed (visble, touchable). More... | |
void | think (float elapsed) |
Think about what to do for the next frame update. More... | |
void | writeToFile (PersistencyEnvironment env, FileWriter writer) |
Write behavior instance to file. More... | |
Protected Member Functions | |
NetworkMessage | createMessage (int message, NetworkMessage content) |
Create message to send. More... | |
Protected Member Functions inherited from Dragengine.Scenery.DefaultECBehaviorInstance | |
void | setRequiresEnterFrame (bool required) |
Set if behavior instance requires enterFrame() to be called. More... | |
void | setRequiresThink (bool required) |
Set if behavior instance requires think() to be called. More... | |
Behavior instance.
void Dragengine.Scenery.ECBehaviorNetworkState.Instance.addListener | ( | Listener | listener | ) |
Add listener.
int Dragengine.Scenery.ECBehaviorNetworkState.Instance.addMessage | ( | MessageListener | listener | ) |
Add message listener.
listener | Listener called if message is received. |
int Dragengine.Scenery.ECBehaviorNetworkState.Instance.addValue | ( | NetworkStateValueType | type, |
NetworkStateValueFormat | format, | ||
ValueListener | listener | ||
) |
Add value.
If no network state is present this function does nothing and returns -1 . It is thus safe to try adding a value if this behavior is detected. Network state support has then to be enabled only if addValue() returns anything else but -1.
type | Type of value. |
format | Format of value. Use null for NetworkStateValueType.string and NetworkStateValueType.data |
listener | Listener called if value changes on remote side. |
|
protected |
Create message to send.
void Dragengine.Scenery.ECBehaviorNetworkState.Instance.dispose | ( | ) |
Dispose of composeable instance.
Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.
Connection Dragengine.Scenery.ECBehaviorNetworkState.Instance.getConnection | ( | ) |
Connection to server or null if not connected.
ConnectionTracker Dragengine.Scenery.ECBehaviorNetworkState.Instance.getConnectionTracker | ( | ) |
Connection tracker or null if not connected.
ECBehaviorNetworkState Dragengine.Scenery.ECBehaviorNetworkState.Instance.getECBehavior | ( | ) |
Behavior.
bool Dragengine.Scenery.ECBehaviorNetworkState.Instance.getIsServer | ( | ) |
Network state is the server state.
NetworkState Dragengine.Scenery.ECBehaviorNetworkState.Instance.getNetworkState | ( | ) |
Network state or null if not tracked.
NetworkStateTracker Dragengine.Scenery.ECBehaviorNetworkState.Instance.getNetworkStateTracker | ( | ) |
Network state tracker or null if not connected.
bool Dragengine.Scenery.ECBehaviorNetworkState.Instance.getReadOnly | ( | ) |
Network state is read only.
Usually reflects the read-only state of the resource network state but can be changed by scripts (typically server side) to turn the behavior read-only. This is typically the case for network states belonging to a client player which is changed by the client player not the server.
If true behaviors must not change state values while running. Otherwise strange effects can happen. If false behaviors can change state values while updating.
void Dragengine.Scenery.ECBehaviorNetworkState.Instance.init | ( | StubElement | stub | ) |
Initialize element from stub.
Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.
void Dragengine.Scenery.ECBehaviorNetworkState.Instance.linkState | ( | Connection | connection | ) |
Link state to connection if server.
Same as calling linkState(Connection,bool) with the result of calling Listener.writableLink() on all listeners.
void Dragengine.Scenery.ECBehaviorNetworkState.Instance.linkState | ( | Connection | connection, |
bool | readOnly | ||
) |
Link state to connection if server.
Calls Listener.prepareLinkState() on listeners to allow modify link request message.
void Dragengine.Scenery.ECBehaviorNetworkState.Instance.linkStateAllConnections | ( | ) |
Link state to all tracked connections if server.
Links state for all connections in ConnectionTracker. Calls linkState(Connection) for each tracked connection.
void Dragengine.Scenery.ECBehaviorNetworkState.Instance.messageReceived | ( | Connection | connection, |
FileReader | message | ||
) |
Process message received using ECBehaviorNetworkState.getMessageCode() .
Instance Dragengine.Scenery.ECBehaviorNetworkState.Instance.new | ( | ECBehaviorNetworkState | ecbehavior, |
BehaviorElement | element | ||
) |
Create element.
void Dragengine.Scenery.ECBehaviorNetworkState.Instance.onStateValueChanged | ( | int | value | ) |
State value changed on the remote side.
Called by StateUpdateListener only.
void Dragengine.Scenery.ECBehaviorNetworkState.Instance.readFromLinkMessage | ( | FileReader | reader | ) |
Call readFromLinkMessage for all listeners.
void Dragengine.Scenery.ECBehaviorNetworkState.Instance.removeListener | ( | Listener | listener | ) |
Remove listener.
void Dragengine.Scenery.ECBehaviorNetworkState.Instance.sendMessage | ( | int | message, |
NetworkMessage | content, | ||
int | maxDelay | ||
) |
Send unreliable message.
Send message with a maximum delay in milliseconds before giving up.
void Dragengine.Scenery.ECBehaviorNetworkState.Instance.sendReliableMessage | ( | int | message, |
NetworkMessage | content | ||
) |
Send reliable message.
void Dragengine.Scenery.ECBehaviorNetworkState.Instance.setMessageListener | ( | int | message, |
ValueListener | listener | ||
) |
Set listener for message.
void Dragengine.Scenery.ECBehaviorNetworkState.Instance.setReadOnly | ( | bool | readOnly | ) |
Set if network state is read only.
Usually reflects the read-only state of the resource network state but can be changed by scripts (typically server side) to turn the behavior read-only. This is typically the case for network states belonging to a client player which is changed by the client player not the server.
If true behaviors must not change state values while running. Otherwise strange effects can happen. If false behaviors can change state values while updating.
void Dragengine.Scenery.ECBehaviorNetworkState.Instance.setValueListener | ( | int | value, |
ValueListener | listener | ||
) |
Set listener for value.
void Dragengine.Scenery.ECBehaviorNetworkState.Instance.writeRequestLinkMessage | ( | StubElement | stub, |
Connection | connection, | ||
FileWriter | writer | ||
) |
Create network message to request linking state with server.
Create message by writing 8-bit code to message followed by stub content using StubElement.writeToFile().