This is a specialized NetworkManager that includes a networked room. More...
Inherits NobleConnect.Mirror.NobleNetworkManager.
Classes | |
struct | PendingPlayer |
Public Member Functions | |
override void | OnValidate () |
override void | OnServerReady (NetworkConnection conn) |
Called on the server when a client is ready. More... | |
void | CheckReadyToBegin () |
CheckReadyToBegin checks all of the players in the room to see if their readyToBegin flag is set. More... | |
override void | OnServerConnect (NetworkConnection conn) |
Called on the server when a new client connects. More... | |
override void | OnServerDisconnect (NetworkConnection conn) |
Called on the server when a client disconnects. More... | |
override void | OnServerAddPlayer (NetworkConnection conn) |
Called on the server when a client adds a new player with ClientScene.AddPlayer. More... | |
void | RecalculateRoomPlayerIndices () |
override void | ServerChangeScene (string newSceneName) |
This causes the server to switch scenes and sets the networkSceneName. More... | |
override void | OnServerSceneChanged (string sceneName) |
Called on the server when a scene is completed loaded, when the scene load was initiated by the server with ServerChangeScene(). More... | |
override void | OnStartServer () |
This is invoked when a server is started - including when a host is started. More... | |
override void | OnStartHost () |
This is invoked when a host is started. More... | |
override void | OnStopServer () |
This is called when a server is stopped - including when a host is stopped. More... | |
override void | OnStopHost () |
This is called when a host is stopped. More... | |
override void | OnStartClient () |
This is invoked when the client is started. More... | |
override void | OnClientConnect (NetworkConnection conn) |
Called on the client when connected to a server. More... | |
override void | OnClientDisconnect (NetworkConnection conn) |
Called on clients when disconnected from a server. More... | |
override void | OnStopClient () |
This is called when a client is stopped. More... | |
override void | OnClientSceneChanged (NetworkConnection conn) |
Called on clients when a scene has completed loaded, when the scene load was initiated by the server. More... | |
virtual void | OnRoomStartHost () |
This is called on the host when a host is started. More... | |
virtual void | OnRoomStopHost () |
This is called on the host when the host is stopped. More... | |
virtual void | OnRoomStartServer () |
This is called on the server when the server is started - including when a host is started. More... | |
virtual void | OnRoomStopServer () |
This is called on the server when the server is started - including when a host is stopped. More... | |
virtual void | OnRoomServerConnect (NetworkConnection conn) |
This is called on the server when a new client connects to the server. More... | |
virtual void | OnRoomServerDisconnect (NetworkConnection conn) |
This is called on the server when a client disconnects. More... | |
virtual void | OnRoomServerSceneChanged (string sceneName) |
This is called on the server when a networked scene finishes loading. More... | |
virtual GameObject | OnRoomServerCreateRoomPlayer (NetworkConnection conn) |
This allows customization of the creation of the room-player object on the server. More... | |
virtual GameObject | OnRoomServerCreateGamePlayer (NetworkConnection conn) |
Obsolete: Use OnRoomServerCreateGamePlayer(NetworkConnection, GameObject) instead. More... | |
virtual GameObject | OnRoomServerCreateGamePlayer (NetworkConnection conn, GameObject roomPlayer) |
This allows customization of the creation of the GamePlayer object on the server. More... | |
virtual void | OnRoomServerAddPlayer (NetworkConnection conn) |
This allows customization of the creation of the GamePlayer object on the server. More... | |
virtual bool | OnRoomServerSceneLoadedForPlayer (GameObject roomPlayer, GameObject gamePlayer) |
Obsolete: Use OnRoomServerSceneLoadedForPlayer(NetworkConnection, GameObject, GameObject) instead. More... | |
virtual bool | OnRoomServerSceneLoadedForPlayer (NetworkConnection conn, GameObject roomPlayer, GameObject gamePlayer) |
This is called on the server when it is told that a client has finished switching from the room scene to a game player scene. More... | |
virtual void | OnRoomServerPlayersReady () |
This is called on the server when all the players in the room are ready. More... | |
virtual void | OnRoomClientEnter () |
This is a hook to allow custom behaviour when the game client enters the room. More... | |
virtual void | OnRoomClientExit () |
This is a hook to allow custom behaviour when the game client exits the room. More... | |
virtual void | OnRoomClientConnect (NetworkConnection conn) |
This is called on the client when it connects to server. More... | |
virtual void | OnRoomClientDisconnect (NetworkConnection conn) |
This is called on the client when disconnected from a server. More... | |
virtual void | OnRoomStartClient () |
This is called on the client when a client is started. More... | |
virtual void | OnRoomStopClient () |
This is called on the client when the client stops. More... | |
virtual void | OnRoomClientSceneChanged (NetworkConnection conn) |
This is called on the client when the client is finished loading a new networked scene. More... | |
virtual void | OnRoomClientAddPlayerFailed () |
Called on the client when adding a player to the room fails. More... | |
virtual void | OnGUI () |
virtual so inheriting classes can roll their own More... | |
Public Member Functions inherited from NobleConnect.Mirror.NobleNetworkManager | |
override void | Awake () |
Initialize connectionConfig and HostTopology plus some other important setup. More... | |
override void | Start () |
virtual void | Update () |
Updates the NobleClient and NobleServer. More... | |
void | InitClient () |
Initialize the NobleClient and allocate a relay. More... | |
new void | StartClient () |
Like NetworkManager.StartClient() but utilizes the Noble Connect relay and punchthrough services. More... | |
void | StartClient (IPEndPoint hostEndPoint) |
Connect to a HostEndPoint, utilizing the Noble Connect relay and punchthrough services. More... | |
void | StartClientLANOnly () |
Start a client in LAN only mode. No relays or punchthrough will be used. More... | |
void | StartClientLANOnly (IPEndPoint hostEndPoint) |
Start a client in LAN only mode. No relays or punchthrough will be used. More... | |
override void | OnStartClient () |
virtual new void | StartHost () |
Start hosting, connect a local client, and request a HostEndPoint from the NobleConnectServices More... | |
void | StartHostLANOnly () |
Start hosting, connect a local client, but do no create a relay or enable punchthrough More... | |
new void | StartServer () |
Start a server and request a HostEndPoint from the NobleConnectServices More... | |
void | StartServerLANonly () |
Start a server, but do no create a relay or enable punchthrough More... | |
new void | StopClient () |
Stop the client. More... | |
void | RegisterClientHandlers () |
Register default client message handlers More... | |
override void | OnStartServer () |
Called when hosting starts. More... | |
void | OnStartServerLANOnly () |
IPAddress | GetALANAddress () |
virtual void | OnFatalError (string error) |
Override this method to be informed when something goes horribly wrong. More... | |
override void | OnStopServer () |
Cleans up the server More... | |
override void | OnStopClient () |
override void | OnServerConnect (NetworkConnection conn) |
Called when the server receives a client connection. More... | |
override void | OnClientDisconnect (NetworkConnection conn) |
override void | OnServerDisconnect (NetworkConnection conn) |
Called on the server when a client disconnects More... | |
virtual void | OnServerPrepared (string hostAddress, ushort hostPort) |
Override this method to know when a Server has received their HostEndPoint More... | |
override void | OnDestroy () |
Clean up the client and server. More... | |
Public Attributes | |
string | RoomScene |
The scene to use for the room. This is similar to the offlineScene of the NetworkManager. More... | |
string | GameplayScene |
The scene to use for the playing the game from the room. This is similar to the onlineScene of the NetworkManager. More... | |
List< PendingPlayer > | pendingPlayers = new List<PendingPlayer>() |
List of players that are in the Room More... | |
bool | allPlayersReady |
True when all players have submitted a Ready message More... | |
List< NobleRoomPlayer > | roomSlots = new List<NobleRoomPlayer>() |
These slots track players that enter the room. More... | |
Public Attributes inherited from NobleConnect.Mirror.NobleNetworkManager | |
NobleClient | client |
The NobleClient that will be used to connect to the host. More... | |
int | networkPort |
GeographicRegion | region = GeographicRegion.AUTO |
The geographic region to use when selecting a relay server. More... | |
bool | forceRelayConnection |
You can enable this to force relay connections to be used for testing purposes. More... | |
NobleConnect.Logger.Level | logLevel = NobleConnect.Logger.Level.Info |
How much output do you want to see? More... | |
float | requestTimeout = .2f |
Request timeout. More... | |
int | relayRefreshTime = 30 |
How often to send relay refresh requests, in seconds. More... | |
float | relayRefreshTimeout = .1f |
Initial timeout before resending refresh messages. This is doubled for each failed resend. More... | |
int | maxRelayRefreshAttempts = 3 |
Max number of times to try and resend refresh messages before giving up and shutting down the relay connection. More... | |
int | relayLifetime = 30 |
How long a relay will stay alive without being refreshed (in seconds) More... | |
Action< NetworkConnection > | onClientConnectInternal |
We need a reference to Mirror's internal connect method but it is not public so we get it via reflection. More... | |
Action< NetworkConnection > | onClientDisconnectInternal |
We need a reference to Mirror's internal disconnect method but it is not public so we get it via reflection. More... | |
Action< NetworkConnection > | onServerConnectInternal |
We need a reference to Mirror's internal connect method but it is not public so we get it via reflection. More... | |
Action< NetworkConnection > | onServerDisconnectInternal |
We need a reference to Mirror's internal disconnect method but it is not public so we get it via reflection. More... | |
bool | isDisconnecting |
True when in the middle of disconnecting More... | |
Protected Attributes | |
NobleRoomPlayer | roomPlayerPrefab |
Protected Attributes inherited from NobleConnect.Mirror.NobleNetworkManager | |
bool | isLANOnly |
If the current connection is LAN only More... | |
Additional Inherited Members | |
Properties inherited from NobleConnect.Mirror.NobleNetworkManager | |
IPEndPoint | HostEndPoint [get] |
This is the address that clients should connect to. It is assigned by the relay server. More... | |
This is a specialized NetworkManager that includes a networked room.
The room has slots that track the joined players, and a maximum player count that is enforced. It requires that the NetworkRoomPlayer component be on the room player objects.
NetworkRoomManager is derived from NetworkManager, and so it implements many of the virtual functions provided by the NetworkManager class. To avoid accidentally replacing functionality of the NetworkRoomManager, there are new virtual functions on the NetworkRoomManager that begin with "OnRoom". These should be used on classes derived from NetworkRoomManager instead of the virtual functions on NetworkManager.
The OnRoom*() functions have empty implementations on the NetworkRoomManager base class, so the base class functions do not have to be called.
void NobleConnect.Mirror.NobleRoomManager.CheckReadyToBegin | ( | ) |
CheckReadyToBegin checks all of the players in the room to see if their readyToBegin flag is set.
If all of the players are ready, then the server switches from the RoomScene to the PlayScene, essentially starting the game. This is called automatically in response to NetworkRoomPlayer.CmdChangeReadyState.
override void NobleConnect.Mirror.NobleRoomManager.OnClientConnect | ( | NetworkConnection | conn | ) |
Called on the client when connected to a server.
The default implementation of this function sets the client as ready and adds a player. Override the function to dictate what happens when the client connects.
conn | Connection to the server. |
override void NobleConnect.Mirror.NobleRoomManager.OnClientDisconnect | ( | NetworkConnection | conn | ) |
Called on clients when disconnected from a server.
This is called on the client when it disconnects from the server. Override this function to decide what happens when the client disconnects.
conn | Connection to the server. |
override void NobleConnect.Mirror.NobleRoomManager.OnClientSceneChanged | ( | NetworkConnection | conn | ) |
Called on clients when a scene has completed loaded, when the scene load was initiated by the server.
Scene changes can cause player objects to be destroyed. The default implementation of OnClientSceneChanged in the NetworkManager is to add a player object for the connection if no player object exists.
conn | Connection of the client |
|
virtual |
virtual so inheriting classes can roll their own
|
virtual |
Called on the client when adding a player to the room fails.
This could be because the room is full, or the connection is not allowed to have more players.
|
virtual |
This is called on the client when it connects to server.
conn | The connection that connected. |
|
virtual |
This is called on the client when disconnected from a server.
conn | The connection that disconnected. |
|
virtual |
This is a hook to allow custom behaviour when the game client enters the room.
|
virtual |
This is a hook to allow custom behaviour when the game client exits the room.
|
virtual |
This is called on the client when the client is finished loading a new networked scene.
conn | The connection that finished loading a new networked scene. |
|
virtual |
This allows customization of the creation of the GamePlayer object on the server.
This is only called for subsequent GamePlay scenes after the first one.
See OnRoomServerCreateGamePlayer(NetworkConnection, GameObject) to customize the player object for the initial GamePlay scene.
conn | The connection the player object is for. |
|
virtual |
This is called on the server when a new client connects to the server.
conn | The new connection. |
|
virtual |
Obsolete: Use OnRoomServerCreateGamePlayer(NetworkConnection, GameObject) instead.
conn | The connection the player object is for. |
|
virtual |
This allows customization of the creation of the GamePlayer object on the server.
By default the gamePlayerPrefab is used to create the game-player, but this function allows that behaviour to be customized. The object returned from the function will be used to replace the room-player on the connection.
conn | The connection the player object is for. |
roomPlayer | The room player object for this connection. |
|
virtual |
This allows customization of the creation of the room-player object on the server.
By default the roomPlayerPrefab is used to create the room-player, but this function allows that behaviour to be customized.
conn | The connection the player object is for. |
|
virtual |
This is called on the server when a client disconnects.
conn | The connection that disconnected. |
|
virtual |
This is called on the server when all the players in the room are ready.
The default implementation of this function uses ServerChangeScene() to switch to the game player scene. By implementing this callback you can customize what happens when all the players in the room are ready, such as adding a countdown or a confirmation for a group leader.
|
virtual |
This is called on the server when a networked scene finishes loading.
sceneName | Name of the new scene. |
|
virtual |
Obsolete: Use OnRoomServerSceneLoadedForPlayer(NetworkConnection, GameObject, GameObject) instead.
|
virtual |
This is called on the server when it is told that a client has finished switching from the room scene to a game player scene.
When switching from the room, the room-player is replaced with a game-player object. This callback function gives an opportunity to apply state from the room-player to the game-player object.
conn | The connection of the player |
roomPlayer | The room player object. |
gamePlayer | The game player object. |
|
virtual |
This is called on the client when a client is started.
roomClient | The connection for the room. |
|
virtual |
This is called on the host when a host is started.
|
virtual |
This is called on the server when the server is started - including when a host is started.
|
virtual |
This is called on the client when the client stops.
|
virtual |
This is called on the host when the host is stopped.
|
virtual |
This is called on the server when the server is started - including when a host is stopped.
override void NobleConnect.Mirror.NobleRoomManager.OnServerAddPlayer | ( | NetworkConnection | conn | ) |
Called on the server when a client adds a new player with ClientScene.AddPlayer.
The default implementation for this function creates a new player object from the playerPrefab.
conn | Connection from client. |
override void NobleConnect.Mirror.NobleRoomManager.OnServerConnect | ( | NetworkConnection | conn | ) |
Called on the server when a new client connects.
Unity calls this on the Server when a Client connects to the Server. Use an override to tell the NetworkManager what to do when a client connects to the server.
conn | Connection from client. |
override void NobleConnect.Mirror.NobleRoomManager.OnServerDisconnect | ( | NetworkConnection | conn | ) |
Called on the server when a client disconnects.
This is called on the Server when a Client disconnects from the Server. Use an override to decide what should happen when a disconnection is detected.
conn | Connection from client. |
override void NobleConnect.Mirror.NobleRoomManager.OnServerReady | ( | NetworkConnection | conn | ) |
Called on the server when a client is ready.
The default implementation of this function calls NetworkServer.SetClientReady() to continue the network setup process.
conn | Connection from client. |
override void NobleConnect.Mirror.NobleRoomManager.OnServerSceneChanged | ( | string | sceneName | ) |
Called on the server when a scene is completed loaded, when the scene load was initiated by the server with ServerChangeScene().
sceneName | The name of the new scene. |
override void NobleConnect.Mirror.NobleRoomManager.OnStartClient | ( | ) |
This is invoked when the client is started.
override void NobleConnect.Mirror.NobleRoomManager.OnStartHost | ( | ) |
This is invoked when a host is started.
StartHost has multiple signatures, but they all cause this hook to be called.
override void NobleConnect.Mirror.NobleRoomManager.OnStartServer | ( | ) |
This is invoked when a server is started - including when a host is started.
StartServer has multiple signatures, but they all cause this hook to be called.
override void NobleConnect.Mirror.NobleRoomManager.OnStopClient | ( | ) |
This is called when a client is stopped.
override void NobleConnect.Mirror.NobleRoomManager.OnStopHost | ( | ) |
This is called when a host is stopped.
override void NobleConnect.Mirror.NobleRoomManager.OnStopServer | ( | ) |
This is called when a server is stopped - including when a host is stopped.
override void NobleConnect.Mirror.NobleRoomManager.OnValidate | ( | ) |
void NobleConnect.Mirror.NobleRoomManager.RecalculateRoomPlayerIndices | ( | ) |
override void NobleConnect.Mirror.NobleRoomManager.ServerChangeScene | ( | string | newSceneName | ) |
This causes the server to switch scenes and sets the networkSceneName.
Clients that connect to this server will automatically switch to this scene. This is called autmatically if onlineScene or offlineScene are set, but it can be called from user code to switch scenes again while the game is in progress. This automatically sets clients to be not-ready. The clients must call NetworkClient.Ready() again to participate in the new scene.
newSceneName |
bool NobleConnect.Mirror.NobleRoomManager.allPlayersReady |
True when all players have submitted a Ready message
string NobleConnect.Mirror.NobleRoomManager.GameplayScene |
The scene to use for the playing the game from the room. This is similar to the onlineScene of the NetworkManager.
List<PendingPlayer> NobleConnect.Mirror.NobleRoomManager.pendingPlayers = new List<PendingPlayer>() |
List of players that are in the Room
|
protected |
string NobleConnect.Mirror.NobleRoomManager.RoomScene |
The scene to use for the room. This is similar to the offlineScene of the NetworkManager.
List<NobleRoomPlayer> NobleConnect.Mirror.NobleRoomManager.roomSlots = new List<NobleRoomPlayer>() |
These slots track players that enter the room.
The slotId on players is global to the game - across all players.