TNet 3  3.0.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros
TNet.TNObject Class Reference

Tasharen Network Object makes it possible to easily send and receive remote function calls. Unity networking calls this type of object a "Network View". More...

Inheritance diagram for TNet.TNObject:

Public Member Functions

delegate void OnDestroyCallback ()
 
delegate void OnTransfer (int newChannel, uint newID)
 
Get< T > (string name)
 Get the object-specific data. More...
 
Get< T > (string name, T defVal)
 Get the object-specific data. More...
 
void Set (string name, object val)
 Set the object-specific data. More...
 
delegate void OnDataChanged (DataNode data)
 
void DestroySelf ()
 Destroy this game object on all connected clients and remove it from the server. More...
 
void DestroySelf (float delay, bool onlyIfOwner=true)
 Destroy this game object on all connected clients and remove it from the server. More...
 
void Register ()
 Register the network object with the lists. More...
 
bool Execute (byte funcID, params object[] parameters)
 Invoke the function specified by the ID. More...
 
bool Execute (string funcName, params object[] parameters)
 Invoke the function specified by the function name. More...
 
void Send (byte rfcID, Target target, params object[] objs)
 Send a remote function call. More...
 
void Send (byte rfcID, string targetName, params object[] objs)
 Send a remote function call. Note that you should not use this version of the function if you care about performance (as it's much slower than others), or if players can have duplicate names, as only one of them will actually receive this message. More...
 
void Send (string rfcName, Target target, params object[] objs)
 Send a remote function call. More...
 
void Send (string rfcName, string targetName, params object[] objs)
 Send a remote function call. Note that you should not use this version of the function if you care about performance (as it's much slower than others), or if players can have duplicate names, as only one of them will actually receive this message. More...
 
void Send (byte rfcID, Player target, params object[] objs)
 Send a remote function call. More...
 
void Send (string rfcName, Player target, params object[] objs)
 Send a remote function call. More...
 
void Send (byte rfcID, int playerID, params object[] objs)
 Send a remote function call. More...
 
void Send (string rfcName, int playerID, params object[] objs)
 Send a remote function call. More...
 
void SendQuickly (byte rfcID, Target target, params object[] objs)
 Send a remote function call via UDP (if possible). More...
 
void SendQuickly (string rfcName, Target target, params object[] objs)
 Send a remote function call via UDP (if possible). More...
 
void SendQuickly (byte rfcID, Player target, params object[] objs)
 Send a remote function call via UDP (if possible). More...
 
void SendQuickly (string rfcName, Player target, params object[] objs)
 Send a remote function call via UDP (if possible). More...
 
void BroadcastToLAN (int port, byte rfcID, params object[] objs)
 Send a broadcast to the entire LAN. Does not require an active connection. More...
 
void BroadcastToLAN (int port, string rfcName, params object[] objs)
 Send a broadcast to the entire LAN. Does not require an active connection. More...
 
void RemoveSavedRFC (string rfcName)
 Remove a previously saved remote function call. More...
 
void RemoveSavedRFC (byte rfcID)
 Remove a previously saved remote function call. More...
 
void Remove (string rfcName)
 Remove a previously saved remote function call. More...
 
void Remove (byte rfcID)
 Remove a previously saved remote function call. More...
 
void TransferToChannel (int newChannelID)
 Transfer this object to another channel. Only the object's owner can perform this action. Note that if the object has a nested TNObject hierarchy, newly entered clients won't see this hierarchy. It's up to you, the developer, to set the hierarchy if you need it. You can do it by setting a custom RFC with the hierarchy path (or simply the TNObject parent ID) before calling TransferToChannel. More...
 

Static Public Member Functions

static TNObject Find (int channelID, uint tnID)
 Retrieve the Tasharen Network Object by ID. More...
 
static uint GetUniqueID (bool isDynamic)
 Get a new unique object identifier. More...
 
static void FindAndExecute (int channelID, uint objID, byte funcID, params object[] parameters)
 Invoke the specified function. It's unlikely that you will need to call this function yourself. More...
 
static void FindAndExecute (int channelID, uint objID, string funcName, params object[] parameters)
 Invoke the specified function. It's unlikely that you will need to call this function yourself. More...
 
static void DecodeUID (uint uid, out uint objID, out byte rfcID)
 Decode object ID and RFC IDs encoded in a single UINT. More...
 

Public Attributes

bool ignoreWarnings = false
 If set to 'true', missing RFCs won't produce warning messages. More...
 
int channelID = 0
 ID of the channel this TNObject belongs to. More...
 
bool rebuildMethodList = true
 When set to 'true', it will cause the list of remote function calls to be rebuilt next time they're needed. More...
 
OnDestroyCallback onDestroy
 If you want to know when this object is getting destroyed, subscribe to this delegate. This delegate is guaranteed to be called before OnDestroy() notifications get sent out. This is useful if you want parts of the object to remain behind (such as buggy Unity 4 cloth). More...
 
OnTransfer onTransfer
 Delegate called when the object is being transferred to another channel. More...
 
OnDataChanged onDataChanged
 Callback triggered the the object's get/set data changes. More...
 
bool ignoreDestroyCall = false
 Set this to 'true' if you plan on destroying the object yourself and don't want it to be destroyed immediately after onDestroy has been called. This is useful if you want to destroy the object yourself after performing some action such as fracturing it into pieces. More...
 

Properties

uint uid [get, set]
 Object's unique identifier (Static object IDs range 1 to 32767. Dynamic object IDs range from 32,768 to 16,777,215). More...
 
TNObject parent [get]
 TNObject's parent, if it has any. More...
 
bool isJoiningChannel [get]
 Whether the player is currently joining this object's channel. More...
 
bool hasBeenDestroyed [get]
 Whether the object has been destroyed. It can happen when the object has been requested to be transferred to another channel, but has not yet completed the operation. More...
 
bool hasBeenRegistered [get]
 An object gets marked as registered after the creation call has completed and the object's ID has been assigned. More...
 
bool isMine [get]
 Whether this object belongs to the player. More...
 
int ownerID [get]
 ID of the player that owns this object. More...
 
Player owner [get]
 ID of the player that owns this object. More...
 
DataNode dataNode [get, set]
 Object's DataNode synchronized using TNObject.Set commands. It's better to retrieve data using TNObject.Get instead of checking the node directly. Note that setting the entire data node is only possible during the object creation (RCC). After that the individual Set functions should be used. More...
 

Detailed Description

Tasharen Network Object makes it possible to easily send and receive remote function calls. Unity networking calls this type of object a "Network View".

Member Function Documentation

void TNet.TNObject.BroadcastToLAN ( int  port,
byte  rfcID,
params object[]  objs 
)

Send a broadcast to the entire LAN. Does not require an active connection.

void TNet.TNObject.BroadcastToLAN ( int  port,
string  rfcName,
params object[]  objs 
)

Send a broadcast to the entire LAN. Does not require an active connection.

static void TNet.TNObject.DecodeUID ( uint  uid,
out uint  objID,
out byte  rfcID 
)
static

Decode object ID and RFC IDs encoded in a single UINT.

void TNet.TNObject.DestroySelf ( )

Destroy this game object on all connected clients and remove it from the server.

void TNet.TNObject.DestroySelf ( float  delay,
bool  onlyIfOwner = true 
)

Destroy this game object on all connected clients and remove it from the server.

bool TNet.TNObject.Execute ( byte  funcID,
params object[]  parameters 
)

Invoke the function specified by the ID.

bool TNet.TNObject.Execute ( string  funcName,
params object[]  parameters 
)

Invoke the function specified by the function name.

static TNObject TNet.TNObject.Find ( int  channelID,
uint  tnID 
)
static

Retrieve the Tasharen Network Object by ID.

static void TNet.TNObject.FindAndExecute ( int  channelID,
uint  objID,
byte  funcID,
params object[]  parameters 
)
static

Invoke the specified function. It's unlikely that you will need to call this function yourself.

static void TNet.TNObject.FindAndExecute ( int  channelID,
uint  objID,
string  funcName,
params object[]  parameters 
)
static

Invoke the specified function. It's unlikely that you will need to call this function yourself.

T TNet.TNObject.Get< T > ( string  name)

Get the object-specific data.

T TNet.TNObject.Get< T > ( string  name,
defVal 
)

Get the object-specific data.

static uint TNet.TNObject.GetUniqueID ( bool  isDynamic)
static

Get a new unique object identifier.

delegate void TNet.TNObject.OnDataChanged ( DataNode  data)
delegate void TNet.TNObject.OnDestroyCallback ( )
delegate void TNet.TNObject.OnTransfer ( int  newChannel,
uint  newID 
)
void TNet.TNObject.Register ( )

Register the network object with the lists.

void TNet.TNObject.Remove ( string  rfcName)

Remove a previously saved remote function call.

void TNet.TNObject.Remove ( byte  rfcID)

Remove a previously saved remote function call.

void TNet.TNObject.RemoveSavedRFC ( string  rfcName)

Remove a previously saved remote function call.

void TNet.TNObject.RemoveSavedRFC ( byte  rfcID)

Remove a previously saved remote function call.

void TNet.TNObject.Send ( byte  rfcID,
Target  target,
params object[]  objs 
)

Send a remote function call.

void TNet.TNObject.Send ( byte  rfcID,
string  targetName,
params object[]  objs 
)

Send a remote function call. Note that you should not use this version of the function if you care about performance (as it's much slower than others), or if players can have duplicate names, as only one of them will actually receive this message.

void TNet.TNObject.Send ( string  rfcName,
Target  target,
params object[]  objs 
)

Send a remote function call.

void TNet.TNObject.Send ( string  rfcName,
string  targetName,
params object[]  objs 
)

Send a remote function call. Note that you should not use this version of the function if you care about performance (as it's much slower than others), or if players can have duplicate names, as only one of them will actually receive this message.

void TNet.TNObject.Send ( byte  rfcID,
Player  target,
params object[]  objs 
)

Send a remote function call.

void TNet.TNObject.Send ( string  rfcName,
Player  target,
params object[]  objs 
)

Send a remote function call.

void TNet.TNObject.Send ( byte  rfcID,
int  playerID,
params object[]  objs 
)

Send a remote function call.

void TNet.TNObject.Send ( string  rfcName,
int  playerID,
params object[]  objs 
)

Send a remote function call.

void TNet.TNObject.SendQuickly ( byte  rfcID,
Target  target,
params object[]  objs 
)

Send a remote function call via UDP (if possible).

void TNet.TNObject.SendQuickly ( string  rfcName,
Target  target,
params object[]  objs 
)

Send a remote function call via UDP (if possible).

void TNet.TNObject.SendQuickly ( byte  rfcID,
Player  target,
params object[]  objs 
)

Send a remote function call via UDP (if possible).

void TNet.TNObject.SendQuickly ( string  rfcName,
Player  target,
params object[]  objs 
)

Send a remote function call via UDP (if possible).

void TNet.TNObject.Set ( string  name,
object  val 
)

Set the object-specific data.

void TNet.TNObject.TransferToChannel ( int  newChannelID)

Transfer this object to another channel. Only the object's owner can perform this action. Note that if the object has a nested TNObject hierarchy, newly entered clients won't see this hierarchy. It's up to you, the developer, to set the hierarchy if you need it. You can do it by setting a custom RFC with the hierarchy path (or simply the TNObject parent ID) before calling TransferToChannel.

Member Data Documentation

int TNet.TNObject.channelID = 0

ID of the channel this TNObject belongs to.

bool TNet.TNObject.ignoreDestroyCall = false

Set this to 'true' if you plan on destroying the object yourself and don't want it to be destroyed immediately after onDestroy has been called. This is useful if you want to destroy the object yourself after performing some action such as fracturing it into pieces.

bool TNet.TNObject.ignoreWarnings = false

If set to 'true', missing RFCs won't produce warning messages.

OnDataChanged TNet.TNObject.onDataChanged

Callback triggered the the object's get/set data changes.

OnDestroyCallback TNet.TNObject.onDestroy

If you want to know when this object is getting destroyed, subscribe to this delegate. This delegate is guaranteed to be called before OnDestroy() notifications get sent out. This is useful if you want parts of the object to remain behind (such as buggy Unity 4 cloth).

OnTransfer TNet.TNObject.onTransfer

Delegate called when the object is being transferred to another channel.

bool TNet.TNObject.rebuildMethodList = true

When set to 'true', it will cause the list of remote function calls to be rebuilt next time they're needed.

Property Documentation

DataNode TNet.TNObject.dataNode
getset

Object's DataNode synchronized using TNObject.Set commands. It's better to retrieve data using TNObject.Get instead of checking the node directly. Note that setting the entire data node is only possible during the object creation (RCC). After that the individual Set functions should be used.

bool TNet.TNObject.hasBeenDestroyed
get

Whether the object has been destroyed. It can happen when the object has been requested to be transferred to another channel, but has not yet completed the operation.

bool TNet.TNObject.hasBeenRegistered
get

An object gets marked as registered after the creation call has completed and the object's ID has been assigned.

bool TNet.TNObject.isJoiningChannel
get

Whether the player is currently joining this object's channel.

bool TNet.TNObject.isMine
get

Whether this object belongs to the player.

Player TNet.TNObject.owner
get

ID of the player that owns this object.

int TNet.TNObject.ownerID
get

ID of the player that owns this object.

TNObject TNet.TNObject.parent
get

TNObject's parent, if it has any.

uint TNet.TNObject.uid
getset

Object's unique identifier (Static object IDs range 1 to 32767. Dynamic object IDs range from 32,768 to 16,777,215).


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