C# Class UnitTests.NetworkClient

Afficher le fichier Open project: Good4m/WindowsDefender Class Usage Examples

Méthodes publiques

Свойство Type Description
SERVER_IP string
matchID string
socket System.Net.Sockets.UdpClient
username string

Méthodes publiques

Méthode Description
NetworkClient ( string matchID, string username, string ip ) : System

The component that the game logic uses to creates the instance of our class.

OnApplicationQuit ( ) : void

Quits the client and closes the socket and stops the threads. Must have this otherwise Unity will freeze after running the application more than once.

SendInstruction ( Instruction command, string arg1 = "", string arg2 = "", string arg3 = "", string arg4 = "" ) : void

Sends an instruction to the server. It's in a lock (using monitor lock) to prevent multiple sending instructions at the same time.

Start ( ) : void

Starts the new thread that will call the client to start.

Method Details

NetworkClient() public méthode

The component that the game logic uses to creates the instance of our class.
public NetworkClient ( string matchID, string username, string ip ) : System
matchID string The MatchID of the client. It is 20 characters separated with a dash every 4 characters.
username string The username of the client.
ip string
Résultat System

OnApplicationQuit() public méthode

Quits the client and closes the socket and stops the threads. Must have this otherwise Unity will freeze after running the application more than once.
public OnApplicationQuit ( ) : void
Résultat void

SendInstruction() public méthode

Sends an instruction to the server. It's in a lock (using monitor lock) to prevent multiple sending instructions at the same time.
public SendInstruction ( Instruction command, string arg1 = "", string arg2 = "", string arg3 = "", string arg4 = "" ) : void
command WDClient.Instruction The type of instruction to send.
arg1 string An argument to pass along with the instruction.
arg2 string An argument to pass along with the instruction.
arg3 string An argument to pass along with the instruction.
arg4 string An argument to pass along with the instruction.
Résultat void

Start() public méthode

Starts the new thread that will call the client to start.
public Start ( ) : void
Résultat void

Property Details

SERVER_IP public_oe property

The IP of the server. TODO: Change it eventually. (Should not be hardcoded to local).
public string SERVER_IP
Résultat string

matchID public_oe property

The client's MatchID for the game. It is created in the web component of the application. TODO: Change it eventually. (Should not be hardcoded).
public string matchID
Résultat string

socket public_oe property

The socket for UDP.
public UdpClient,System.Net.Sockets socket
Résultat System.Net.Sockets.UdpClient

username public_oe property

The client's username for the game. It is created in the web component of the application. TODO: Change it eventually. (Should not be hardcoded).
public string username
Résultat string