C# 클래스 UnityEngine.Networking.NetworkServer

High level UNET server.

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

공개 메소드들

메소드 설명
AddExternalConnection ( NetworkConnection conn ) : bool

This accepts a network connection from another external source and adds it to the server.

AddPlayerForConnection ( NetworkConnection conn, GameObject player, short playerControllerId ) : bool

When an AddPlayer message handler has received a request from a player, the server calls this to associate the player object with the connection.

AddPlayerForConnection ( NetworkConnection conn, GameObject player, short playerControllerId, NetworkHash128 assetId ) : bool
BecomeHost ( NetworkClient oldClient, int port, MatchInfo matchInfo, int oldConnectionId, PeerInfoMessage peers ) : NetworkClient
ClearHandlers ( ) : void

Clear all registered callback handlers.

ClearLocalObjects ( ) : void

This clears all of the networked objects that the server is aware of. This can be required if a scene change deleted all of the objects without destroying them in the normal manner.

ClearSpawners ( ) : void

Clears all registered spawn prefab and spawn handler functions for this server.

Configure ( ConnectionConfig config, int maxConnections ) : bool

This configures the transport layer settings for the server.

Configure ( HostTopology topology ) : bool

This configures the transport layer settings for the server.

Destroy ( GameObject obj ) : void

Destroys this object and corresponding objects on all clients.

DestroyPlayersForConnection ( NetworkConnection conn ) : void

This destroys all the player objects associated with a NetworkConnections on a server.

DisconnectAll ( ) : void

Disconnect all currently connected clients.

FindLocalObject ( NetworkInstanceId netId ) : GameObject

This finds the local NetworkIdentity object with the specified network Id.

GetConnectionStats ( ) : NetworkConnection.PacketStat>.Dictionary

Gets aggregate packet stats for all connections.

GetStatsIn ( int &numMsgs, int &numBytes ) : void
GetStatsOut ( int &numMsgs, int &numBufferedMsgs, int &numBytes, int &lastBufferedPerSecond ) : void
Listen ( MatchInfo matchInfo, int listenPort ) : bool
Listen ( int serverPort ) : bool

Start the server on the given port number. Note that if a match has been created, this will listen using the Relay server instead of a local socket.

Listen ( string ipAddress, int serverPort ) : bool

Start the server on the given port number. Note that if a match has been created, this will listen using the Relay server instead of a local socket.

ListenRelay ( string relayIp, int relayPort, NetworkID netGuid, SourceID sourceId, NodeID nodeId ) : void

Starts a server using a Relay server. This is the manual way of using the Relay server, as the regular NetworkServer.Connect() will automatically use the Relay server if a match exists.

RegisterHandler ( short msgType, NetworkMessageDelegate handler ) : void

Register a handler for a particular message type.

비공개 메소드들

메소드 설명
ActivateLocalClientScene ( ) : void
AddExternalConnectionInternal ( NetworkConnection conn ) : bool
AddLocalClient ( LocalClient localClient ) : int
BecomeHostInternal ( NetworkClient oldClient, int port, MatchInfo matchInfo, int oldConnectionId, PeerInfoMessage peers ) : NetworkClient
CheckForNullObjects ( ) : void
CheckPlayerControllerIdForConnection ( NetworkConnection conn, short playerControllerId ) : bool
DestroyObject ( GameObject obj ) : void
DestroyObject ( NetworkIdentity uv, bool destroyServerObject ) : void
FinishPlayerForConnection ( NetworkConnection conn, NetworkIdentity uv, GameObject playerGameObject ) : void
GenerateConnectError ( int error ) : void
GenerateDataError ( NetworkConnection conn, int error ) : void
GenerateDisconnectError ( NetworkConnection conn, int error ) : void
GenerateError ( NetworkConnection conn, int error ) : void
GetNetworkIdentity ( GameObject go, NetworkIdentity &view ) : bool
HideForConnection ( NetworkIdentity uv, NetworkConnection conn ) : void
InternalAddPlayerForConnection ( NetworkConnection conn, GameObject playerGameObject, short playerControllerId ) : bool
InternalDisconnectAll ( ) : void
InternalListen ( string ipAddress, int serverPort ) : bool
InternalListenRelay ( string relayIp, int relayPort, NetworkID netGuid, SourceID sourceId, NodeID nodeId ) : void
InternalReplacePlayerForConnection ( NetworkConnection conn, GameObject playerGameObject, short playerControllerId ) : bool
InternalSetClientNotReady ( NetworkConnection conn ) : void
InternalSetMaxDelay ( float seconds ) : void
InternalUpdate ( ) : void
InvokeBytes ( ULocalConnectionToServer conn, byte buffer, int numBytes, int channelId ) : bool
InvokeHandlerOnServer ( ULocalConnectionToServer conn, short msgType, MessageBase msg, int channelId ) : bool
NetworkServer ( ) : System
OnClientReadyMessage ( NetworkMessage netMsg ) : void
OnCommandMessage ( NetworkMessage netMsg ) : void
OnConnected ( NetworkConnection conn ) : void
OnData ( NetworkConnection conn, int receivedSize, int channelId ) : void
OnDisconnected ( NetworkConnection conn ) : void
OnRemovePlayerMessage ( NetworkMessage netMsg ) : void
RegisterMessageHandlers ( ) : void

메소드 상세

AddExternalConnection() 공개 정적인 메소드

This accepts a network connection from another external source and adds it to the server.

