X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=Project06%2FCS%203505%20Project%2006%2FCS%203505%20Project%2006%2FLobbyGUI.cs;h=8f45156c015f8a770669d0a8ed35b5b0feecc83f;hb=775a5b88d6eca31edc79446cd43c2ae292197931;hp=8fd3db8f626ed7801c5abceb4f32507dfee8a2bb;hpb=fb60f1b299b1cc1f30986d05650032711ef3932c;p=chaz%2Fcarfire diff --git a/Project06/CS 3505 Project 06/CS 3505 Project 06/LobbyGUI.cs b/Project06/CS 3505 Project 06/CS 3505 Project 06/LobbyGUI.cs index 8fd3db8..8f45156 100644 --- a/Project06/CS 3505 Project 06/CS 3505 Project 06/LobbyGUI.cs +++ b/Project06/CS 3505 Project 06/CS 3505 Project 06/LobbyGUI.cs @@ -269,22 +269,27 @@ namespace CS_3505_Project_06 currentState = lobbyState.FindGame; else if (availableSessions != null && availableSessions.Count > 0) { - if (currentKeyboardState.IsKeyDown(Keys.D1) && previousKeyboardState.IsKeyUp(Keys.D1)) + if (currentKeyboardState.IsKeyDown(Keys.D1) && previousKeyboardState.IsKeyUp(Keys.D1) && availableSessions.Count > 0) { networkGame.JoinSession(availableSessions[0], JoinedSession); - currentState = lobbyState.JoiningGame; - - availableSessions.Dispose(); - availableSessions = null; } - if (currentKeyboardState.IsKeyDown(Keys.D2) && previousKeyboardState.IsKeyUp(Keys.D2)) + else if (currentKeyboardState.IsKeyDown(Keys.D2) && previousKeyboardState.IsKeyUp(Keys.D2) && availableSessions.Count > 1) { - networkGame.JoinSession(availableSessions[0], JoinedSession); - currentState = lobbyState.JoiningGame; - - availableSessions.Dispose(); - availableSessions = null; + networkGame.JoinSession(availableSessions[1], JoinedSession); + } + else if (currentKeyboardState.IsKeyDown(Keys.D3) && previousKeyboardState.IsKeyUp(Keys.D3) && availableSessions.Count > 2) + { + networkGame.JoinSession(availableSessions[2], JoinedSession); } + else if (currentKeyboardState.IsKeyDown(Keys.D4) && previousKeyboardState.IsKeyUp(Keys.D4) && availableSessions.Count > 3) + { + networkGame.JoinSession(availableSessions[3], JoinedSession); + } + + currentState = lobbyState.JoiningGame; + + availableSessions.Dispose(); + availableSessions = null; } break; @@ -441,7 +446,7 @@ namespace CS_3505_Project_06 case lobbyState.Connected: DrawPlayerList(spriteBatch); DrawChatInfo(spriteBatch); - if(allReady && players.Count == 2 && localPlayer == players[0]) + if(allReady && players.Count == 4 && localPlayer == players[0]) spriteBatch.DrawString(menuFont, "Press B to begin game!", new Vector2(MaxX / 2, MaxY / 2), Color.White, 0f, zero, .7f, SpriteEffects.None, 0.5f); else if(allReady) spriteBatch.DrawString(menuFont, "The game will begin soon.", new Vector2(MaxX / 2, MaxY / 2), Color.White, 0f, zero, .7f, SpriteEffects.None, 0.5f);