From: brady Date: Wed, 31 Mar 2010 07:46:58 +0000 (+0000) Subject: Added more comments to gui code, lots of refactoring still needed. Probably will... X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=d77039298ad2420042b26799c0afdb916572f2b0;p=chaz%2Fcarfire Added more comments to gui code, lots of refactoring still needed. Probably will never get done. git-svn-id: https://bd85.net/svn/cs3505_group@48 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 6eaaf18..08efb7c 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 @@ -14,6 +14,7 @@ namespace CS_3505_Project_06 { public class lobbyGUI : ILobby { + #region local variables float scale; Texture2D background; @@ -65,6 +66,8 @@ namespace CS_3505_Project_06 String chatMessage; Queue currentChat; + + private enum lobbyState { Welcome, @@ -76,6 +79,7 @@ namespace CS_3505_Project_06 } lobbyState currentState; + #endregion public lobbyGUI() { @@ -136,7 +140,9 @@ namespace CS_3505_Project_06 } - // TODO: New method. + /// + /// Transition into connected state + /// void JoinedSession(NetworkSession session, NetworkGame networkGame) { if (session != null) @@ -151,19 +157,26 @@ namespace CS_3505_Project_06 } } - // TODO: New method. + /// + /// Called when Async FindSession returns. Available sessions is then updated + /// void FoundSessions(AvailableNetworkSessionCollection sessions, NetworkGame networkGame) { availableSessions = sessions; } - // TODO: New method. + /// + /// Catches exceptions for and Async calls + /// void AsyncCallbackFailed(Exception exception, NetworkGame networkGame) { currentState = lobbyState.Welcome; Console.WriteLine("Exception as thrown during async call: " + exception.Message); } + /// + /// Adds and new chats to the chat list. If chat list is full, older messages are removed. + /// private void UpdateChat(GameTime gameTime, NetworkGame networkGame) { List chts = networkGame.ReceiveChats(); @@ -181,6 +194,9 @@ namespace CS_3505_Project_06 } + /// + /// Main update call for Lobby, what is actually updated is determined by what the current state is. + /// public long Update(GameTime gameTime, NetworkGame networkGame) { @@ -310,7 +326,7 @@ namespace CS_3505_Project_06 } } - else + else //normal op mode { UpdateChat(gameTime, networkGame); chatMessage = ""; @@ -437,6 +453,9 @@ namespace CS_3505_Project_06 return 1; } + /// + /// Updates backgound animation with moving spotlight. Spotlight bounces off walls + /// private void UpdateSpotLight(GameTime gameTime) { spotLightPos = new Vector2(spotLightPos.X + spotLightVelocity.X * (float)gameTime.ElapsedGameTime.TotalSeconds, @@ -452,6 +471,9 @@ namespace CS_3505_Project_06 } } + /// + /// Draws the list of current chat messages received by the local client. + /// private void DrawChatInfo(SpriteBatch spriteBatch) { if (currentChat.Count > 0) @@ -467,6 +489,9 @@ namespace CS_3505_Project_06 spriteBatch.DrawString(menuFont, chatMessage, new Vector2(400, 10 + 15*(currentChat.Count + 1)), Color.Green, 0f, zero, .6f, SpriteEffects.None, 1f); } + /// + /// Draws player list objects for the connected state. + /// private void DrawPlayerList(SpriteBatch spriteBatch) {