C# 클래스 Bricklayer.Server.NetworkManager

Handles network functions for the server, such as port-forwarding, sending messages, etc Send Function Guide: Send: Sends a message to a player Broadcast: Sends a message to each player in a map Global: Sends a message to each player on the server
파일 보기 프로젝트 열기: Cyral/Bricklayer 1 사용 예제들

공개 메소드들

메소드 설명
Broadcast ( Map map, IMessage gameMessage ) : void

Broadcasts a message to all players in a room

BroadcastExcept ( IMessage gameMessage, Bricklayer.Server.Entities.Player player ) : void

Broadcasts a message to all players in a room, EXCEPT for the one specified

BroadcastExcept ( IMessage gameMessage, NetConnection recipient ) : void

Broadcasts a message to all clients in a room, EXCEPT for the one specified

CreateMessage ( ) : NetOutgoingMessage

Creates a NetOutgoingMessage from the interal Server object

Dispose ( ) : void

Disposes the NetworkManager

EncodeMessage ( IMessage gameMessage ) : NetOutgoingMessage

Encodes a message with a packet ID so the client can identify what kind of message it is

GetQuery ( ) : Bricklayer.Client.Networking.ServerPingData

Creates and returns a query for a client request, with info like MOTD, online players, etc

Global ( IMessage gameMessage ) : void

Sends a message to all players connected to the server

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, Bricklayer.Server.Entities.Player player ) : void

Encodes and sends a message to a specified player

Send ( IMessage gameMessage, NetConnection recipient ) : void

Encodes and sends a message to a specified NetConnection recipient

Shutdown ( string reason = "Shutting Down" ) : void

Shuts down the server and disconnects clients

Start ( int port, int maxconnections ) : void

Starts the server connection

비공개 메소드들

메소드 설명
Dispose ( bool disposing ) : void

Disposes the connection and shuts down the server

메소드 상세

Broadcast() 공개 메소드

Broadcasts a message to all players in a room
public Broadcast ( Map map, IMessage gameMessage ) : void
map Bricklayer.Client.World.Map Map/Room to send to
gameMessage IMessage IMessage to send
리턴 void

BroadcastExcept() 공개 메소드

Broadcasts a message to all players in a room, EXCEPT for the one specified
public BroadcastExcept ( IMessage gameMessage, Bricklayer.Server.Entities.Player player ) : void
gameMessage IMessage IMessage to send
player Bricklayer.Server.Entities.Player Player NOT to send to
리턴 void

BroadcastExcept() 공개 메소드

Broadcasts a message to all clients in a room, EXCEPT for the one specified
public BroadcastExcept ( IMessage gameMessage, NetConnection recipient ) : void
gameMessage IMessage IMessage to send
recipient Lidgren.Network.NetConnection Client NOT to send to
리턴 void

CreateMessage() 공개 메소드

Creates a NetOutgoingMessage from the interal Server object
public CreateMessage ( ) : NetOutgoingMessage
리턴 Lidgren.Network.NetOutgoingMessage

Dispose() 공개 메소드

Disposes the NetworkManager
public Dispose ( ) : void
리턴 void

EncodeMessage() 공개 메소드

Encodes a message with a packet ID so the client can identify what kind of message it is
public EncodeMessage ( IMessage gameMessage ) : NetOutgoingMessage
gameMessage IMessage A message to encode
리턴 Lidgren.Network.NetOutgoingMessage

GetQuery() 공개 메소드

Creates and returns a query for a client request, with info like MOTD, online players, etc
public GetQuery ( ) : Bricklayer.Client.Networking.ServerPingData
리턴 Bricklayer.Client.Networking.ServerPingData

Global() 공개 메소드

Sends a message to all players connected to the server
public Global ( IMessage gameMessage ) : void
gameMessage IMessage IMessage to send
리턴 void

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() 공개 메소드

Encodes and sends a message to a specified player
public Send ( IMessage gameMessage, Bricklayer.Server.Entities.Player player ) : void
gameMessage IMessage IMessage to send
player Bricklayer.Server.Entities.Player Player to send to
리턴 void

Send() 공개 메소드

Encodes and sends a message to a specified NetConnection recipient
public Send ( IMessage gameMessage, NetConnection recipient ) : void
gameMessage IMessage IMessage to send
recipient Lidgren.Network.NetConnection Client to send to
리턴 void

Shutdown() 공개 메소드

Shuts down the server and disconnects clients
public Shutdown ( string reason = "Shutting Down" ) : void
reason string Reason for shutting down
리턴 void

Start() 공개 메소드

Starts the server connection
public Start ( int port, int maxconnections ) : void
port int Port to run on
maxconnections int Maximum clients connectable
리턴 void