\r
private void UpdateChat(GameTime gameTime, NetworkGame networkGame)\r
{\r
- currentChat.Concat(networkGame.ReceiveChats());\r
+ List<ChatInfo> chts = networkGame.ReceiveChats();\r
+ for (int x = 0; x < chts.Count(); x++)\r
+ currentChat.Enqueue(chts[x]);\r
+ //if number of chat messages has reached max remove older messages as new ones are added\r
+ if (currentChat.Count() > 8)\r
+ {\r
+ for (int x = 0; x < chts.Count(); x++)\r
+ {\r
+ currentChat.Dequeue();\r
+ }\r
+ }\r
\r
}\r
\r
}\r
}\r
\r
-\r
- Console.WriteLine("Finding");\r
break;\r
+\r
case lobbyState.Connected:\r
- if (chatActive)\r
+ if (chatActive) //If chat is activated by pressing T all inputs go to chat. Enter finishes chat esc returns\r
{\r
+ if (currentKeyboardState.IsKeyDown(Keys.Escape) && previousKeyboardState.IsKeyUp(Keys.Escape))\r
+ {\r
+ chatActive = false;\r
+ break;\r
+ }\r
if (currentKeyboardState.IsKeyDown(Keys.Enter) && previousKeyboardState.IsKeyUp(Keys.Enter))\r
{\r
networkGame.SendChat(chatMessage);\r
for (int y = 0; y < currentChat.Count; y++)\r
{\r
spriteBatch.DrawString(menuFont, currentChat.ElementAt(y).Sender + ": " + currentChat.ElementAt(y).Message\r
- , new Vector2(400, 100 - y*10), Color.Blue, 0f, zero, .6f, SpriteEffects.None, 1f);\r
+ , new Vector2(400, 10 + y*15), Color.Blue, 0f, zero, .6f, SpriteEffects.None, 1f);\r
}\r
\r
}\r
if(chatActive)\r
- spriteBatch.DrawString(menuFont, chatMessage, new Vector2(400, 100), Color.Green, 0f, zero, .6f, SpriteEffects.None, 1f);\r
+ spriteBatch.DrawString(menuFont, chatMessage, new Vector2(400, 10 + 15*(currentChat.Count + 1)), Color.Green, 0f, zero, .6f, SpriteEffects.None, 1f);\r
}\r
\r
private void DrawPlayerList(SpriteBatch spriteBatch)\r
spriteBatch.DrawString(menuFont, "Command Options: to mark your self as ready", new Vector2(20, 20), Color.Gray, 0f, zero, .6f, SpriteEffects.None, 1f);\r
spriteBatch.DrawString(menuFont, "type players # to toggle chat", new Vector2(175, 40), Color.Gray, 0f, zero, .6f, SpriteEffects.None, 1f);\r
spriteBatch.DrawString(menuFont, "return to main menu", new Vector2(175, 60), Color.Gray, 0f, zero, .6f, SpriteEffects.None, 1f);\r
+ spriteBatch.DrawString(menuFont, "enter chat mode", new Vector2(175, 80), Color.Gray, 0f, zero, .6f, SpriteEffects.None, 1f);\r
spriteBatch.DrawString(menuFont, "R", new Vector2(145, 20), Color.DarkGreen, 0f, zero, .6f, SpriteEffects.None, 1f);\r
spriteBatch.DrawString(menuFont, "#", new Vector2(145, 40), Color.DarkGreen, 0f, zero, .6f, SpriteEffects.None, 1f);\r
spriteBatch.DrawString(menuFont, "X", new Vector2(145, 60), Color.DarkGreen, 0f, zero, .6f, SpriteEffects.None, 1f);\r
- \r
+ spriteBatch.DrawString(menuFont, "T", new Vector2(145, 80), Color.DarkGreen, 0f, zero, .6f, SpriteEffects.None, 1f);\r
+\r
//Background squares\r
spriteBatch.Draw(menuItem, topOfList, null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
spriteBatch.Draw(menuItem, new Vector2(topOfList.X, topOfList.Y + 65), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r