/// <summary> /// Handles user input for all the local gamers in the session. Unlike most /// screens, which use the InputState class to combine input data from all /// gamepads, the lobby needs to individually mark specific players as ready, /// so it loops over all the local gamers and reads their inputs individually. /// </summary> public override void HandleInput(InputState input) { foreach (LocalNetworkGamer gamer in networkSession.LocalGamers) { PlayerIndex playerIndex = gamer.SignedInGamer.PlayerIndex; PlayerIndex unwantedOutput; if (input.IsMenuSelect(playerIndex, out unwantedOutput)) { HandleMenuSelect(gamer); } else if (input.IsMenuCancel(playerIndex, out unwantedOutput)) { HandleMenuCancel(gamer); } else if (input.IsMenuUp(playerIndex)) { localGamer.SetLocalPlayerCount(1); } else if (input.IsMenuDown(playerIndex)) { localGamer.SetLocalPlayerCount(-1); } } }
/// <summary> /// Constructs a new lobby screen. /// </summary> public LobbyScreen(NetworkSession networkSession) { this.networkSession = networkSession; localGamer = networkSession.LocalGamers[0]; localGamer.SetLocalPlayerCount(0); TransitionOnTime = TimeSpan.FromSeconds(0.5); TransitionOffTime = TimeSpan.FromSeconds(0.5); }