C# Class UnityEngine.Networking.NetworkManager

Inheritance: UnityEngine.MonoBehaviour
Afficher le fichier Open project: CarlosHBC/UnityDecompiled Class Usage Examples

Méthodes publiques

Свойство Type Description
client NetworkClient
isNetworkActive bool
matchInfo MatchInfo
matchMaker NetworkMatch
matches List
networkSceneName string
singleton NetworkManager

Private Properties

Свойство Type Description
Awake void
CleanupNetworkIdentities void
ClientChangeScene void
ConnectLocalClient NetworkClient
FinishLoadScene void
InitializeSingleton void
OnClientConnectInternal void
OnClientDisconnectInternal void
OnClientErrorInternal void
OnClientNotReadyMessageInternal void
OnClientSceneInternal void
OnDestroy void
OnDomainReload void
OnServerAddPlayerInternal void
OnServerAddPlayerMessageInternal void
OnServerConnectInternal void
OnServerDisconnectInternal void
OnServerErrorInternal void
OnServerReadyMessageInternal void
OnServerRemovePlayerMessageInternal void
OnValidate void
RegisterClientMessages void
RegisterServerMessages void
StartServer bool
UpdateScene void

Méthodes publiques

Méthode Description
GetStartPosition ( ) : Transform

This finds a spawn position based on NetworkStartPosition objects in the scene.

IsClientConnected ( ) : bool

This checks if the NetworkManager has a client and that it is connected to a server.

NetworkManager ( ) : System
OnClientConnect ( NetworkConnection conn ) : void

Called on the client when connected to a server.

OnClientDisconnect ( NetworkConnection conn ) : void

Called on clients when disconnected from a server.

OnClientError ( NetworkConnection conn, int errorCode ) : void

Called on clients when a network error occurs.

OnClientNotReady ( NetworkConnection conn ) : void

Called on clients when a servers tells the client it is no longer ready.

OnClientSceneChanged ( NetworkConnection conn ) : void

Called on clients when a scene has completed loaded, when the scene load was initiated by the server.

OnDestroyMatch ( bool success, string extendedInfo ) : void

Callback that happens when a NetworkMatch.DestroyMatch request has been processed on the server.

OnDropConnection ( bool success, string extendedInfo ) : void

Callback that happens when a NetworkMatch.DropConnection match request has been processed on the server.

OnMatchCreate ( bool success, string extendedInfo, MatchInfo matchInfo ) : void

Callback that happens when a NetworkMatch.CreateMatch request has been processed on the server.

OnMatchJoined ( bool success, string extendedInfo, MatchInfo matchInfo ) : void

Callback that happens when a NetworkMatch.JoinMatch request has been processed on the server.

OnMatchList ( bool success, string extendedInfo, List matchList ) : void
OnServerAddPlayer ( NetworkConnection conn, short playerControllerId ) : void

Called on the server when a client adds a new player with ClientScene.AddPlayer.

OnServerAddPlayer ( NetworkConnection conn, short playerControllerId, NetworkReader extraMessageReader ) : void
OnServerConnect ( NetworkConnection conn ) : void

Called on the server when a new client connects.

OnServerDisconnect ( NetworkConnection conn ) : void

Called on the server when a client disconnects.

OnServerError ( NetworkConnection conn, int errorCode ) : void

Called on the server when a network error occurs for a client connection.

OnServerReady ( NetworkConnection conn ) : void

Called on the server when a client is ready.

OnServerRemovePlayer ( NetworkConnection conn, PlayerController player ) : void

Called on the server when a client removes a player.

OnServerSceneChanged ( string sceneName ) : void

Called on the server when a scene is completed loaded, when the scene load was initiated by the server with ServerChangeScene().

OnSetMatchAttributes ( bool success, string extendedInfo ) : void

Callback that happens when a NetworkMatch.SetMatchAttributes has been processed on the server.

OnStartClient ( NetworkClient client ) : void

This is a hook that is invoked when the client is started.

OnStartHost ( ) : void

This hook is invoked when a host is started.

OnStartServer ( ) : void

This hook is invoked when a server is started - including when a host is started.

OnStopClient ( ) : void

This hook is called when a client is stopped.

OnStopHost ( ) : void

This hook is called when a host is stopped.

OnStopServer ( ) : void

This hook is called when a server is stopped - including when a host is stopped.

RegisterStartPosition ( Transform start ) : void

Registers the transform of a game object as a player spawn location.

ServerChangeScene ( string newSceneName ) : void

This causes the server to switch scenes and sets the networkSceneName.

SetMatchHost ( string newHost, int port, bool https ) : void

