C# Класс NetworkDirector, PaperCowboys

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

Private Properties

Свойство Тип Описание
RPCOnMasterClientSwitched void
RPCOnMasterClientSwitched void
RPCOnNetworkPlayerConnected void
RPCOnNetworkPlayerConnected void
RPCOnNetworkPlayerDisconnected void
RPCOnNetworkPlayerDisconnected void
RPCSetPlayerCustomFloat void
RPCSetPlayerCustomFloat void
RPCSetPlayerCustomInt void
RPCSetPlayerCustomInt void
RPCSetPlayerCustomString void
RPCSetPlayerCustomString void
RPCValidationFinished void

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

Метод Описание
Awake ( ) : void
BroadcastCustomProperty ( RPCMode target, NetworkPlayer owner, string key, object data ) : void

Called by a client or a server to broadcast their custom property to all other players

BroadcastCustomProperty ( uLink target, uLink owner, string key, object data ) : void

Called by a client or a server to broadcast their custom property to all other players

ClearHostList ( ) : void

Clear the host list which was received by MasterServer.PollHostList.

Connect ( string IP, int remotePort ) : NetworkConnectionError

Connect the specified IP and remotePort.

Connect ( string IP, int remotePort ) : uLink.NetworkConnectionError

Connect the specified IP and remotePort.

Destroy ( GameObject go ) : void

Destroy the specified game object.

Disconnect ( ) : void

Disconnects from the server.

GetCustomPlayerProperty ( NetworkPlayer player, string key ) : object

Called by a server or a client to get a custom player property.

GetCustomPlayerProperty ( uLink player, string key ) : object

Called by a server or a client to get a custom player property.

InitializeServer ( string gameName, int connections, int listenPort ) : void

Initializes the server.

Instantiate ( string prefabName, Vector3 position, Quaternion rotation, int group ) : GameObject

Instantiates a game object and invokes a RPCNetworkInstantiate call if there are any additional arguments to send them to the object.

Instantiate ( string prefabName, Vector3 position, Quaternion rotation, int group ) : void

Instantiates a game object

InstantiateClientObject ( uLink owner, string prefabName, Vector3 position, Quaternion rotation, int group ) : void

Instantiates a game object

InstantiateSceneObject ( string prefabName, Vector3 position, Quaternion rotation, int group ) : GameObject

Instantiate a scene-owned prefab over the network. For Unity native networking purposes, this is a fancy way of telling the server to instantiate the object

Only the master client can Instantiate scene objects.

InstantiateSceneObject ( string prefabName, Vector3 position, Quaternion rotation, int group ) : void

Instantiate a "scene-owned" prefab over the network. The idea is that it would persist even if the master client left the game. Because we are an authoritative client-server model, however, this function is pretty much the same as Instantiate except it absolutely must be called by the server. (The Photon networking model had a standalone server that designated players as "masters" to be an authority on things).

Only the master client can Instantiate scene objects.

OnConnectedToServer ( ) : void

Called on the client when you have successfully connected to a server.

OnDisconnectedFromServer ( NetworkDisconnection info ) : void

Called on the client when the connection was lost or you disconnected from the server.

OnFailedToConnect ( NetworkConnectionError error ) : void

Called on the client when a connection attempt fails for some reason.

OnPlayerConnected ( NetworkPlayer player ) : void

Called on the server whenever a new player has successfully connected.

OnPlayerDisconnected ( NetworkPlayer player ) : void

Called on the server whenever a player is disconnected from the server.

OnServerInitialized ( ) : void

Called on the server whenever a Network.InitializeServer was invoked and has completed.

PollHostList ( ) : HostData[]

Check for the latest host list received by using MasterServer.RequestHostList.

PollHostList ( ) : uLink.HostData[]

Check for the latest host list received by using MasterServer.RequestHostList.

RequestHostList ( ) : void

Request a host list from the master server.

SetPlayerCustomProperties ( Hashtable ht ) : void

Called by a server or a client to set several custom properties for your own player

SetPlayerCustomProperties ( Hashtable ht, bool broadcast ) : void

Called by a server or a client to set several custom properties for your own player

SetPlayerCustomProperty ( NetworkPlayer player, string key, object data ) : void

Called by a server or a client to set the custom property for a player in the game.

SetPlayerCustomProperty ( uLink player, string key, object data ) : void

Called by a server or a client to set the custom property for a player in the game.

uLink_OnConnectedToServer ( ) : void

Called on the client when you have successfully connected to a server.

uLink_OnDisconnectedFromServer ( uLink info ) : void

Called on the client when the connection was lost or you disconnected from the server.

uLink_OnFailedToConnect ( uLink error ) : void

Called on the client when a connection attempt fails for some reason.

uLink_OnHandoverTimeout ( uLink player ) : void

