C# Класс UnityEngine.Networking.NetworkMigrationManager

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

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

Метод Описание
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.

Защищенные методы

Метод Описание
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.

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

Метод Описание
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

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

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

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.
Результат bool

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

This causes objects for known players to be disabled.

public DisablePlayerObjects ( ) : void
Результат void

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

public FindNewHost ( PeerInfoMessage &newHostInfo, bool &youAreNewHost ) : bool
newHostInfo UnityEngine.Networking.NetworkSystem.PeerInfoMessage
youAreNewHost bool
Результат bool

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

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.
Результат void

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

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.
Результат bool

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

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

public LostHostOnHost ( ) : void
Результат void

OnAuthorityUpdated() защищенный Метод

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.
Результат void

OnClientDisconnectedFromHost() защищенный Метод

protected OnClientDisconnectedFromHost ( NetworkConnection conn, SceneChangeOption &sceneChange ) : void
conn NetworkConnection
sceneChange SceneChangeOption
Результат void

OnPeersUpdated() защищенный Метод

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.
Результат void

OnServerHostShutdown() защищенный Метод

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

protected OnServerHostShutdown ( ) : void
Результат void

OnServerReconnectObject() защищенный Метод

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.
Результат void

OnServerReconnectPlayer() защищенный Метод

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.
Результат void

OnServerReconnectPlayer() защищенный Метод

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).
Результат void

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

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.
Результат bool

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

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.
Результат bool

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

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.
Результат void

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

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

public SendPeerInfo ( ) : void
Результат void