This sets the address of the MatchMaker service.

SetupMigrationManager ( NetworkMigrationManager man ) : void

This sets up a NetworkMigrationManager object to work with this NetworkManager.

Shutdown ( ) : void

Shuts down the NetworkManager completely and destroy the singleton.

StartClient ( ) : NetworkClient

This starts a network client. It uses the networkAddress and networkPort properties as the address to connect to.

StartClient ( MatchInfo matchInfo ) : NetworkClient
StartClient ( MatchInfo info, ConnectionConfig config ) : NetworkClient
StartHost ( ) : NetworkClient

This starts a network "host" - a server and client in the same application.

StartHost ( ConnectionConfig config, int maxConnections ) : NetworkClient
StartHost ( MatchInfo info ) : NetworkClient
StartMatchMaker ( ) : void

This starts MatchMaker for the NetworkManager.

StartServer ( ) : bool

This starts a new server.

StartServer ( ConnectionConfig config, int maxConnections ) : bool
StartServer ( MatchInfo info ) : bool
StopClient ( ) : void

Stops the client that the manager is using.

StopHost ( ) : void

This stops both the client and the server that the manager is using.

StopMatchMaker ( ) : void

Stops the MatchMaker that the NetworkManager is using.

StopServer ( ) : void

Stops the server that the manager is using.

UnRegisterStartPosition ( Transform start ) : void

Unregisters the transform of a game object as a player spawn location.

UseExternalClient ( NetworkClient externalClient ) : void

This allows the NetworkManager to use a client object created externally to the NetworkManager instead of using StartClient().

Private Methods

Méthode Description
Awake ( ) : void
CleanupNetworkIdentities ( ) : void
ClientChangeScene ( string newSceneName, bool forceReload ) : void
ConnectLocalClient ( ) : NetworkClient
FinishLoadScene ( ) : void
InitializeSingleton ( ) : void
OnClientConnectInternal ( NetworkMessage netMsg ) : void
OnClientDisconnectInternal ( NetworkMessage netMsg ) : void
OnClientErrorInternal ( NetworkMessage netMsg ) : void
OnClientNotReadyMessageInternal ( NetworkMessage netMsg ) : void
OnClientSceneInternal ( NetworkMessage netMsg ) : void
OnDestroy ( ) : void
OnDomainReload ( ) : void
OnServerAddPlayerInternal ( NetworkConnection conn, short playerControllerId ) : void
OnServerAddPlayerMessageInternal ( NetworkMessage netMsg ) : void
OnServerConnectInternal ( NetworkMessage netMsg ) : void
OnServerDisconnectInternal ( NetworkMessage netMsg ) : void
OnServerErrorInternal ( NetworkMessage netMsg ) : void
OnServerReadyMessageInternal ( NetworkMessage netMsg ) : void
OnServerRemovePlayerMessageInternal ( NetworkMessage netMsg ) : void
OnValidate ( ) : void
RegisterClientMessages ( NetworkClient client ) : void
RegisterServerMessages ( ) : void
StartServer ( MatchInfo info, ConnectionConfig config, int maxConnections ) : bool
UpdateScene ( ) : void

Method Details

GetStartPosition() public méthode

This finds a spawn position based on NetworkStartPosition objects in the scene.

public GetStartPosition ( ) : Transform
Résultat UnityEngine.Transform

IsClientConnected() public méthode

This checks if the NetworkManager has a client and that it is connected to a server.

public IsClientConnected ( ) : bool
Résultat bool

NetworkManager() public méthode

public NetworkManager ( ) : System
Résultat System

OnClientConnect() public méthode

Called on the client when connected to a server.

public OnClientConnect ( NetworkConnection conn ) : void
conn NetworkConnection Connection to the server.
Résultat void

OnClientDisconnect() public méthode

Called on clients when disconnected from a server.

public OnClientDisconnect ( NetworkConnection conn ) : void
conn NetworkConnection Connection to the server.
Résultat void

OnClientError() public méthode

Called on clients when a network error occurs.

public OnClientError ( NetworkConnection conn, int errorCode ) : void
conn NetworkConnection Connection to a server.
errorCode int Error code.
Résultat void

OnClientNotReady() public méthode

Called on clients when a servers tells the client it is no longer ready.

public OnClientNotReady ( NetworkConnection conn ) : void
conn NetworkConnection Connection to a server.
Résultat void

OnClientSceneChanged() public méthode

Called on clients when a scene has completed loaded, when the scene load was initiated by the server.

public OnClientSceneChanged ( NetworkConnection conn ) : void
conn NetworkConnection The network connection that the scene change message arrived on.
Résultat void

OnDestroyMatch() public méthode

Callback that happens when a NetworkMatch.DestroyMatch request has been processed on the server.

public OnDestroyMatch ( bool success, string extendedInfo ) : void
success bool Indicates if the request succeeded.
extendedInfo string A text description for the error if success is false.
Résultat void

OnDropConnection() public méthode

Callback that happens when a NetworkMatch.DropConnection match request has been processed on the server.

public OnDropConnection ( bool success, string extendedInfo ) : void
success bool Indicates if the request succeeded.
extendedInfo string A text description for the error if success is false.
Résultat void

OnMatchCreate() public méthode

Callback that happens when a NetworkMatch.CreateMatch request has been processed on the server.

public OnMatchCreate ( bool success, string extendedInfo, MatchInfo matchInfo ) : void
success bool Indicates if the request succeeded.
extendedInfo string A text description for the error if success is false.
matchInfo UnityEngine.Networking.Match.MatchInfo The information about the newly created match.
Résultat void

OnMatchJoined() public méthode

Callback that happens when a NetworkMatch.JoinMatch request has been processed on the server.

public OnMatchJoined ( bool success, string extendedInfo, MatchInfo matchInfo ) : void
success bool Indicates if the request succeeded.
extendedInfo string A text description for the error if success is false.
matchInfo UnityEngine.Networking.Match.MatchInfo The info for the newly joined match.
Résultat void

OnMatchList() public méthode

public OnMatchList ( bool success, string extendedInfo, List matchList ) : void
success bool
extendedInfo string
matchList List
Résultat void

OnServerAddPlayer() public méthode

Called on the server when a client adds a new player with ClientScene.AddPlayer.

public OnServerAddPlayer ( NetworkConnection conn, short playerControllerId ) : void
conn NetworkConnection Connection from client.
playerControllerId short Id of the new player.
Résultat void

OnServerAddPlayer() public méthode

public OnServerAddPlayer ( NetworkConnection conn, short playerControllerId, NetworkReader extraMessageReader ) : void
conn NetworkConnection
playerControllerId short
extraMessageReader NetworkReader
Résultat void

OnServerConnect() public méthode

Called on the server when a new client connects.

public OnServerConnect ( NetworkConnection conn ) : void
conn NetworkConnection Connection from client.
Résultat void

OnServerDisconnect() public méthode

Called on the server when a client disconnects.

public OnServerDisconnect ( NetworkConnection conn ) : void
conn NetworkConnection Connection from client.
Résultat void

OnServerError() public méthode

Called on the server when a network error occurs for a client connection.

public OnServerError ( NetworkConnection conn, int errorCode ) : void
conn NetworkConnection Connection from client.
errorCode int Error code.
Résultat void

OnServerReady() public méthode

Called on the server when a client is ready.

public OnServerReady ( NetworkConnection conn ) : void
conn NetworkConnection Connection from client.
Résultat void

OnServerRemovePlayer() public méthode

Called on the server when a client removes a player.

public OnServerRemovePlayer ( NetworkConnection conn, PlayerController player ) : void
conn NetworkConnection The connection to remove the player from.
player PlayerController The player controller to remove.
Résultat void

OnServerSceneChanged() public méthode

Called on the server when a scene is completed loaded, when the scene load was initiated by the server with ServerChangeScene().

public OnServerSceneChanged ( string sceneName ) : void
sceneName string The name of the new scene.
Résultat void

OnSetMatchAttributes() public méthode

Callback that happens when a NetworkMatch.SetMatchAttributes has been processed on the server.

public OnSetMatchAttributes ( bool success, string extendedInfo ) : void
success bool Indicates if the request succeeded.
extendedInfo string A text description for the error if success is false.
Résultat void

OnStartClient() public méthode

This is a hook that is invoked when the client is started.

public OnStartClient ( NetworkClient client ) : void
client NetworkClient The NetworkClient object that was started.
Résultat void

OnStartHost() public méthode

This hook is invoked when a host is started.

public OnStartHost ( ) : void
Résultat void

OnStartServer() public méthode

This hook is invoked when a server is started - including when a host is started.

public OnStartServer ( ) : void
Résultat void

OnStopClient() public méthode

This hook is called when a client is stopped.

public OnStopClient ( ) : void
Résultat void

OnStopHost() public méthode

This hook is called when a host is stopped.

public OnStopHost ( ) : void
Résultat void

OnStopServer() public méthode

This hook is called when a server is stopped - including when a host is stopped.

public OnStopServer ( ) : void
Résultat void

RegisterStartPosition() public static méthode

Registers the transform of a game object as a player spawn location.

public static RegisterStartPosition ( Transform start ) : void
start UnityEngine.Transform Transform to register.
Résultat void

ServerChangeScene() public méthode

This causes the server to switch scenes and sets the networkSceneName.

public ServerChangeScene ( string newSceneName ) : void
newSceneName string The name of the scene to change to. The server will change scene immediately, and a message will be sent to connected clients to ask them to change scene also.
Résultat void

SetMatchHost() public méthode

This sets the address of the MatchMaker service.

public SetMatchHost ( string newHost, int port, bool https ) : void
newHost string Hostname of MatchMaker service.
port int Port of MatchMaker service.
https bool Protocol used by MatchMaker service.
Résultat void

SetupMigrationManager() public méthode

This sets up a NetworkMigrationManager object to work with this NetworkManager.

public SetupMigrationManager ( NetworkMigrationManager man ) : void
man NetworkMigrationManager The migration manager object to use with the NetworkManager.
Résultat void

Shutdown() public static méthode

Shuts down the NetworkManager completely and destroy the singleton.

public static Shutdown ( ) : void
Résultat void

StartClient() public méthode

This starts a network client. It uses the networkAddress and networkPort properties as the address to connect to.

public StartClient ( ) : NetworkClient
Résultat NetworkClient

StartClient() public méthode

public StartClient ( MatchInfo matchInfo ) : NetworkClient
matchInfo UnityEngine.Networking.Match.MatchInfo
Résultat NetworkClient

StartClient() public méthode

public StartClient ( MatchInfo info, ConnectionConfig config ) : NetworkClient
info UnityEngine.Networking.Match.MatchInfo
config ConnectionConfig
Résultat NetworkClient

StartHost() public méthode

This starts a network "host" - a server and client in the same application.

public StartHost ( ) : NetworkClient
Résultat NetworkClient

StartHost() public méthode

public StartHost ( ConnectionConfig config, int maxConnections ) : NetworkClient
config ConnectionConfig
maxConnections int
Résultat NetworkClient

StartHost() public méthode

public StartHost ( MatchInfo info ) : NetworkClient
info UnityEngine.Networking.Match.MatchInfo
Résultat NetworkClient

StartMatchMaker() public méthode

This starts MatchMaker for the NetworkManager.

public StartMatchMaker ( ) : void
Résultat void

StartServer() public méthode

This starts a new server.

public StartServer ( ) : bool
Résultat bool

StartServer() public méthode

public StartServer ( ConnectionConfig config, int maxConnections ) : bool
config ConnectionConfig
maxConnections int
Résultat bool

StartServer() public méthode

public StartServer ( MatchInfo info ) : bool
info UnityEngine.Networking.Match.MatchInfo
Résultat bool

StopClient() public méthode

Stops the client that the manager is using.

public StopClient ( ) : void
Résultat void

StopHost() public méthode

This stops both the client and the server that the manager is using.

public StopHost ( ) : void
Résultat void

StopMatchMaker() public méthode

Stops the MatchMaker that the NetworkManager is using.

public StopMatchMaker ( ) : void
Résultat void

StopServer() public méthode

Stops the server that the manager is using.

public StopServer ( ) : void
Résultat void

UnRegisterStartPosition() public static méthode

Unregisters the transform of a game object as a player spawn location.

public static UnRegisterStartPosition ( Transform start ) : void
start UnityEngine.Transform
Résultat void

UseExternalClient() public méthode

This allows the NetworkManager to use a client object created externally to the NetworkManager instead of using StartClient().

public UseExternalClient ( NetworkClient externalClient ) : void
externalClient NetworkClient The NetworkClient object to use.
Résultat void

Property Details

client public_oe property

The current NetworkClient being used by the manager.

public NetworkClient,UnityEngine.Networking client
Résultat NetworkClient

isNetworkActive public_oe property

True if the NetworkServer or NetworkClient isactive.

public bool isNetworkActive
Résultat bool

matchInfo public_oe property

A MatchInfo instance that will be used when StartServer() or StartClient() are called.

public MatchInfo matchInfo
Résultat MatchInfo

matchMaker public_oe property

The UMatch MatchMaker object.

public NetworkMatch matchMaker
Résultat NetworkMatch

matches public_oe property

The list of matches that are available to join.

public List matches
Résultat List

networkSceneName public_oe static_oe property

The name of the current network scene.

public static string networkSceneName
Résultat string

singleton public_oe static_oe property

The NetworkManager singleton object.

public static NetworkManager singleton
Résultat NetworkManager