Drag[en]gine Script Module DragonScript  1.23
Dragengine.Scenery.ECBehaviorNetworkState.Instance Class Reference

Behavior instance. More...

Inheritance diagram for Dragengine.Scenery.ECBehaviorNetworkState.Instance:
Dragengine.Scenery.DefaultECBehaviorInstance Dragengine.Scenery.ECBehaviorInstance

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...
 

Detailed Description

Behavior instance.

Member Function Documentation

◆ addListener()

void Dragengine.Scenery.ECBehaviorNetworkState.Instance.addListener ( Listener  listener)

Add listener.

◆ addMessage()

int Dragengine.Scenery.ECBehaviorNetworkState.Instance.addMessage ( MessageListener  listener)

Add message listener.

Warning
Make sure the element class on the local and remote side add messages in the exact same order.
Parameters
listenerListener called if message is received.
Returns
index of message to use to send message.

◆ addValue()

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.

Warning
Call this method only in response to Listener.addValues()
Make sure the element class on the local and remote side add values in the exact same order with the exact same type and format.
Parameters
typeType of value.
formatFormat of value. Use null for NetworkStateValueType.string and NetworkStateValueType.data
listenerListener called if value changes on remote side.
Returns
index of value in the network state or -1 if there is no network state.

◆ createMessage()

NetworkMessage Dragengine.Scenery.ECBehaviorNetworkState.Instance.createMessage ( int  message,
NetworkMessage  content 
)
protected

Create message to send.

◆ dispose()

void Dragengine.Scenery.ECBehaviorNetworkState.Instance.dispose ( )

Dispose of composeable instance.

Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.

◆ getConnection()

Connection Dragengine.Scenery.ECBehaviorNetworkState.Instance.getConnection ( )

Connection to server or null if not connected.

◆ getConnectionTracker()

ConnectionTracker Dragengine.Scenery.ECBehaviorNetworkState.Instance.getConnectionTracker ( )

Connection tracker or null if not connected.

◆ getECBehavior()

ECBehaviorNetworkState Dragengine.Scenery.ECBehaviorNetworkState.Instance.getECBehavior ( )

Behavior.

◆ getIsServer()

bool Dragengine.Scenery.ECBehaviorNetworkState.Instance.getIsServer ( )

Network state is the server state.

◆ getNetworkState()

NetworkState Dragengine.Scenery.ECBehaviorNetworkState.Instance.getNetworkState ( )

Network state or null if not tracked.

◆ getNetworkStateTracker()

NetworkStateTracker Dragengine.Scenery.ECBehaviorNetworkState.Instance.getNetworkStateTracker ( )

Network state tracker or null if not connected.

◆ getReadOnly()

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.

◆ init()

void Dragengine.Scenery.ECBehaviorNetworkState.Instance.init ( StubElement  stub)

Initialize element from stub.

Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.

◆ linkState() [1/2]

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.

◆ linkState() [2/2]

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.

◆ linkStateAllConnections()

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.

◆ messageReceived()

void Dragengine.Scenery.ECBehaviorNetworkState.Instance.messageReceived ( Connection  connection,
FileReader  message 
)

Process message received using ECBehaviorNetworkState.getMessageCode() .

◆ new()

Instance Dragengine.Scenery.ECBehaviorNetworkState.Instance.new ( ECBehaviorNetworkState  ecbehavior,
BehaviorElement  element 
)

Create element.

◆ onStateValueChanged()

void Dragengine.Scenery.ECBehaviorNetworkState.Instance.onStateValueChanged ( int  value)

State value changed on the remote side.

Called by StateUpdateListener only.

◆ readFromLinkMessage()

void Dragengine.Scenery.ECBehaviorNetworkState.Instance.readFromLinkMessage ( FileReader  reader)

Call readFromLinkMessage for all listeners.

◆ removeListener()

void Dragengine.Scenery.ECBehaviorNetworkState.Instance.removeListener ( Listener  listener)

Remove listener.

◆ sendMessage()

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.

◆ sendReliableMessage()

void Dragengine.Scenery.ECBehaviorNetworkState.Instance.sendReliableMessage ( int  message,
NetworkMessage  content 
)

Send reliable message.

◆ setMessageListener()

void Dragengine.Scenery.ECBehaviorNetworkState.Instance.setMessageListener ( int  message,
ValueListener  listener 
)

Set listener for message.

◆ setReadOnly()

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.

◆ setValueListener()

void Dragengine.Scenery.ECBehaviorNetworkState.Instance.setValueListener ( int  value,
ValueListener  listener 
)

Set listener for value.

◆ writeRequestLinkMessage()

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().


The documentation for this class was generated from the following file: