C# Class LitDev.LDClient

ファイルを表示 Open project: litdev1/LitDev

Public Methods

Method Description
CheckServer ( Primitive server ) : Primitive

Test if a server is available for connection. Do not call this method at a high frequency (> 1 per second).

Connect ( Primitive server, Primitive auto ) : Primitive

Connect to a server.

Disconnect ( ) : Primitive

Disconnect the client from the server.

GetClients ( ) : Primitive

Get a list of current connected clients.

SendMessage ( Primitive message ) : Primitive

Send a message to the server.

UpdateDynamic ( Primitive data ) : Primitive

Update client data when using the auto message passing. This is for small quantities of frequently changing data, like sprite coordinates. this method uses the last updated client data stored on the client and is therefore fast.

UpdateStatic ( Primitive data ) : Primitive

Update client data when using the auto message passing. This is for larger quantities of infrequently changing data, like client configuration. This method uses data stored and retrieved from the server so may be slower than UpdateDynamic since it waits for server retreived data, guaranteeing that all client data is fully synced.

Private Methods

Method Description
Listen ( ) : void
Send ( string message ) : string
ServerMessageDelegate ( string message ) : void

Method Details

CheckServer() public static method

Test if a server is available for connection. Do not call this method at a high frequency (> 1 per second).
public static CheckServer ( Primitive server ) : Primitive
server Primitive The server connection ip:port (e.g. "192.168.1.60:100"). /// This value is returned by LDServer.Start.
return Primitive

Connect() public static method

Connect to a server.
public static Connect ( Primitive server, Primitive auto ) : Primitive
server Primitive The server connection ip:port (e.g. "192.168.1.60:100"). /// This value is returned by LDServer.Start.
auto Primitive Enable auto message passing "True" or "False". /// If this is used (recommended) then all client data is passed via server to all other clients, /// and no processing of send and receive events is required. /// The data is updated to arrays of data (indexed by client name) that is returned from the Update methods. /// The auto option should be the same for server and all clients.
return Primitive

Disconnect() public static method

Disconnect the client from the server.
public static Disconnect ( ) : Primitive
return Primitive

GetClients() public static method

Get a list of current connected clients.
public static GetClients ( ) : Primitive
return Primitive

SendMessage() public static method

Send a message to the server.
public static SendMessage ( Primitive message ) : Primitive
message Primitive The message may be any variable including an array.
return Primitive

UpdateDynamic() public static method

Update client data when using the auto message passing. This is for small quantities of frequently changing data, like sprite coordinates. this method uses the last updated client data stored on the client and is therefore fast.
public static UpdateDynamic ( Primitive data ) : Primitive
data Primitive The data for this client to propagate to other clients.
return Primitive

UpdateStatic() public static method

Update client data when using the auto message passing. This is for larger quantities of infrequently changing data, like client configuration. This method uses data stored and retrieved from the server so may be slower than UpdateDynamic since it waits for server retreived data, guaranteeing that all client data is fully synced.
public static UpdateStatic ( Primitive data ) : Primitive
data Primitive The data for this client to propagate to other clients.
return Primitive