Called on the server whenever a player fails to connect to the server in a timely manner

uLink_OnPlayerApproval ( uLink approval ) : void

Called on the server when approving a new player to join the game

uLink_OnPlayerConnected ( uLink player ) : void

Called on the server whenever a new player has successfully connected.

uLink_OnPlayerDisconnected ( uLink player ) : void

Called on the server whenever a player is disconnected from the server.

uLink_OnServerInitialized ( ) : void

Called on the server whenever a Network.InitializeServer was invoked and has completed.

uLink_OnServerUninitialized ( ) : void

Called on the server whenever a Disconnect was invoked and has completed.

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

Метод Описание
RPCOnMasterClientSwitched ( NetworkPlayer player ) : void
RPCOnMasterClientSwitched ( uLink player ) : void
RPCOnNetworkPlayerConnected ( NetworkPlayer player ) : void
RPCOnNetworkPlayerConnected ( uLink player ) : void
RPCOnNetworkPlayerDisconnected ( NetworkPlayer player ) : void
RPCOnNetworkPlayerDisconnected ( uLink player ) : void
RPCSetPlayerCustomFloat ( NetworkPlayer player, string key, float data ) : void
RPCSetPlayerCustomFloat ( uLink player, string key, float data ) : void
RPCSetPlayerCustomInt ( NetworkPlayer player, string key, int data ) : void
RPCSetPlayerCustomInt ( uLink player, string key, int data ) : void
RPCSetPlayerCustomString ( NetworkPlayer player, string key, string data ) : void
RPCSetPlayerCustomString ( uLink player, string key, string data ) : void
RPCValidationFinished ( ) : void

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

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

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

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

Called by a client or a server to broadcast their custom property to all other players
public BroadcastCustomProperty ( RPCMode target, NetworkPlayer owner, string key, object data ) : void
target RPCMode
owner NetworkPlayer
key string /// Key. ///
data object /// Data. ///
Результат void

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

Called by a client or a server to broadcast their custom property to all other players
public BroadcastCustomProperty ( uLink target, uLink owner, string key, object data ) : void
target uLink
owner uLink
key string /// Key. ///
data object /// Data. ///
Результат void

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

Clear the host list which was received by MasterServer.PollHostList.
public static ClearHostList ( ) : void
Результат void

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

Connect the specified IP and remotePort.
public static Connect ( string IP, int remotePort ) : NetworkConnectionError
IP string /// IP address. ///
remotePort int /// Connect to the specified host (ip or domain name) and server port. ///
Результат NetworkConnectionError

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

Connect the specified IP and remotePort.
public static Connect ( string IP, int remotePort ) : uLink.NetworkConnectionError
IP string /// IP address. ///
remotePort int /// Connect to the specified host (ip or domain name) and server port. ///
Результат uLink.NetworkConnectionError

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

Destroy the specified game object.
public static Destroy ( GameObject go ) : void
go GameObject /// The game object ///
Результат void

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

Disconnects from the server.
public static Disconnect ( ) : void
Результат void

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

Called by a server or a client to get a custom player property.
public static GetCustomPlayerProperty ( NetworkPlayer player, string key ) : object
player NetworkPlayer /// Player. ///
key string /// Key. ///
Результат object

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

Called by a server or a client to get a custom player property.
public static GetCustomPlayerProperty ( uLink player, string key ) : object
player uLink /// Player. ///
key string /// Key. ///
Результат object

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

Initializes the server.
public static InitializeServer ( string gameName, int connections, int listenPort ) : void
gameName string
connections int /// Connections. ///
listenPort int /// Listen port. ///
Результат void

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

Instantiates a game object and invokes a RPCNetworkInstantiate call if there are any additional arguments to send them to the object.
public static Instantiate ( string prefabName, Vector3 position, Quaternion rotation, int group ) : GameObject
prefabName string Name of the prefab to instantiate.
position Vector3 Position Vector3 to apply on instantiation.
rotation Quaternion Rotation Quaternion to apply on instantiation.
group int The group for this view.
Результат GameObject

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

Instantiates a game object
public Instantiate ( string prefabName, Vector3 position, Quaternion rotation, int group ) : void
prefabName string Name of the prefab to instantiate.
position Vector3 Position Vector3 to apply on instantiation.
rotation Quaternion Rotation Quaternion to apply on instantiation.
group int The group for this view.
Результат void

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

Instantiates a game object
public InstantiateClientObject ( uLink owner, string prefabName, Vector3 position, Quaternion rotation, int group ) : void
owner uLink The owning client
prefabName string Name of the prefab to instantiate.
position Vector3 Position Vector3 to apply on instantiation.
rotation Quaternion Rotation Quaternion to apply on instantiation.
group int The group for this view.
Результат void

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

