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

Public Member Functions

delegate void ResponseHandler (List< byte[]> remoteMsgList)
 
delegate void SyncHandler (byte[] payload)
 
delegate void DisappearHandler (string uid)
 
delegate void ReconnectHandler (bool success)
 
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...
 
virtual void Disappear ()
 Notifies other clients in view that the client is now disappeared. Triggers Field.OnDisappear. More...
 
virtual 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...
 
virtual 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

virtual ResponseHandler OnResponseSyncInit
 The event raised as a server response of SyncInit. More...
 
virtual SyncHandler OnSync
 The event is raised when a remote client that is in the field of view sends a message via Sync. More...
 
virtual 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...
 
virtual 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...
 
virtual 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()

virtual void Diarkis.Modules.Field.Disappear ( )
inlinevirtual

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

Reimplemented in Diarkis.Modules.WsField.

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

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

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.

Reimplemented in Diarkis.Modules.WsField.

◆ SyncInit()

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

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.

Reimplemented in Diarkis.Modules.WsField.

Event Documentation

◆ OnDisappear

virtual 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

virtual 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

virtual 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

virtual 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

virtual 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: