C# Class UnityEngine.Networking.NetworkMigrationManager

Inheritance: UnityEngine.MonoBehaviour
ファイルを表示 Open project: CarlosHBC/UnityDecompiled Class Usage Examples

Public Methods

Method Description
BecomeNewHost ( int port ) : bool

This causes a client that has been disconnected from the host to become the new host of the game.

DisablePlayerObjects ( ) : void

This causes objects for known players to be disabled.

FindNewHost ( PeerInfoMessage &newHostInfo, bool &youAreNewHost ) : bool
Initialize ( NetworkClient newClient, MatchInfo newMatchInfo ) : void

Used to initialize the migration manager with client and match information.

LostHostOnClient ( NetworkConnection conn ) : bool

This should be called on a client when it has lost its connection to the host.

LostHostOnHost ( ) : void

This should be called on a host when it has has been shutdown.

ReconnectObjectForConnection ( NetworkConnection newConnection, GameObject oldObject, int oldConnectionId ) : bool

This re-establishes a non-player object with client authority with a client that is reconnected. It is similar to NetworkServer.SpawnWithClientAuthority().

ReconnectPlayerForConnection ( NetworkConnection newConnection, GameObject oldPlayer, int oldConnectionId, short playerControllerId ) : bool

This re-establishes a player object with a client that is reconnected. It is similar to NetworkServer.AddPlayerForConnection(). The player game object will become the player object for the new connection.

Reset ( int reconnectId ) : void

Resets the migration manager, and sets the ClientScene's ReconnectId.

SendPeerInfo ( ) : void

This sends the set of peers in the game to all the peers in the game.

Protected Methods

Method Description
OnAuthorityUpdated ( GameObject go, int connectionId, bool authorityState ) : void

A virtual function that is called when the authority of a non-player object changes.

OnClientDisconnectedFromHost ( NetworkConnection conn, SceneChangeOption &sceneChange ) : void
OnPeersUpdated ( PeerListMessage peers ) : void

A virtual function that is called when the set of peers in the game changes.

OnServerHostShutdown ( ) : void

A virtual function that is called when the host is shutdown.

OnServerReconnectObject ( NetworkConnection newConnection, GameObject oldObject, int oldConnectionId ) : void

A virtual function that is called for non-player objects with client authority on the new host when a client from the old host reconnects to the new host.

OnServerReconnectPlayer ( NetworkConnection newConnection, GameObject oldPlayer, int oldConnectionId, short playerControllerId ) : void

A virtual function that is called on the new host when a client from the old host reconnects to the new host.

OnServerReconnectPlayer ( NetworkConnection newConnection, GameObject oldPlayer, int oldConnectionId, short playerControllerId, NetworkReader extraMessageReader ) : void

A virtual function that is called on the new host when a client from the old host reconnects to the new host.

Private Methods

Method Description
AddPendingPlayer ( GameObject obj, int connectionId, NetworkInstanceId netId, short playerControllerId ) : void
AssignAuthorityCallback ( NetworkConnection conn, NetworkIdentity uv, bool authorityState ) : void
FindPendingPlayer ( int connectionId, NetworkInstanceId netId, short playerControllerId ) : GameObject
OnGUI ( ) : void
OnGUIClient ( ) : void
OnGUIHost ( ) : void
OnPeerClientAuthority ( NetworkMessage netMsg ) : void
OnPeerInfo ( NetworkMessage netMsg ) : void
OnServerReconnectPlayerMessage ( NetworkMessage netMsg ) : void
RemovePendingPlayer ( int connectionId ) : void
Start ( ) : void

Method Details

BecomeNewHost() public method

This causes a client that has been disconnected from the host to become the new host of the game.

public BecomeNewHost ( int port ) : bool
port int The network port to listen on.
return bool

DisablePlayerObjects() public method

This causes objects for known players to be disabled.

public DisablePlayerObjects ( ) : void
return void

FindNewHost() public method

public FindNewHost ( PeerInfoMessage &newHostInfo, bool &youAreNewHost ) : bool
newHostInfo UnityEngine.Networking.NetworkSystem.PeerInfoMessage
youAreNewHost bool
return bool

Initialize() public method

Used to initialize the migration manager with client and match information.

public Initialize ( NetworkClient newClient, MatchInfo newMatchInfo ) : void
newClient NetworkClient The NetworkClient being used to connect to the host.
newMatchInfo UnityEngine.Networking.Match.MatchInfo Information about the match being used. This may be null if there is no match.
return void

