From: brady Date: Tue, 30 Mar 2010 23:50:17 +0000 (+0000) Subject: Gui Finding X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=af55a699b4aac0663eea9dd5330505809e7f87e8;p=chaz%2Fcarfire Gui Finding git-svn-id: https://bd85.net/svn/cs3505_group@41 92bb83a3-7c8f-8a45-bc97-515c4e399668 --- 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 78ee37b..c79b6a7 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 @@ -149,20 +149,20 @@ namespace CS_3505_Project_06 { availableSessions = sessions; - if (availableSessions != null && availableSessions.Count > 0) - { - networkGame.JoinSession(availableSessions[0], JoinedSession); - currentState = lobbyState.JoiningGame; - - availableSessions.Dispose(); - availableSessions = null; - } - else - { - // TODO: This should do something more than just throw the player back to the welcome screen. - currentState = lobbyState.Welcome; - Console.WriteLine("No sessions to join!"); - } + //if (availableSessions != null && availableSessions.Count > 0) + //{ + // networkGame.JoinSession(availableSessions[0], JoinedSession); + // currentState = lobbyState.JoiningGame; + + // availableSessions.Dispose(); + // availableSessions = null; + //} + //else + //{ + // // TODO: This should do something more than just throw the player back to the welcome screen. + // currentState = lobbyState.Welcome; + // Console.WriteLine("No sessions to join!"); + //} } // TODO: New method. @@ -229,11 +229,43 @@ namespace CS_3505_Project_06 currentState = lobbyState.Welcome; ready = false; } + availableSessions = null; networkGame.ErrorDelegate = AsyncCallbackFailed; networkGame.FindSessions(FoundSessions); currentState = lobbyState.FindingGames; break; + case lobbyState.FindingGames: + if (currentKeyboardState.IsKeyDown(Keys.X) && previousKeyboardState.IsKeyUp(Keys.X)) + { + currentState = lobbyState.Welcome; + ready = false; + } + if (availableSessions != null && availableSessions.Count == 0) + currentState = lobbyState.FindGame; + else if (availableSessions != null && availableSessions.Count > 0) + { + if (currentKeyboardState.IsKeyDown(Keys.D1) && previousKeyboardState.IsKeyUp(Keys.D1)) + { + networkGame.JoinSession(availableSessions[0], JoinedSession); + currentState = lobbyState.JoiningGame; + + availableSessions.Dispose(); + availableSessions = null; + } + if (currentKeyboardState.IsKeyDown(Keys.D2) && previousKeyboardState.IsKeyUp(Keys.D2)) + { + networkGame.JoinSession(availableSessions[0], JoinedSession); + currentState = lobbyState.JoiningGame; + + availableSessions.Dispose(); + availableSessions = null; + } + } + + + Console.WriteLine("Finding"); + break; case lobbyState.Connected: if (currentKeyboardState.IsKeyDown(Keys.X) && previousKeyboardState.IsKeyUp(Keys.X)) { @@ -244,6 +276,7 @@ namespace CS_3505_Project_06 networkGame.LeaveSession(); } currentState = lobbyState.Welcome; + } if (currentKeyboardState.IsKeyDown(Keys.R) && previousKeyboardState.IsKeyUp(Keys.R)) networkGame.LocalGamer.IsReady = true;