C# Класс BeardedManStudios.Network.ForgeMasterServer

Наследование: UnityEngine.MonoBehaviour
Показать файл Открыть проект

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

Свойство Тип Описание
natComplete bool

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

Метод Описание
GetHosts ( string host, ushort pageNumber, Action callback ) : void

This method requests all of the hosts from the master server

PullNatRequest ( string ip, ushort port, ushort internalPort, string requestHost, ushort requestPort ) : void

This method is used on the server to attempt to connect through the NAT hole punch server to the client

RegisterNat ( CrossPlatformUDP socket, ushort port, string proxyHost, ushort proxyPort = PORT ) : void

This method is used to allow a server to register itself with the NAT hole punching server

RegisterNatRequest ( string ip, ushort port, ushort internalPort ) : void
RegisterServer ( string host, ushort port, int maxPlayers, string name, string gameType = "", string comment = "", string password = "", string sceneName = "" ) : void

This method is used to register a server to the master server to be retreived by clients

RequestNat ( CrossPlatformUDP socket, ushort port, string requestHost, ushort requestPort, string proxyHost, ushort proxyPort = PORT ) : bool

This method is used on the client to attempt to connect to the server through the NAT hole punch server

SetIp ( string ip ) : void
UnRegisterServer ( string host, ushort port ) : void

This method is used to manually unregister a server. If a server aborts the master server will automatically remove it

UpdateServer ( string host, ushort port, int playerCount ) : void

This method is used to update the current player count on the master server for this server

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

Метод Описание
Awake ( ) : void
GetHostsRequestToClient ( NetworkingPlayer sender, NetworkingStream stream ) : void
GetHostsRequestToServer ( NetworkingPlayer sender, NetworkingStream stream ) : void
OnApplicationQuit ( ) : void
PingHosts ( ) : void
PingRecieved ( string ip ) : void
RegisterServerRequest ( NetworkingPlayer sender, NetworkingStream stream ) : void
Request ( string host, Action call ) : void
Start ( ) : void
StartServer ( ) : void

This method is called when the host server button is clicked

UnRegisterServerRequest ( NetworkingPlayer sender, NetworkingStream stream ) : void
UpdateServerRequest ( NetworkingPlayer sender, NetworkingStream stream ) : void

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

GetHosts() публичный статический Метод

This method requests all of the hosts from the master server
public static GetHosts ( string host, ushort pageNumber, Action callback ) : void
host string The host of the master server
pageNumber ushort This is the page number (starting from 0). So if you want to get entries 0-n then you will pass 0, if you want n-n+n then pass 1
callback Action This is the method that will be called once the master server responds with the host list
Результат void

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

This method is used on the server to attempt to connect through the NAT hole punch server to the client
public PullNatRequest ( string ip, ushort port, ushort internalPort, string requestHost, ushort requestPort ) : void
ip string This is the ip address of the NAT hole punch server
port ushort This is the port number of the NAT hole punch server
internalPort ushort This is the internal port of the client that this server is trying to communicate with
requestHost string This is the client host address that this server is trying to communicate with
requestPort ushort This is the client port number that this server is trying to communicate with
Результат void

RegisterNat() публичный статический Метод

This method is used to allow a server to register itself with the NAT hole punching server
public static RegisterNat ( CrossPlatformUDP socket, ushort port, string proxyHost, ushort proxyPort = PORT ) : void
socket CrossPlatformUDP This is the socket that is being used for the communication with the clients
port ushort The port number that is being used for this server
proxyHost string The ip address of the the NAT hole punching (router) server
proxyPort ushort The port number for the NAT hole punch server
Результат void

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

public RegisterNatRequest ( string ip, ushort port, ushort internalPort ) : void
ip string
port ushort
internalPort ushort
Результат void

RegisterServer() публичный статический Метод

This method is used to register a server to the master server to be retreived by clients
public static RegisterServer ( string host, ushort port, int maxPlayers, string name, string gameType = "", string comment = "", string password = "", string sceneName = "" ) : void
host string The master server host address
port ushort The port that this server will be running on
maxPlayers int The maximum amount of players allowed on this server
name string The name for this server
gameType string The type of game for this server (ie. deathmatch, capture the flag, etc.)
comment string The comment for this server (usually user populated for loading screens)
password string The password for this server
sceneName string The scene name that this server is currently on
Результат void

RequestNat() публичный статический Метод

This method is used on the client to attempt to connect to the server through the NAT hole punch server
public static RequestNat ( CrossPlatformUDP socket, ushort port, string requestHost, ushort requestPort, string proxyHost, ushort proxyPort = PORT ) : bool
socket CrossPlatformUDP This is the socket that is being used for the communication with the server
port ushort This is the port number that this client is bound to
requestHost string This is the host address of the server that this client is trying to connect to
requestPort ushort This is the host port of the server that this client is trying to connect to
proxyHost string This is the NAT hole punch server host address
proxyPort ushort This is the NAT hole punch server port number
Результат bool

SetIp() публичный статический Метод

public static SetIp ( string ip ) : void
ip string
Результат void

UnRegisterServer() публичный статический Метод

This method is used to manually unregister a server. If a server aborts the master server will automatically remove it
public static UnRegisterServer ( string host, ushort port ) : void
host string The host of the master server
port ushort The port that this server was running on
Результат void

UpdateServer() публичный статический Метод

This method is used to update the current player count on the master server for this server
public static UpdateServer ( string host, ushort port, int playerCount ) : void
host string The host of the master server
port ushort The port number that this server is running on
playerCount int The current player count for this server
Результат void

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

natComplete публичное статическое свойство

public static bool natComplete
Результат bool