Instantiate a scene-owned prefab over the network. For Unity native networking purposes, this is a fancy way of telling the server to instantiate the object
Only the master client can Instantiate scene objects.
public static InstantiateSceneObject ( string prefabName, Vector3 position, Quaternion rotation, int group ) : GameObject
prefabName string Name of the prefab to instantiate.
position Vector3 Position Vector3 to apply on instantiation.
rotation Quaternion Rotation Quaternion to apply on instantiation.
group int The group for this view.
Результат GameObject

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

Instantiate a "scene-owned" prefab over the network. The idea is that it would persist even if the master client left the game. Because we are an authoritative client-server model, however, this function is pretty much the same as Instantiate except it absolutely must be called by the server. (The Photon networking model had a standalone server that designated players as "masters" to be an authority on things).
Only the master client can Instantiate scene objects.
public InstantiateSceneObject ( string prefabName, Vector3 position, Quaternion rotation, int group ) : void
prefabName string Name of the prefab to instantiate.
position Vector3 Position Vector3 to apply on instantiation.
rotation Quaternion Rotation Quaternion to apply on instantiation.
group int The group for this view.
Результат void

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

Called on the client when you have successfully connected to a server.
public OnConnectedToServer ( ) : void
Результат void

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

Called on the client when the connection was lost or you disconnected from the server.
public OnDisconnectedFromServer ( NetworkDisconnection info ) : void
info NetworkDisconnection /// Info. ///
Результат void

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

Called on the client when a connection attempt fails for some reason.
public OnFailedToConnect ( NetworkConnectionError error ) : void
error NetworkConnectionError /// Error. ///
Результат void

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

Called on the server whenever a new player has successfully connected.
public OnPlayerConnected ( NetworkPlayer player ) : void
player NetworkPlayer /// Player. ///
Результат void

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

Called on the server whenever a player is disconnected from the server.
public OnPlayerDisconnected ( NetworkPlayer player ) : void
player NetworkPlayer /// Player. ///
Результат void

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

Called on the server whenever a Network.InitializeServer was invoked and has completed.
public OnServerInitialized ( ) : void
Результат void

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

Check for the latest host list received by using MasterServer.RequestHostList.
public static PollHostList ( ) : HostData[]
Результат HostData[]

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

Check for the latest host list received by using MasterServer.RequestHostList.
public static PollHostList ( ) : uLink.HostData[]
Результат uLink.HostData[]

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

Request a host list from the master server.
public static RequestHostList ( ) : void
Результат void

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

Called by a server or a client to set several custom properties for your own player
public static SetPlayerCustomProperties ( Hashtable ht ) : void
ht Hashtable /// A hashtable of properties to change ///
Результат void

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

Called by a server or a client to set several custom properties for your own player
public static SetPlayerCustomProperties ( Hashtable ht, bool broadcast ) : void
ht Hashtable /// A hashtable of properties to change ///
broadcast bool /// True if we should broadcast the properties to all players ///
Результат void

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

Called by a server or a client to set the custom property for a player in the game.
public static SetPlayerCustomProperty ( NetworkPlayer player, string key, object data ) : void
player NetworkPlayer /// The player who owns the proerty. ///
key string /// Key. ///
data object /// Data. ///
Результат void

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

Called by a server or a client to set the custom property for a player in the game.
public static SetPlayerCustomProperty ( uLink player, string key, object data ) : void
player uLink /// The player who owns the proerty. ///
key string /// Key. ///
data object /// Data. ///
Результат void

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

Called on the client when you have successfully connected to a server.
public uLink_OnConnectedToServer ( ) : void
Результат void

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

Called on the client when the connection was lost or you disconnected from the server.
public uLink_OnDisconnectedFromServer ( uLink info ) : void
info uLink /// Info. ///
Результат void

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

Called on the client when a connection attempt fails for some reason.
public uLink_OnFailedToConnect ( uLink error ) : void
error uLink /// Error. ///
Результат void

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

Called on the server whenever a player fails to connect to the server in a timely manner
public uLink_OnHandoverTimeout ( uLink player ) : void
player uLink /// Player. ///
Результат void

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

Called on the server when approving a new player to join the game
public uLink_OnPlayerApproval ( uLink approval ) : void
approval uLink /// Approval. ///
Результат void

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

Called on the server whenever a new player has successfully connected.
public uLink_OnPlayerConnected ( uLink player ) : void
player uLink /// Player. ///
Результат void

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

Called on the server whenever a player is disconnected from the server.
public uLink_OnPlayerDisconnected ( uLink player ) : void
player uLink /// Player. ///
Результат void

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

Called on the server whenever a Network.InitializeServer was invoked and has completed.
public uLink_OnServerInitialized ( ) : void
Результат void

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

Called on the server whenever a Disconnect was invoked and has completed.
public uLink_OnServerUninitialized ( ) : void
Результат void