public static AddExternalConnection ( NetworkConnection conn ) : bool
conn NetworkConnection Network connection to add.
리턴 bool

AddPlayerForConnection() 공개 정적인 메소드

When an AddPlayer message handler has received a request from a player, the server calls this to associate the player object with the connection.

public static AddPlayerForConnection ( NetworkConnection conn, GameObject player, short playerControllerId ) : bool
conn NetworkConnection Connection which is adding the player.
player UnityEngine.GameObject Player object spawned for the player.
playerControllerId short The player controller ID number as specified by client.
리턴 bool

AddPlayerForConnection() 공개 정적인 메소드

public static AddPlayerForConnection ( NetworkConnection conn, GameObject player, short playerControllerId, NetworkHash128 assetId ) : bool
conn NetworkConnection
player UnityEngine.GameObject
playerControllerId short
assetId NetworkHash128
리턴 bool

BecomeHost() 공개 정적인 메소드

public static BecomeHost ( NetworkClient oldClient, int port, MatchInfo matchInfo, int oldConnectionId, PeerInfoMessage peers ) : NetworkClient
oldClient NetworkClient
port int
matchInfo UnityEngine.Networking.Match.MatchInfo
oldConnectionId int
peers UnityEngine.Networking.NetworkSystem.PeerInfoMessage
리턴 NetworkClient

ClearHandlers() 공개 정적인 메소드

Clear all registered callback handlers.

public static ClearHandlers ( ) : void
리턴 void

ClearLocalObjects() 공개 정적인 메소드

This clears all of the networked objects that the server is aware of. This can be required if a scene change deleted all of the objects without destroying them in the normal manner.

public static ClearLocalObjects ( ) : void
리턴 void

ClearSpawners() 공개 정적인 메소드

Clears all registered spawn prefab and spawn handler functions for this server.

public static ClearSpawners ( ) : void
리턴 void

Configure() 공개 정적인 메소드

This configures the transport layer settings for the server.

public static Configure ( ConnectionConfig config, int maxConnections ) : bool
config ConnectionConfig Transport layer confuration object.
maxConnections int The maximum number of client connections to allow.
리턴 bool

Configure() 공개 정적인 메소드

This configures the transport layer settings for the server.

public static Configure ( HostTopology topology ) : bool
topology HostTopology Transport layer topology object to use.
리턴 bool

Destroy() 공개 정적인 메소드

Destroys this object and corresponding objects on all clients.

public static Destroy ( GameObject obj ) : void
obj UnityEngine.GameObject Game object to destroy.
리턴 void

DestroyPlayersForConnection() 공개 정적인 메소드

This destroys all the player objects associated with a NetworkConnections on a server.

public static DestroyPlayersForConnection ( NetworkConnection conn ) : void
conn NetworkConnection The connections object to clean up for.
리턴 void

DisconnectAll() 공개 정적인 메소드

Disconnect all currently connected clients.

public static DisconnectAll ( ) : void
리턴 void

FindLocalObject() 공개 정적인 메소드

This finds the local NetworkIdentity object with the specified network Id.

public static FindLocalObject ( NetworkInstanceId netId ) : GameObject
netId NetworkInstanceId The netId of the NetworkIdentity object to find.
리턴 UnityEngine.GameObject

GetConnectionStats() 공개 정적인 메소드

Gets aggregate packet stats for all connections.

public static GetConnectionStats ( ) : NetworkConnection.PacketStat>.Dictionary
리턴 NetworkConnection.PacketStat>.Dictionary

GetStatsIn() 공개 정적인 메소드

public static GetStatsIn ( int &numMsgs, int &numBytes ) : void
numMsgs int
numBytes int
리턴 void

GetStatsOut() 공개 정적인 메소드

public static GetStatsOut ( int &numMsgs, int &numBufferedMsgs, int &numBytes, int &lastBufferedPerSecond ) : void
numMsgs int
numBufferedMsgs int
numBytes int
lastBufferedPerSecond int
리턴 void

Listen() 공개 정적인 메소드

public static Listen ( MatchInfo matchInfo, int listenPort ) : bool
matchInfo UnityEngine.Networking.Match.MatchInfo
listenPort int
리턴 bool

Listen() 공개 정적인 메소드

Start the server on the given port number. Note that if a match has been created, this will listen using the Relay server instead of a local socket.

public static Listen ( int serverPort ) : bool
serverPort int Listen port number.
리턴 bool

Listen() 공개 정적인 메소드

Start the server on the given port number. Note that if a match has been created, this will listen using the Relay server instead of a local socket.

public static Listen ( string ipAddress, int serverPort ) : bool
ipAddress string The IP address to bind to (optional).
serverPort int Listen port number.
리턴 bool

ListenRelay() 공개 정적인 메소드

Starts a server using a Relay server. This is the manual way of using the Relay server, as the regular NetworkServer.Connect() will automatically use the Relay server if a match exists.

public static ListenRelay ( string relayIp, int relayPort, NetworkID netGuid, SourceID sourceId, NodeID nodeId ) : void
relayIp string Relay server IP Address.
relayPort int Relay server port.
netGuid NetworkID GUID of the network to create.
sourceId SourceID This server's sourceId.
nodeId NodeID The node to join the network with.
리턴 void

RegisterHandler() 공개 정적인 메소드

Register a handler for a particular message type.

public static RegisterHandler ( short msgType, NetworkMessageDelegate handler ) : void
msgType short Message type number.
handler NetworkMessageDelegate Function handler which will be invoked for when this message type is received.
리턴 void