]> Dogcows Code - chaz/carfire/commitdiff
fixed problems with the join-game screen; can now join one of up to four games listed,
authorCharles <Charles@92bb83a3-7c8f-8a45-bc97-515c4e399668>
Sat, 3 Apr 2010 02:54:49 +0000 (02:54 +0000)
committerCharles <Charles@92bb83a3-7c8f-8a45-bc97-515c4e399668>
Sat, 3 Apr 2010 02:54:49 +0000 (02:54 +0000)
and fixed the bug which made it pick the first game every time.

git-svn-id: https://bd85.net/svn/cs3505_group@51 92bb83a3-7c8f-8a45-bc97-515c4e399668

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.025323 seconds and 4 git commands to generate.