C# Класс UnitTests.NetworkClient

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
SERVER_IP string
matchID string
socket System.Net.Sockets.UdpClient
username string

Открытые методы

Метод Описание
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.

Описание методов

NetworkClient() публичный Метод

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
Результат System

OnApplicationQuit() публичный Метод

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
Результат void

SendInstruction() публичный Метод

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.
Результат void

Start() публичный Метод

Starts the new thread that will call the client to start.
public Start ( ) : void
Результат void

Описание свойств

SERVER_IP публичное свойство

The IP of the server. TODO: Change it eventually. (Should not be hardcoded to local).
public string SERVER_IP
Результат string

matchID публичное свойство

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
Результат string

socket публичное свойство

The socket for UDP.
public UdpClient,System.Net.Sockets socket
Результат System.Net.Sockets.UdpClient

username публичное свойство

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
Результат string