From d9616289a57884beaed219a583076cf910810e2d Mon Sep 17 00:00:00 2001 From: brady Date: Wed, 31 Mar 2010 07:37:02 +0000 Subject: [PATCH] Chat display finished and working pretty good. git-svn-id: https://bd85.net/svn/cs3505_group@47 92bb83a3-7c8f-8a45-bc97-515c4e399668 --- .../CS 3505 Project 06/LobbyGUI.cs | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) 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 bc73eef..6eaaf18 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 @@ -169,6 +169,7 @@ namespace CS_3505_Project_06 List chts = networkGame.ReceiveChats(); for (int x = 0; x < chts.Count(); x++) currentChat.Enqueue(chts[x]); + //if number of chat messages has reached max remove older messages as new ones are added if (currentChat.Count() > 8) { @@ -300,7 +301,9 @@ namespace CS_3505_Project_06 foreach(Keys ky in newKeys) { - if(ky.Equals(Keys.Space)) + if (ky.Equals(Keys.Back)) + chatMessage = chatMessage.Substring(0, chatMessage.Length-1); + else if(ky.Equals(Keys.Space)) chatMessage = chatMessage + " "; else chatMessage = chatMessage + ky.ToString(); @@ -318,6 +321,7 @@ namespace CS_3505_Project_06 if (currentKeyboardState.IsKeyDown(Keys.X) && previousKeyboardState.IsKeyUp(Keys.X)) { ready = false; + currentChat.Clear(); if (networkGame.HasActiveSession) { players = null; @@ -397,6 +401,7 @@ namespace CS_3505_Project_06 case lobbyState.FindingGames: spriteBatch.Draw(selectGameScreen, backgroundPos, null, Color.White, 0, zero, scale, SpriteEffects.None, 0); + spriteBatch.DrawString(menuFont, "select game by pressing listed games index", new Vector2(250, 400), Color.Gray, 0f, zero, .7f, SpriteEffects.None, 0.5f); if(availableSessions == null) spriteBatch.DrawString(menuFont, "searching for available games ....", new Vector2(150, 100), Color.Gray, 0f, zero, .7f, SpriteEffects.None, 0.5f); else if (availableSessions.Count == 0) @@ -410,9 +415,9 @@ namespace CS_3505_Project_06 if (sessionIndex == selectedSessionIndex) color = Color.Red; - spriteBatch.DrawString(menuFont, availableSessions[sessionIndex].HostGamertag, new Vector2(150, 100 + sessionIndex * menuFont.LineSpacing), color, 0f, zero, .7f, SpriteEffects.None, 0.5f); - spriteBatch.DrawString(menuFont, availableSessions[sessionIndex].CurrentGamerCount + " / " + availableSessions[sessionIndex].OpenPublicGamerSlots + availableSessions[sessionIndex].OpenPrivateGamerSlots, - new Vector2(400, 100 + sessionIndex * menuFont.LineSpacing), color, 0f, zero, .7f, SpriteEffects.None, 0.5f); + spriteBatch.DrawString(menuFont, sessionIndex+1 + " " + availableSessions[sessionIndex].HostGamertag, new Vector2(150, 125 + sessionIndex * menuFont.LineSpacing), color, 0f, zero, .7f, SpriteEffects.None, 0.5f); + spriteBatch.DrawString(menuFont, availableSessions[sessionIndex].CurrentGamerCount + " / 4", + new Vector2(450, 125 + sessionIndex * menuFont.LineSpacing), color, 0f, zero, .7f, SpriteEffects.None, 0.5f); } } break; @@ -472,12 +477,12 @@ namespace CS_3505_Project_06 spriteBatch.DrawString(menuFont, "Current Players", new Vector2(topOfList.X + 15, topOfList.Y - 25), Color.White); spriteBatch.DrawString(menuFont, "Command Options: to mark your self as ready", new Vector2(20, 20), Color.Gray, 0f, zero, .6f, SpriteEffects.None, 1f); spriteBatch.DrawString(menuFont, "type players # to toggle chat", new Vector2(175, 40), Color.Gray, 0f, zero, .6f, SpriteEffects.None, 1f); - spriteBatch.DrawString(menuFont, "return to main menu", new Vector2(175, 60), Color.Gray, 0f, zero, .6f, SpriteEffects.None, 1f); - spriteBatch.DrawString(menuFont, "enter chat mode", new Vector2(175, 80), Color.Gray, 0f, zero, .6f, SpriteEffects.None, 1f); + spriteBatch.DrawString(menuFont, "return to main menu", new Vector2(175, 80), Color.Gray, 0f, zero, .6f, SpriteEffects.None, 1f); + spriteBatch.DrawString(menuFont, "enter chat mode", new Vector2(175, 60), Color.Gray, 0f, zero, .6f, SpriteEffects.None, 1f); spriteBatch.DrawString(menuFont, "R", new Vector2(145, 20), Color.DarkGreen, 0f, zero, .6f, SpriteEffects.None, 1f); spriteBatch.DrawString(menuFont, "#", new Vector2(145, 40), Color.DarkGreen, 0f, zero, .6f, SpriteEffects.None, 1f); - spriteBatch.DrawString(menuFont, "X", new Vector2(145, 60), Color.DarkGreen, 0f, zero, .6f, SpriteEffects.None, 1f); - spriteBatch.DrawString(menuFont, "T", new Vector2(145, 80), Color.DarkGreen, 0f, zero, .6f, SpriteEffects.None, 1f); + spriteBatch.DrawString(menuFont, "X", new Vector2(145, 80), Color.DarkGreen, 0f, zero, .6f, SpriteEffects.None, 1f); + spriteBatch.DrawString(menuFont, "T", new Vector2(145, 60), Color.DarkGreen, 0f, zero, .6f, SpriteEffects.None, 1f); //Background squares spriteBatch.Draw(menuItem, topOfList, null, Color.White, 0, zero, scale, SpriteEffects.None, 1f); @@ -526,7 +531,7 @@ namespace CS_3505_Project_06 spriteBatch.DrawString(menuFont, "Chat with", new Vector2(topOfList.X + 152, topOfList.Y + 240), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f); //Chat CheckBoxs - Boolean chatwith = false; // change to reflect info from network, move to update and create one for each player + Boolean chatwith = true; // change to reflect info from network, move to update and create one for each player if (!chatwith) spriteBatch.Draw(deselectBox, new Vector2(topOfList.X +218, topOfList.Y + 35), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f); else -- 2.45.2