Mirror/doc/articles/Components/NetworkLobbyManager.md
Paul Pacheco 35fee94d56
docs: switch to docfx for documentation (#1026)
* Moved doc files to docfx folder

* load csproj

* doc generation

* Run docfx

* Add docfx

* Deploy docs to mirror-networking.com

* use deploy phase

* deploy whole generated site

* Fixed the semantic release command

* Is last \ required?

* show debug log

* using lftp for site deploy

* Testing lftp

* Show current folder

* try -e command option

* Show me the files

* use plain ftp

* use choco install instead of cinst

* fix ssl certificate validation

* fix username

* Upload site to xmldocs folder

* no need to archive docs

* No need for debug output

* Fix file permissions

* show me .htaccess

* Show me contents

* Wipe out folder to fix permissions

* Set file permissions

* Fix file permissions

* complete toc list

* Migrated intro page

* Remove old docs

* Update link to docs

* Add link to github

* Only update docs for stuff in master

* This is a powershell command

* Update doc/articles/Concepts/Communications/RemoteActions.md

* Update doc/articles/Concepts/VisibilityCustom.md

* Update doc/articles/Concepts/Authority.md

* Update doc/articles/Concepts/GameObjects/SpawnObjectCustom.md

* Update doc/articles/Concepts/Authority.md

* Update doc/articles/Classes/SyncVars.md

* No need to run semver twice
2019-08-24 10:20:33 -05:00

3.2 KiB

NetworkLobbyManager

**Please see the Lobby example in the Examples folder in your Mirror folder

The Network Lobby Manager is a specialized type of Network Manager that provides a multiplayer lobby before entering the main play scene of the game. It allows you to set up a network with:

  • A maximum player limit

  • Automatic start when all players are ready

  • Option to prevent players from joining a game in progress

  • Customizable ways for players to choose options while in lobby  

There are two types of player objects with the Network Lobby Manager:

Lobby Player Prefab

  • One for each player

  • Created when client connects, or player is added

  • Persists until client disconnects

  • Holds ready flag and configuration data

  • Handles commands in the lobby

  • Must use the Network Lobby Player component

Player Prefab

  • One for each player

  • Created when game scene is started

  • Destroyed when leaving game scene

  • Handles commands in the game  

Network Lobby Manager

Properties

  • Show Lobby GUI
    Show the default OnGUI controls for the lobby.

  • Min Players
    Minimum number of players needed to start a game.

  • Lobby Player Prefab
    The prefab to create for players when they enter the lobby (requires Network Lobby Player component).

  • Lobby Scene
    The scene to use for the lobby.

  • Gameplay Scene
    The scene to use for main game play.

  • pendingPlayers
    List<PendingPlayer> that holds players that are ready to start playing.

  • lobbySlots
    List<NetworkLobbyPlayer> that manages the slots for connected clients in the lobby.

  • allPlayersReady
    Bool indicating if all players are ready to start playing. This value changes as players invoke CmdChangeReadyState indicating true or false, and will be set false when a new client connects.

Methods

Server Virtual Methods

public virtual void OnLobbyStartHost() {}

public virtual void OnLobbyStopHost() {}

public virtual void OnLobbyStartServer() {}

public virtual void OnLobbyServerConnect(NetworkConnection conn) {}

public virtual void OnLobbyServerDisconnect(NetworkConnection conn) {}

public virtual void OnLobbyServerSceneChanged(string sceneName) {}

public virtual GameObject OnLobbyServerCreateLobbyPlayer(NetworkConnection conn)
{
    return null;
}

public virtual GameObject OnLobbyServerCreateGamePlayer(NetworkConnection conn)
{
    return null;
}

public virtual bool OnLobbyServerSceneLoadedForPlayer(GameObject lobbyPlayer, GameObject gamePlayer)
{
    return true;
}

public virtual void OnLobbyServerPlayersReady()
{
    ServerChangeScene(GameplayScene);
}

Client Virtual Methods

public virtual void OnLobbyClientEnter() {}

public virtual void OnLobbyClientExit() {}

public virtual void OnLobbyClientConnect(NetworkConnection conn) {}

public virtual void OnLobbyClientDisconnect(NetworkConnection conn) {}

public virtual void OnLobbyStartClient() {}

public virtual void OnLobbyStopClient() {}

public virtual void OnLobbyClientSceneChanged(NetworkConnection conn) {}

public virtual void OnLobbyClientAddPlayerFailed() {}