Diarkis C# Client SDK
Public Member Functions | Static Public Attributes | Events | List of all members
Diarkis.Modules.Field Class Reference

Public Member Functions

delegate void ResponseHandler (List< byte[]> remoteMsgList)
 
delegate void SyncHandler (byte[] payload)
 
delegate void DisappearHandler (string uid)
 
delegate void ReconnectHandler ()
 
delegate void ServerSyncHandler (bool inSight, byte[] payload)
 
bool SetupAsTcp (Tcp tcp)
 Sets up the instance of as a TCP client. More...
 
bool SetupAsUdp (Udp udp)
 Sets up the instance of as a UDP client. More...
 
void Disappear ()
 Notifies other clients in view that the client is now disappeared. Triggers Field.OnDisappear. More...
 
void SyncInit (long x, long y, long z, uint syncLimit, uint customFilterID, byte[] msg)
 Initial sync to the other clients in view. This also raises OnSyncInit event to receive remote client messages that are within the field of view. More...
 
void Sync (long x, long y, long z, uint syncLimit, uint customFilterID, byte[] msg, bool reliable=true)
 Sync the client's position This raises OnSync event on the remote clients that are within the field of view. More...
 
void OnCustomBroadcast (uint ver, uint cmd, Action< byte[]> callback)
 Registers a callback on custom broadcast by ver and cmd. Must be callback AFTER field.SetupAsUdp or field.SetupAsTcp More...
 

Static Public Attributes

const uint STATUS_OK = 1
 
const uint BUILTIN_CMD_VER = 1
 
const uint SYNC_INIT_CMD = 120
 
const uint SYNC_CMD = 121
 
const uint DISAPPEAR_CMD = 123
 
const uint SERVER_SYNC_CMD = 124
 

Events

ResponseHandler OnResponseSyncInit
 The event raised as a server response of SyncInit. More...
 
SyncHandler OnSync
 The event is raised when a remote client that is in the field of view sends a message via Sync. More...
 
DisappearHandler OnDisappear
 The event is raised when a remote client that is in the field of view is no longer visible. The event is raised when a remote client invokes Disappear also. More...
 
ReconnectHandler OnReconnect
 The event is raised when the client auto-reconnect due to server autoscaling. In order to maintain the synchronization of the client, invok Sync() when the event is raised. More...
 
ServerSyncHandler OnServerSync
 This event is raised by server only. When the server sends field.ServerSync, it triggers OnServerSync event to be raised. This event is meant to synchoronize custom entity or data (such as NPC etc.) that is encapsulated in the payload byte array. More...
 

Detailed Description

Field allows you to "see" other clients in view and exchange packets with them freely.

Member Function Documentation

◆ Disappear()

void Diarkis.Modules.Field.Disappear ( )
inline

Notifies other clients in view that the client is now disappeared. Triggers Field.OnDisappear.

◆ OnCustomBroadcast()

void Diarkis.Modules.Field.OnCustomBroadcast ( uint  ver,
uint  cmd,
Action< byte[]>  callback 
)
inline

Registers a callback on custom broadcast by ver and cmd. Must be callback AFTER field.SetupAsUdp or field.SetupAsTcp

Parameters
verCustom command version to listen to.
cmdCustom command ID to listen to.
callbackCallback method to be invoked on targeted ver and cmd.

◆ SetupAsTcp()

bool Diarkis.Modules.Field.SetupAsTcp ( Tcp  tcp)
inline

Sets up the instance of as a TCP client.

Parameters
tcpAn instance of Tcp

◆ SetupAsUdp()

bool Diarkis.Modules.Field.SetupAsUdp ( Udp  udp)
inline

Sets up the instance of as a UDP client.

Parameters
udpAn instance of Udp

◆ Sync()

void Diarkis.Modules.Field.Sync ( long  x,
long  y,
long  z,
uint  syncLimit,
uint  customFilterID,
byte[]  msg,
bool  reliable = true 
)
inline

Sync the client's position This raises OnSync event on the remote clients that are within the field of view.

Parameters
xX position of the client.
yY position of the client.
zZ is considered as an "area". For example: different floors of a building etc.
syncLimitMaximum number of other clients in view to sync with.
customFilerIDIndicagtes the usage of custom defined (on the server) filter function when synching. Give 0 to use no filter functions.
msgMessage to be sent to the clients in view.

◆ SyncInit()

void Diarkis.Modules.Field.SyncInit ( long  x,
long  y,
long  z,
uint  syncLimit,
uint  customFilterID,
byte[]  msg 
)
inline

Initial sync to the other clients in view. This also raises OnSyncInit event to receive remote client messages that are within the field of view.

Parameters
xX position of the client.
yY position of the client.
zZ is considered as an "area". For example: different floors of a building etc.
syncLimitMaximum number of other clients in view to sync with.
customFilerIDIndicates the usage of custom defined (on the server) filter function when synching. Give 0 to use no filter functions.
msgMessage to be sent to the clients in view.

Event Documentation

◆ OnDisappear

DisappearHandler Diarkis.Modules.Field.OnDisappear

The event is raised when a remote client that is in the field of view is no longer visible. The event is raised when a remote client invokes Disappear also.

Parameters
uidUser ID of the remote client that is no longer visible.

◆ OnReconnect

ReconnectHandler Diarkis.Modules.Field.OnReconnect

The event is raised when the client auto-reconnect due to server autoscaling. In order to maintain the synchronization of the client, invok Sync() when the event is raised.

◆ OnResponseSyncInit

ResponseHandler Diarkis.Modules.Field.OnResponseSyncInit

The event raised as a server response of SyncInit.

Parameters
remoteMsgListA list of message byte arrays of remote clients that are in the field of view.

◆ OnServerSync

ServerSyncHandler Diarkis.Modules.Field.OnServerSync

This event is raised by server only. When the server sends field.ServerSync, it triggers OnServerSync event to be raised. This event is meant to synchoronize custom entity or data (such as NPC etc.) that is encapsulated in the payload byte array.

Parameters
inSightIf true, the custom entity or data received is within the field of vision.
payloadCustom entity or data sent from the server to synchronize.

◆ OnSync

SyncHandler Diarkis.Modules.Field.OnSync

The event is raised when a remote client that is in the field of view sends a message via Sync.

Parameters
payloadA message byte array from the remote client that is in the field of view.

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