Mirror/doc/articles/Components/NetworkLobbyPlayer.md

32 lines
1.3 KiB
Markdown
Raw Normal View History

Network Lobby Manager & Lobby Player (#356) * Initial Commit with Unity's Network Lobby Components * Lobby Components WIP * Massive simplifications and structural changes to NetworkLobbyManager and NetworkLobbyPlayer * Replaced more default messages with Command structure resulting in further simplification and less LOC * Completed removal of messages * Code Formatting and GUI Layout * Fixed bugs and finished Remove feature in UI * Added Network Lobby Manager Doc * Network Lobby Docs * Network Lobby Player Doc * Updated doc and image about Offline Scene * changed to PNG * Added Lobby components to navigation * Conformed to naming convention Removed some leftover cruft Removed maxPlayers (redundant to maxConnections) Trapped and killed null ref in OnServerDisconnect * Fixed mistake in OnServerDisconnect * Fix Active Scene check * Alow clean switch to Offline scene * Add Help URL attributes to components * Added Help URL Attributes * Fixed OnGUI logic error. * Added Example and README * Fixed Disconnect handler * Updated Docs * Added Header for Inspector * Finished Lobby Example Minigame * Minor cleanup * Set targetFramerates * Code Cleanup Changed to extended Lobby Manager for player Indexes & colors * Minor changes to align with Mirror's NetworkManager * Fixed logic error * SyncVar Hook Workaround Random Start Positions * Revert making CallOnClientEnterLobby public * Added documentation to the extension * Minor code rearrangement * Made OnGUI virtual so it can be overridden. Added AllPlayersReady bool for convenience to extenders Start Game enhancement to example. * added comments * Corrected namespaces and usings * Reworked DontDestroyOnLoad LobbyPlayer: Moved code from OnStartClient to Start Added LobbyPlayerExt to Lobby Example Code cleanup, added regions Fixed Start Game button bug * Final push of Lobby example to make sure it's complete. * Improved Lobby Example * Code cleanup * Added ground texture Set player camera angle Adjusted lighting angle * Updated ReadMe Cleaned up privates Fixed example to use SetParent Changed to 5 max connections in example * Prefab name fixes due to Mirror master's changes Changed camera handling and GamePlayer Prefab Two more SetParent fixes Demoted two warnings to information Added more comments to example scripts * Revisions based on Vis2K review...more to come. * Added f's where assigning literals to floats * Removed manual calls to SyncVar Hooks because the bug is now fixed. * Changed to GUILayout * wrapped in namespace * Changed to GUILayout * All changes per peer review * Renamed folder to Lobby. * Fix due to change in Mirror 1691 * Renamed Scenes Added LobbyScene property to OfflineGUI script.
2019-02-20 15:58:50 +00:00
# NetworkLobbyPlayer
The Network Lobby Player stores per-player state for the [Network Lobby Manager](NetworkLobbyManager.md) while in the lobby. When using this component, you need to write a script which allows players to indicate they are ready to begin playing, which sets the ReadyToBegin property.
Network Lobby Manager & Lobby Player (#356) * Initial Commit with Unity's Network Lobby Components * Lobby Components WIP * Massive simplifications and structural changes to NetworkLobbyManager and NetworkLobbyPlayer * Replaced more default messages with Command structure resulting in further simplification and less LOC * Completed removal of messages * Code Formatting and GUI Layout * Fixed bugs and finished Remove feature in UI * Added Network Lobby Manager Doc * Network Lobby Docs * Network Lobby Player Doc * Updated doc and image about Offline Scene * changed to PNG * Added Lobby components to navigation * Conformed to naming convention Removed some leftover cruft Removed maxPlayers (redundant to maxConnections) Trapped and killed null ref in OnServerDisconnect * Fixed mistake in OnServerDisconnect * Fix Active Scene check * Alow clean switch to Offline scene * Add Help URL attributes to components * Added Help URL Attributes * Fixed OnGUI logic error. * Added Example and README * Fixed Disconnect handler * Updated Docs * Added Header for Inspector * Finished Lobby Example Minigame * Minor cleanup * Set targetFramerates * Code Cleanup Changed to extended Lobby Manager for player Indexes & colors * Minor changes to align with Mirror's NetworkManager * Fixed logic error * SyncVar Hook Workaround Random Start Positions * Revert making CallOnClientEnterLobby public * Added documentation to the extension * Minor code rearrangement * Made OnGUI virtual so it can be overridden. Added AllPlayersReady bool for convenience to extenders Start Game enhancement to example. * added comments * Corrected namespaces and usings * Reworked DontDestroyOnLoad LobbyPlayer: Moved code from OnStartClient to Start Added LobbyPlayerExt to Lobby Example Code cleanup, added regions Fixed Start Game button bug * Final push of Lobby example to make sure it's complete. * Improved Lobby Example * Code cleanup * Added ground texture Set player camera angle Adjusted lighting angle * Updated ReadMe Cleaned up privates Fixed example to use SetParent Changed to 5 max connections in example * Prefab name fixes due to Mirror master's changes Changed camera handling and GamePlayer Prefab Two more SetParent fixes Demoted two warnings to information Added more comments to example scripts * Revisions based on Vis2K review...more to come. * Added f's where assigning literals to floats * Removed manual calls to SyncVar Hooks because the bug is now fixed. * Changed to GUILayout * wrapped in namespace * Changed to GUILayout * All changes per peer review * Renamed folder to Lobby. * Fix due to change in Mirror 1691 * Renamed Scenes Added LobbyScene property to OfflineGUI script.
2019-02-20 15:58:50 +00:00
A game object with a Network Lobby Player component must also have a Network Identity component. When you create a Network Lobby Player component on a game object, Unity also creates a Network Identity component on that game object if it does not already have one.
Network Lobby Manager & Lobby Player (#356) * Initial Commit with Unity's Network Lobby Components * Lobby Components WIP * Massive simplifications and structural changes to NetworkLobbyManager and NetworkLobbyPlayer * Replaced more default messages with Command structure resulting in further simplification and less LOC * Completed removal of messages * Code Formatting and GUI Layout * Fixed bugs and finished Remove feature in UI * Added Network Lobby Manager Doc * Network Lobby Docs * Network Lobby Player Doc * Updated doc and image about Offline Scene * changed to PNG * Added Lobby components to navigation * Conformed to naming convention Removed some leftover cruft Removed maxPlayers (redundant to maxConnections) Trapped and killed null ref in OnServerDisconnect * Fixed mistake in OnServerDisconnect * Fix Active Scene check * Alow clean switch to Offline scene * Add Help URL attributes to components * Added Help URL Attributes * Fixed OnGUI logic error. * Added Example and README * Fixed Disconnect handler * Updated Docs * Added Header for Inspector * Finished Lobby Example Minigame * Minor cleanup * Set targetFramerates * Code Cleanup Changed to extended Lobby Manager for player Indexes & colors * Minor changes to align with Mirror's NetworkManager * Fixed logic error * SyncVar Hook Workaround Random Start Positions * Revert making CallOnClientEnterLobby public * Added documentation to the extension * Minor code rearrangement * Made OnGUI virtual so it can be overridden. Added AllPlayersReady bool for convenience to extenders Start Game enhancement to example. * added comments * Corrected namespaces and usings * Reworked DontDestroyOnLoad LobbyPlayer: Moved code from OnStartClient to Start Added LobbyPlayerExt to Lobby Example Code cleanup, added regions Fixed Start Game button bug * Final push of Lobby example to make sure it's complete. * Improved Lobby Example * Code cleanup * Added ground texture Set player camera angle Adjusted lighting angle * Updated ReadMe Cleaned up privates Fixed example to use SetParent Changed to 5 max connections in example * Prefab name fixes due to Mirror master's changes Changed camera handling and GamePlayer Prefab Two more SetParent fixes Demoted two warnings to information Added more comments to example scripts * Revisions based on Vis2K review...more to come. * Added f's where assigning literals to floats * Removed manual calls to SyncVar Hooks because the bug is now fixed. * Changed to GUILayout * wrapped in namespace * Changed to GUILayout * All changes per peer review * Renamed folder to Lobby. * Fix due to change in Mirror 1691 * Renamed Scenes Added LobbyScene property to OfflineGUI script.
2019-02-20 15:58:50 +00:00
![Network Lobby Player](NetworkLobbyPlayer.PNG)
2019-07-06 16:34:31 +00:00
- **Show Lobby GUI**
Enable this to show the developer GUI for players in the lobby. This UI is only intended to be used for ease of development. This is enabled by default.
- **Ready To Begin**
Enable this to have lobby players automatically be set to Ready.
- **Index**
Sequential index of the player, e.g. Player 1, Player 2, etc.
- **Network Sync Interval**
The rate at which information is sent from the Network Lobby Player to the server.
2019-07-06 17:18:02 +00:00
## Methods
### Client Virtual Methods
2019-07-07 06:05:45 +00:00
```cs
2019-07-06 17:18:02 +00:00
public virtual void OnClientEnterLobby() {}
public virtual void OnClientExitLobby() {}
public virtual void OnClientReady(bool readyState) {}
```