LostHostOnClient() public method

This should be called on a client when it has lost its connection to the host.

public LostHostOnClient ( NetworkConnection conn ) : bool
conn NetworkConnection The connection of the client that was connected to the host.
return bool

LostHostOnHost() public method

This should be called on a host when it has has been shutdown.

public LostHostOnHost ( ) : void
return void

OnAuthorityUpdated() protected method

A virtual function that is called when the authority of a non-player object changes.

protected OnAuthorityUpdated ( GameObject go, int connectionId, bool authorityState ) : void
go UnityEngine.GameObject The game object whose authority has changed.
connectionId int The id of the connection whose authority changed for this object.
authorityState bool The new authority state for the object.
return void

OnClientDisconnectedFromHost() protected method

protected OnClientDisconnectedFromHost ( NetworkConnection conn, SceneChangeOption &sceneChange ) : void
conn NetworkConnection
sceneChange SceneChangeOption
return void

OnPeersUpdated() protected method

A virtual function that is called when the set of peers in the game changes.

protected OnPeersUpdated ( PeerListMessage peers ) : void
peers UnityEngine.Networking.NetworkSystem.PeerListMessage The set of peers in the game.
return void

OnServerHostShutdown() protected method

A virtual function that is called when the host is shutdown.

protected OnServerHostShutdown ( ) : void
return void

OnServerReconnectObject() protected method

A virtual function that is called for non-player objects with client authority on the new host when a client from the old host reconnects to the new host.

protected OnServerReconnectObject ( NetworkConnection newConnection, GameObject oldObject, int oldConnectionId ) : void
newConnection NetworkConnection The connection of the new client.
oldObject UnityEngine.GameObject The object with authority that is being reconnected.
oldConnectionId int The connectionId of this client on the old host.
return void

OnServerReconnectPlayer() protected method

A virtual function that is called on the new host when a client from the old host reconnects to the new host.

protected OnServerReconnectPlayer ( NetworkConnection newConnection, GameObject oldPlayer, int oldConnectionId, short playerControllerId ) : void
newConnection NetworkConnection The connection of the new client.
oldPlayer UnityEngine.GameObject The player object associated with this client.
oldConnectionId int The connectionId of this client on the old host.
playerControllerId short The playerControllerId of the player that is re-joining.
return void

OnServerReconnectPlayer() protected method

A virtual function that is called on the new host when a client from the old host reconnects to the new host.

protected OnServerReconnectPlayer ( NetworkConnection newConnection, GameObject oldPlayer, int oldConnectionId, short playerControllerId, NetworkReader extraMessageReader ) : void
newConnection NetworkConnection The connection of the new client.
oldPlayer UnityEngine.GameObject The player object associated with this client.
oldConnectionId int The connectionId of this client on the old host.
playerControllerId short The playerControllerId of the player that is re-joining.
extraMessageReader NetworkReader Additional message data (optional).
return void

ReconnectObjectForConnection() public method

This re-establishes a non-player object with client authority with a client that is reconnected. It is similar to NetworkServer.SpawnWithClientAuthority().

public ReconnectObjectForConnection ( NetworkConnection newConnection, GameObject oldObject, int oldConnectionId ) : bool
newConnection NetworkConnection The connection of the new client.
oldObject UnityEngine.GameObject The object with client authority that is being reconnected.
oldConnectionId int This client's connectionId on the old host.
return bool

ReconnectPlayerForConnection() public method

This re-establishes a player object with a client that is reconnected. It is similar to NetworkServer.AddPlayerForConnection(). The player game object will become the player object for the new connection.

public ReconnectPlayerForConnection ( NetworkConnection newConnection, GameObject oldPlayer, int oldConnectionId, short playerControllerId ) : bool
newConnection NetworkConnection The connection of the new client.
oldPlayer UnityEngine.GameObject The player object.
oldConnectionId int This client's connectionId on the old host.
playerControllerId short The playerControllerId of the player that is rejoining.
return bool

Reset() public method

Resets the migration manager, and sets the ClientScene's ReconnectId.

public Reset ( int reconnectId ) : void
reconnectId int The connectionId for the ClientScene to use when reconnecting.
return void

SendPeerInfo() public method

This sends the set of peers in the game to all the peers in the game.

public SendPeerInfo ( ) : void
return void