C# Class NetworkDirector, PaperCowboys

Inheritance: MonoBehaviour
Afficher le fichier Open project: Gamieon/PaperCowboys Class Usage Examples

Private Properties

Свойство Type Description
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

Méthodes publiques

Méthode Description
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.

Private Methods

Méthode Description
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

Method Details

Awake() public méthode

public Awake ( ) : void
Résultat void

BroadcastCustomProperty() public méthode

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. ///
Résultat void

BroadcastCustomProperty() public méthode

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. ///
Résultat void

ClearHostList() public static méthode

Clear the host list which was received by MasterServer.PollHostList.
public static ClearHostList ( ) : void
Résultat void

Connect() public static méthode

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. ///
Résultat NetworkConnectionError

Connect() public static méthode

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. ///
Résultat uLink.NetworkConnectionError

Destroy() public static méthode

Destroy the specified game object.
public static Destroy ( GameObject go ) : void
go GameObject /// The game object ///
Résultat void

Disconnect() public static méthode

Disconnects from the server.
public static Disconnect ( ) : void
Résultat void

GetCustomPlayerProperty() public static méthode

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. ///
Résultat object

GetCustomPlayerProperty() public static méthode

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. ///
Résultat object

InitializeServer() public static méthode

Initializes the server.
public static InitializeServer ( string gameName, int connections, int listenPort ) : void
gameName string
connections int /// Connections. ///
listenPort int /// Listen port. ///
Résultat void

Instantiate() public static méthode

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.
Résultat GameObject

Instantiate() public méthode

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.
Résultat void

InstantiateClientObject() public méthode

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.
Résultat void

InstantiateSceneObject() public static méthode

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.
Résultat GameObject

InstantiateSceneObject() public méthode

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.
Résultat void

OnConnectedToServer() public méthode

Called on the client when you have successfully connected to a server.
public OnConnectedToServer ( ) : void
Résultat void

OnDisconnectedFromServer() public méthode

Called on the client when the connection was lost or you disconnected from the server.
public OnDisconnectedFromServer ( NetworkDisconnection info ) : void
info NetworkDisconnection /// Info. ///
Résultat void

OnFailedToConnect() public méthode

Called on the client when a connection attempt fails for some reason.
public OnFailedToConnect ( NetworkConnectionError error ) : void
error NetworkConnectionError /// Error. ///
Résultat void

OnPlayerConnected() public méthode

Called on the server whenever a new player has successfully connected.
public OnPlayerConnected ( NetworkPlayer player ) : void
player NetworkPlayer /// Player. ///
Résultat void

OnPlayerDisconnected() public méthode

Called on the server whenever a player is disconnected from the server.
public OnPlayerDisconnected ( NetworkPlayer player ) : void
player NetworkPlayer /// Player. ///
Résultat void

OnServerInitialized() public méthode

Called on the server whenever a Network.InitializeServer was invoked and has completed.
public OnServerInitialized ( ) : void
Résultat void

PollHostList() public static méthode

Check for the latest host list received by using MasterServer.RequestHostList.
public static PollHostList ( ) : HostData[]
Résultat HostData[]

PollHostList() public static méthode

Check for the latest host list received by using MasterServer.RequestHostList.
public static PollHostList ( ) : uLink.HostData[]
Résultat uLink.HostData[]

RequestHostList() public static méthode

Request a host list from the master server.
public static RequestHostList ( ) : void
Résultat void

SetPlayerCustomProperties() public static méthode

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 ///
Résultat void

SetPlayerCustomProperties() public static méthode

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 ///
Résultat void

SetPlayerCustomProperty() public static méthode

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. ///
Résultat void

SetPlayerCustomProperty() public static méthode

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. ///
Résultat void

uLink_OnConnectedToServer() public méthode

Called on the client when you have successfully connected to a server.
public uLink_OnConnectedToServer ( ) : void
Résultat void

uLink_OnDisconnectedFromServer() public méthode

Called on the client when the connection was lost or you disconnected from the server.
public uLink_OnDisconnectedFromServer ( uLink info ) : void
info uLink /// Info. ///
Résultat void

uLink_OnFailedToConnect() public méthode

Called on the client when a connection attempt fails for some reason.
public uLink_OnFailedToConnect ( uLink error ) : void
error uLink /// Error. ///
Résultat void

uLink_OnHandoverTimeout() public méthode

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. ///
Résultat void

uLink_OnPlayerApproval() public méthode

Called on the server when approving a new player to join the game
public uLink_OnPlayerApproval ( uLink approval ) : void
approval uLink /// Approval. ///
Résultat void

uLink_OnPlayerConnected() public méthode

Called on the server whenever a new player has successfully connected.
public uLink_OnPlayerConnected ( uLink player ) : void
player uLink /// Player. ///
Résultat void

uLink_OnPlayerDisconnected() public méthode

Called on the server whenever a player is disconnected from the server.
public uLink_OnPlayerDisconnected ( uLink player ) : void
player uLink /// Player. ///
Résultat void

uLink_OnServerInitialized() public méthode

Called on the server whenever a Network.InitializeServer was invoked and has completed.
public uLink_OnServerInitialized ( ) : void
Résultat void

uLink_OnServerUninitialized() public méthode

Called on the server whenever a Disconnect was invoked and has completed.
public uLink_OnServerUninitialized ( ) : void
Résultat void