]> Dogcows Code - chaz/carfire/blobdiff - Project06/CS 3505 Project 06/CS 3505 Project 06/LobbyGUI.cs
fixed problems with the join-game screen; can now join one of up to four games listed,
[chaz/carfire] / Project06 / CS 3505 Project 06 / CS 3505 Project 06 / LobbyGUI.cs
index 8fd3db8f626ed7801c5abceb4f32507dfee8a2bb..74bc9a7d4305b8f06430f3c70a5469e87aa6eec8 100644 (file)
@@ -269,22 +269,27 @@ namespace CS_3505_Project_06
                         currentState = lobbyState.FindGame;\r
                     else if (availableSessions != null && availableSessions.Count > 0)\r
                     {\r
-                        if (currentKeyboardState.IsKeyDown(Keys.D1) && previousKeyboardState.IsKeyUp(Keys.D1))\r
+                        if (currentKeyboardState.IsKeyDown(Keys.D1) && previousKeyboardState.IsKeyUp(Keys.D1) && availableSessions.Count > 0)\r
                         {\r
                             networkGame.JoinSession(availableSessions[0], JoinedSession);\r
-                            currentState = lobbyState.JoiningGame;\r
-\r
-                            availableSessions.Dispose();\r
-                            availableSessions = null;\r
                         }\r
-                        if (currentKeyboardState.IsKeyDown(Keys.D2) && previousKeyboardState.IsKeyUp(Keys.D2))\r
+                        else if (currentKeyboardState.IsKeyDown(Keys.D2) && previousKeyboardState.IsKeyUp(Keys.D2) && availableSessions.Count > 1)\r
                         {\r
-                            networkGame.JoinSession(availableSessions[0], JoinedSession);\r
-                            currentState = lobbyState.JoiningGame;\r
-\r
-                            availableSessions.Dispose();\r
-                            availableSessions = null;\r
+                            networkGame.JoinSession(availableSessions[1], JoinedSession);\r
+                        }\r
+                        else if (currentKeyboardState.IsKeyDown(Keys.D3) && previousKeyboardState.IsKeyUp(Keys.D3) && availableSessions.Count > 2)\r
+                        {\r
+                            networkGame.JoinSession(availableSessions[2], JoinedSession);\r
                         }\r
+                        else if (currentKeyboardState.IsKeyDown(Keys.D4) && previousKeyboardState.IsKeyUp(Keys.D4) && availableSessions.Count > 3)\r
+                        {\r
+                            networkGame.JoinSession(availableSessions[3], JoinedSession);\r
+                        }\r
+\r
+                        currentState = lobbyState.JoiningGame;\r
+\r
+                        availableSessions.Dispose();\r
+                        availableSessions = null;\r
                     }\r
 \r
                     break;\r
This page took 0.020905 seconds and 4 git commands to generate.