C# Класс Bricklayer.Client.Networking.NetworkManager

Provides a simple to use interface for sending/recieving Lidgren messages
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
Connect ( string host, int port ) : void

Connects to a given server.

CreateMessage ( ) : NetOutgoingMessage

Creates a NetOutgoingMessage from the interal Client object.

Disconnect ( string reason = "Bye" ) : void

Disconnects from the server.

Dispose ( ) : void

Disposes the NetworkManager

EncodeMessage ( IMessage gameMessage ) : NetOutgoingMessage

Writes an IMessage's packet ID and encodes it's data into a NetOutgoingMessage.

GetConnectionStats ( ) : NetConnectionStatistics

Gets the server connection's Statistics from the internal client

GetConnectionStatus ( ) : NetConnectionStatus

Gets the connection status from the internal client

GetPeerStats ( ) : NetPeerStatistics

Gets the client statistics from the internal client

GetPeerStatus ( ) : NetPeerStatus

Gets the client status from the internal client

ReadMessage ( ) : NetIncomingMessage

Reads the latest message in the queue.

Recycle ( NetIncomingMessage im ) : void

Recycles a message after processing by reusing it, reducing GC load

Send ( IMessage gameMessage ) : void

Sends and encodes an IMessage to the server.

Приватные методы

Метод Описание
Dispose ( bool disposing ) : void

Disposes the connection and disconnects from the server

Join ( string host, int port ) : void

Sends a message once connected to join a server officially.

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

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

Connects to a given server.
public Connect ( string host, int port ) : void
host string
port int
Результат void

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

Creates a NetOutgoingMessage from the interal Client object.
public CreateMessage ( ) : NetOutgoingMessage
Результат Lidgren.Network.NetOutgoingMessage

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

Disconnects from the server.
public Disconnect ( string reason = "Bye" ) : void
reason string Reason to tell the server for disconnecting.
Результат void

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

Disposes the NetworkManager
public Dispose ( ) : void
Результат void

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

Writes an IMessage's packet ID and encodes it's data into a NetOutgoingMessage.
public EncodeMessage ( IMessage gameMessage ) : NetOutgoingMessage
gameMessage IMessage
Результат Lidgren.Network.NetOutgoingMessage

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

Gets the server connection's Statistics from the internal client
public GetConnectionStats ( ) : NetConnectionStatistics
Результат Lidgren.Network.NetConnectionStatistics

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

Gets the connection status from the internal client
public GetConnectionStatus ( ) : NetConnectionStatus
Результат NetConnectionStatus

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

Gets the client statistics from the internal client
public GetPeerStats ( ) : NetPeerStatistics
Результат Lidgren.Network.NetPeerStatistics

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

Gets the client status from the internal client
public GetPeerStatus ( ) : NetPeerStatus
Результат NetPeerStatus

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

Reads the latest message in the queue.
public ReadMessage ( ) : NetIncomingMessage
Результат Lidgren.Network.NetIncomingMessage

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

Recycles a message after processing by reusing it, reducing GC load
public Recycle ( NetIncomingMessage im ) : void
im Lidgren.Network.NetIncomingMessage Message to recylce
Результат void

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

Sends and encodes an IMessage to the server.
public Send ( IMessage gameMessage ) : void
gameMessage IMessage IMessage to write ID and send.
Результат void