C# 클래스 UnitTests.NetworkClient

파일 보기 프로젝트 열기: Good4m/WindowsDefender 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
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