using System.Collections.Generic;\r
using System.Linq;\r
using System.Text;\r
+using Microsoft.Xna.Framework.Net;\r
+using System.Diagnostics;\r
+using Microsoft.Xna.Framework.GamerServices;\r
+using Microsoft.Xna.Framework.Graphics;\r
using Microsoft.Xna.Framework;\r
+using Microsoft.Xna.Framework.Input;\r
using Microsoft.Xna.Framework.Content;\r
-using Microsoft.Xna.Framework.Graphics;\r
\r
namespace CarFire\r
{\r
class ScreenManager : IScreenManager\r
{\r
- #region ILobby Members\r
+ #region local variables\r
+ float scale;\r
+\r
+ Texture2D background;\r
+ Texture2D spotLight;\r
+ Texture2D cs;\r
+ Texture2D selectGameScreen;\r
+\r
+ Vector2 backgroundPos;\r
+ Vector2 spotLightPos;\r
+ Vector2 spotLightCenter;\r
+ Vector2 csPos;\r
+\r
+ Vector2 zero;\r
+ Vector2 spotLightVelocity;\r
+\r
+ int MaxX;\r
+ int MinX;\r
+ int MaxY;\r
+ int MinY;\r
+\r
+ Texture2D checkedBox;\r
+ Texture2D deselectBox;\r
+ Texture2D emptySelectBox;\r
+ Texture2D menuItem;\r
+\r
+ Boolean ready;\r
+\r
+ SpriteFont menuFont;\r
+ string selected;\r
+ Vector2 createGamePos;\r
+ string createGameText;\r
+ Vector2 findGamePos;\r
+ string findGameText;\r
+\r
+ Vector2 returnToMainPos;\r
+ string returnToMainText;\r
+\r
+ KeyboardState previousKeyboardState;\r
+ KeyboardState currentKeyboardState;\r
+\r
+ GamerCollection<NetworkGamer> players;\r
+ LocalNetworkGamer localPlayer;\r
+ AvailableNetworkSessionCollection availableSessions;\r
+ bool allReady;\r
+\r
+ int selectedSessionIndex;\r
+\r
+ bool chatActive;\r
+ String chatMessage;\r
+ Queue<ChatInfo> currentChat;\r
+\r
+ \r
+\r
+ private enum lobbyState\r
+ {\r
+ Welcome,\r
+ CreateGame,\r
+ FindGame,\r
+ FindingGames, // TODO: New state.\r
+ JoiningGame, // TODO: New state.\r
+ Connected\r
+ }\r
+\r
+ lobbyState currentState;\r
+ #endregion\r
+\r
+ public ScreenManager()\r
+ {\r
+ currentState = lobbyState.Welcome;\r
+ selectedSessionIndex = 0;\r
+ ready = false;\r
+ chatActive = false;\r
+ chatMessage = "";\r
+ currentChat = new Queue<ChatInfo>();\r
+ }\r
\r
public void LoadContent(ContentManager contentManager, GraphicsDeviceManager graphics)\r
{\r
+ background = contentManager.Load<Texture2D>("background");\r
+ spotLight = contentManager.Load<Texture2D>("spotlight");\r
+ cs = contentManager.Load<Texture2D>("cs");\r
+ selectGameScreen = contentManager.Load<Texture2D>("selectGameScreen");\r
+ backgroundPos = new Vector2(0f, 0f);\r
+ spotLightPos = new Vector2(100f, graphics.GraphicsDevice.Viewport.Height - 98);\r
+ spotLightCenter = new Vector2(800f, 800f);\r
+ spotLightVelocity = new Vector2(-100, 33);\r
+ csPos = new Vector2(10f, graphics.GraphicsDevice.Viewport.Height - 98);\r
+\r
+ zero = new Vector2(0, 0);\r
+\r
+ MaxX = graphics.GraphicsDevice.Viewport.Width;\r
+ MinX = 0;\r
+ MaxY = graphics.GraphicsDevice.Viewport.Height;\r
+ MinY = 100;\r
+\r
+ scale = MaxX / 1600f;\r
+\r
+ //playerlist stuff\r
+ checkedBox = contentManager.Load<Texture2D>("checkedBox");\r
+ deselectBox = contentManager.Load<Texture2D>("deselectBox");\r
+ emptySelectBox = contentManager.Load<Texture2D>("emptySelectBox");\r
+ menuItem = contentManager.Load<Texture2D>("menuItem");\r
+\r
+ \r
+\r
+ //menu fonts\r
+ menuFont = contentManager.Load<SpriteFont>("menuFont");\r
+ createGamePos = new Vector2(100f, MaxY / 3);\r
+ createGameText = "Create Game";\r
+ selected = createGameText;\r
+\r
+ findGamePos = new Vector2(100f, (MaxY / 3) + 60);\r
+ findGameText = "Find Game";\r
+\r
+ returnToMainPos = new Vector2(MaxX / 2, MaxY - 120);\r
+ returnToMainText = "press [ X ] to return to main menu";\r
+\r
+ \r
}\r
\r
public void UnloadContent()\r
{\r
+ \r
+ }\r
+\r
+ /// <summary>\r
+ /// Transition into connected state\r
+ /// </summary>\r
+ void JoinedSession(NetworkSession session, NetworkManager networkManager)\r
+ {\r
+ if (session != null)\r
+ {\r
+ currentState = lobbyState.Connected;\r
+ }\r
+ else\r
+ {\r
+ // TODO: This should do something more than just throw the player back to the welcome screen.\r
+ currentState = lobbyState.Welcome;\r
+ Console.WriteLine("Couldn't create/join the session.");\r
+ }\r
+ }\r
+\r
+ /// <summary>\r
+ /// Called when Async FindSession returns. Available sessions is then updated\r
+ /// </summary>\r
+ void FoundSessions(AvailableNetworkSessionCollection sessions, NetworkManager networkManager)\r
+ {\r
+ availableSessions = sessions;\r
+ }\r
+\r
+ /// <summary>\r
+ /// Catches exceptions for and Async calls\r
+ /// </summary>\r
+ void AsyncCallbackFailed(Exception exception, NetworkManager networkManager)\r
+ {\r
+ currentState = lobbyState.Welcome;\r
+ Console.WriteLine("Exception as thrown during async call: " + exception.Message);\r
+ }\r
+\r
+ /// <summary>\r
+ /// Adds and new chats to the chat list. If chat list is full, older messages are removed.\r
+ /// </summary>\r
+ private void UpdateChat(GameTime gameTime, NetworkManager networkManager)\r
+ {\r
+ List<ChatInfo> chts = networkManager.ReceiveChats();\r
+ for (int x = 0; x < chts.Count(); x++)\r
+ currentChat.Enqueue(chts[x]);\r
+\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
- public long Update(GameTime gameTime, NetworkManager networkGame)\r
+ /// <summary>\r
+ /// Main update call for Lobby, what is actually updated is determined by what the current state is.\r
+ /// </summary>\r
+ public long Update(GameTime gameTime, NetworkManager networkManager)\r
{\r
- return 0;\r
+ \r
+ UpdateSpotLight(gameTime);\r
+ currentKeyboardState = Keyboard.GetState();\r
+\r
+ if (networkManager.HasActiveSession)\r
+ {\r
+ players = networkManager.NetworkGamers;\r
+ }\r
+\r
+ //check inputs\r
+ switch (currentState)\r
+ {\r
+ case lobbyState.Welcome:\r
+ if (selected == createGameText)\r
+ {\r
+ if (currentKeyboardState.IsKeyDown(Keys.Enter) && previousKeyboardState.IsKeyUp(Keys.Enter))\r
+ currentState = lobbyState.CreateGame;\r
+ if (currentKeyboardState.IsKeyDown(Keys.Down))\r
+ selected = findGameText;\r
+ }\r
+ else\r
+ {\r
+ if (currentKeyboardState.IsKeyDown(Keys.Enter) && previousKeyboardState.IsKeyUp(Keys.Enter))\r
+ currentState = lobbyState.FindGame;\r
+ if (currentKeyboardState.IsKeyDown(Keys.Up))\r
+ selected = createGameText;\r
+ }\r
+ break;\r
+\r
+ case lobbyState.CreateGame:\r
+ if (currentKeyboardState.IsKeyDown(Keys.X) && previousKeyboardState.IsKeyUp(Keys.X))\r
+ {\r
+ currentState = lobbyState.Welcome;\r
+ ready = false;\r
+ if (networkManager.HasActiveSession)\r
+ {\r
+ players = null;\r
+ networkManager.LeaveSession();\r
+ }\r
+ }\r
+ if (currentKeyboardState.IsKeyDown(Keys.Y) && previousKeyboardState.IsKeyUp(Keys.Y))\r
+ {\r
+ currentState = lobbyState.JoiningGame;\r
+ networkManager.ErrorDelegate = AsyncCallbackFailed;\r
+ networkManager.CreateSession(JoinedSession);\r
+ } \r
+ break;\r
+\r
+ case lobbyState.FindGame:\r
+ if (currentKeyboardState.IsKeyDown(Keys.X) && previousKeyboardState.IsKeyUp(Keys.X))\r
+ {\r
+ currentState = lobbyState.Welcome;\r
+ ready = false;\r
+ }\r
+ availableSessions = null;\r
+ networkManager.ErrorDelegate = AsyncCallbackFailed;\r
+ networkManager.FindSessions(FoundSessions);\r
+ currentState = lobbyState.FindingGames;\r
+ break;\r
+\r
+ case lobbyState.FindingGames:\r
+ if (currentKeyboardState.IsKeyDown(Keys.X) && previousKeyboardState.IsKeyUp(Keys.X))\r
+ {\r
+ currentState = lobbyState.Welcome;\r
+ ready = false;\r
+ }\r
+ if (availableSessions != null && availableSessions.Count == 0)\r
+ currentState = lobbyState.FindGame;\r
+ else if (availableSessions != null && availableSessions.Count > 0)\r
+ {\r
+ if (currentKeyboardState.IsKeyDown(Keys.D1) && previousKeyboardState.IsKeyUp(Keys.D1))\r
+ {\r
+ networkManager.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
+ {\r
+ networkManager.JoinSession(availableSessions[0], JoinedSession);\r
+ currentState = lobbyState.JoiningGame;\r
+\r
+ availableSessions.Dispose();\r
+ availableSessions = null;\r
+ }\r
+ }\r
+\r
+ break;\r
+\r
+ case lobbyState.Connected:\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
+ networkManager.SendChat(chatMessage);\r
+ chatActive = false;\r
+ break;\r
+ }\r
+ Keys[] k = currentKeyboardState.GetPressedKeys();\r
+ Keys[] kp = previousKeyboardState.GetPressedKeys();\r
+ List<Keys> newKeys = new List<Keys>();\r
+\r
+ for (int x = 0; x < k.Count(); x++) //copy new keys into array\r
+ {\r
+ if (!kp.Contains(k[x]))\r
+ {\r
+ newKeys.Add(k[x]);\r
+ }\r
+ }\r
+\r
+ foreach(Keys ky in newKeys)\r
+ {\r
+ if (ky.Equals(Keys.Back))\r
+ chatMessage = chatMessage.Substring(0, chatMessage.Length-1);\r
+ else if(ky.Equals(Keys.Space))\r
+ chatMessage = chatMessage + " ";\r
+ else\r
+ chatMessage = chatMessage + ky.ToString();\r
+ }\r
+ \r
+ }\r
+ else //normal op mode\r
+ {\r
+ UpdateChat(gameTime, networkManager);\r
+ chatMessage = "";\r
+ if (currentKeyboardState.IsKeyDown(Keys.T) && previousKeyboardState.IsKeyUp(Keys.T))\r
+ {\r
+ chatActive = true;\r
+ }\r
+ if (currentKeyboardState.IsKeyDown(Keys.X) && previousKeyboardState.IsKeyUp(Keys.X))\r
+ {\r
+ ready = false;\r
+ currentChat.Clear();\r
+ if (networkManager.HasActiveSession)\r
+ {\r
+ players = null;\r
+ networkManager.LeaveSession();\r
+ }\r
+ currentState = lobbyState.Welcome;\r
+\r
+ }\r
+ if (currentKeyboardState.IsKeyDown(Keys.R) && previousKeyboardState.IsKeyUp(Keys.R))\r
+ networkManager.LocalGamer.IsReady = true;\r
+\r
+ if (networkManager.HasActiveSession)\r
+ {\r
+ localPlayer = networkManager.LocalGamer;\r
+ players = networkManager.NetworkGamers;\r
+ if (players != null)\r
+ {\r
+ allReady = true;\r
+ foreach (NetworkGamer p in players)\r
+ if (p.IsReady == false)\r
+ {\r
+ allReady = false;\r
+ break;\r
+ }\r
+ }\r
+\r
+ //allows host to start the game when all players are ready, change count below to different number for testing with less then 4 players\r
+ if (allReady && players.Count == 4 && localPlayer == players[0])\r
+ {\r
+ if (currentKeyboardState.IsKeyDown(Keys.B) && previousKeyboardState.IsKeyUp(Keys.B))\r
+ {\r
+ networkManager.ForceStartGame();\r
+ }\r
+ }\r
+ }\r
+ else\r
+ currentState = lobbyState.Welcome;\r
+ }\r
+ break;\r
+\r
+ }\r
+ previousKeyboardState = Keyboard.GetState();\r
+\r
+ return 1;\r
}\r
\r
+ /// <summary>\r
+ /// Draws the lobby GUI. Has different states for difference menu configurations\r
+ /// </summary>\r
public long Draw(SpriteBatch spriteBatch)\r
{\r
- return 0;\r
+ spriteBatch.Draw(background, backgroundPos, null, Color.White, 0, zero, scale, SpriteEffects.None, 0);\r
+ spriteBatch.Draw(cs, csPos, null, Color.White, 0, zero, 0.5f, SpriteEffects.None, 0);\r
+ spriteBatch.Draw(spotLight, spotLightPos, null, Color.White, 0, spotLightCenter, 1f, SpriteEffects.None, 0);\r
+\r
+ switch (currentState)\r
+ {\r
+ case lobbyState.Welcome:\r
+ spriteBatch.DrawString(menuFont, "press [ Home ] to login", new Vector2(350, 20), Color.LightGray, 0f, zero, .6f, SpriteEffects.None, 0.5f);\r
+ if (selected == createGameText)\r
+ spriteBatch.DrawString(menuFont, createGameText, createGamePos, Color.Red, 0, zero, 1f, SpriteEffects.None, 0.5f);\r
+ else\r
+ spriteBatch.DrawString(menuFont, createGameText, createGamePos, Color.Gray, 0, zero, 1f,SpriteEffects.None, 0.5f);\r
+ if (selected == findGameText)\r
+ spriteBatch.DrawString(menuFont, findGameText, findGamePos, Color.Red, 0, zero, 1f, SpriteEffects.None, 0.5f);\r
+ else\r
+ spriteBatch.DrawString(menuFont, findGameText, findGamePos, Color.Gray, 0, zero, 1f, SpriteEffects.None, 0.5f);\r
+ break;\r
+ \r
+ case lobbyState.CreateGame:\r
+ DrawPlayerList(spriteBatch);\r
+ spriteBatch.DrawString(menuFont, "You are now the Host!", new Vector2(MaxX / 2, MaxY / 3), Color.White, 0f, zero, .7f, SpriteEffects.None, 0.5f);\r
+ spriteBatch.DrawString(menuFont, "press: Y to continue", new Vector2(MaxX /2, (MaxY / 3) + menuFont.LineSpacing), Color.White, 0f, zero, .6f, SpriteEffects.None, 0.5f);\r
+ spriteBatch.DrawString(menuFont, "X to return to main menu", new Vector2(MaxX /2 + 40, (MaxY / 3) + 2 * menuFont.LineSpacing), Color.White, 0f, zero, .6f, SpriteEffects.None, 0.5f);\r
+\r
+ break;\r
+\r
+ case lobbyState.FindingGames:\r
+ spriteBatch.Draw(selectGameScreen, backgroundPos, null, Color.White, 0, zero, scale, SpriteEffects.None, 0);\r
+ spriteBatch.DrawString(menuFont, "select game by pressing listed games index", new Vector2(250, 400), Color.Gray, 0f, zero, .7f, SpriteEffects.None, 0.5f);\r
+ if(availableSessions == null)\r
+ spriteBatch.DrawString(menuFont, "searching for available games ....", new Vector2(150, 100), Color.Gray, 0f, zero, .7f, SpriteEffects.None, 0.5f);\r
+ else if (availableSessions.Count == 0)\r
+ spriteBatch.DrawString(menuFont, "no games currently available, searching ....", new Vector2(150, 100), Color.Gray, 0f, zero, .7f, SpriteEffects.None, 0.5f);\r
+ else\r
+ {\r
+ for (int sessionIndex = 0; sessionIndex < availableSessions.Count; sessionIndex++)\r
+ {\r
+ Color color = Color.Gray;\r
+\r
+ if (sessionIndex == selectedSessionIndex)\r
+ color = Color.Red;\r
+\r
+ spriteBatch.DrawString(menuFont, sessionIndex+1 + " " + availableSessions[sessionIndex].HostGamertag, new Vector2(150, 125 + sessionIndex * menuFont.LineSpacing), color, 0f, zero, .7f, SpriteEffects.None, 0.5f);\r
+ spriteBatch.DrawString(menuFont, availableSessions[sessionIndex].CurrentGamerCount + " / 4",\r
+ new Vector2(450, 125 + sessionIndex * menuFont.LineSpacing), color, 0f, zero, .7f, SpriteEffects.None, 0.5f);\r
+ }\r
+ }\r
+ break;\r
+\r
+ case lobbyState.Connected:\r
+ DrawPlayerList(spriteBatch);\r
+ DrawChatInfo(spriteBatch); \r
+ if(allReady && players.Count == 2 && localPlayer == players[0])\r
+ spriteBatch.DrawString(menuFont, "Press B to begin game!", new Vector2(MaxX / 2, MaxY / 2), Color.White, 0f, zero, .7f, SpriteEffects.None, 0.5f);\r
+ else if(allReady)\r
+ spriteBatch.DrawString(menuFont, "The game will begin soon.", new Vector2(MaxX / 2, MaxY / 2), Color.White, 0f, zero, .7f, SpriteEffects.None, 0.5f);\r
+ else\r
+ spriteBatch.DrawString(menuFont, "Waiting for ready players...", new Vector2(MaxX / 2, MaxY / 2), Color.White, 0f, zero, .7f, SpriteEffects.None, 0.5f);\r
+ break;\r
+ }\r
+\r
+ return 1;\r
+ }\r
+\r
+ /// <summary>\r
+ /// Updates backgound animation with moving spotlight. Spotlight bounces off walls \r
+ /// </summary>\r
+ private void UpdateSpotLight(GameTime gameTime)\r
+ {\r
+ spotLightPos = new Vector2(spotLightPos.X + spotLightVelocity.X * (float)gameTime.ElapsedGameTime.TotalSeconds,\r
+ spotLightPos.Y + spotLightVelocity.Y * (float)gameTime.ElapsedGameTime.TotalSeconds);\r
+\r
+ if (spotLightPos.X > MaxX || spotLightPos.X < MinX) //right or left wall\r
+ {\r
+ spotLightVelocity = new Vector2(spotLightVelocity.X * -1, spotLightVelocity.Y);\r
+ }\r
+ else if (spotLightPos.Y > MaxY || spotLightPos.Y < MinY) //top or bottom wall\r
+ {\r
+ spotLightVelocity = new Vector2(spotLightVelocity.X, spotLightVelocity.Y * -1);\r
+ }\r
}\r
\r
- #endregion\r
+ /// <summary>\r
+ /// Draws the list of current chat messages received by the local client.\r
+ /// </summary>\r
+ private void DrawChatInfo(SpriteBatch spriteBatch)\r
+ {\r
+ if (currentChat.Count > 0)\r
+ {\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, 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, 10 + 15*(currentChat.Count + 1)), Color.Green, 0f, zero, .6f, SpriteEffects.None, 1f);\r
+ }\r
+\r
+ /// <summary>\r
+ /// Draws player list objects for the connected state.\r
+ /// </summary>\r
+ private void DrawPlayerList(SpriteBatch spriteBatch)\r
+ {\r
+ \r
+ //reference point\r
+ Vector2 topOfList = new Vector2(MaxX / 8, MaxY / 4);\r
+\r
+ //command info\r
+ spriteBatch.DrawString(menuFont, "Current Players", new Vector2(topOfList.X + 15, topOfList.Y - 25), Color.White);\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, 80), Color.Gray, 0f, zero, .6f, SpriteEffects.None, 1f);\r
+ spriteBatch.DrawString(menuFont, "enter chat mode", new Vector2(175, 60), 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, 80), Color.DarkGreen, 0f, zero, .6f, SpriteEffects.None, 1f);\r
+ spriteBatch.DrawString(menuFont, "T", new Vector2(145, 60), 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
+ spriteBatch.Draw(menuItem, new Vector2(topOfList.X, topOfList.Y + 130), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
+ spriteBatch.Draw(menuItem, new Vector2(topOfList.X, topOfList.Y + 195), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
+\r
+ //Ready Labels\r
+ spriteBatch.DrawString(menuFont, "Ready", new Vector2(topOfList.X + 5, topOfList.Y + 45), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);\r
+ spriteBatch.DrawString(menuFont, "Ready", new Vector2(topOfList.X + 5, topOfList.Y + 110), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);\r
+ spriteBatch.DrawString(menuFont, "Ready", new Vector2(topOfList.X + 5, topOfList.Y + 175), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);\r
+ spriteBatch.DrawString(menuFont, "Ready", new Vector2(topOfList.X + 5, topOfList.Y + 240), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);\r
+\r
+ //Ready CheckBoxs\r
+ if (players == null)\r
+ {\r
+ spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 35), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
+ spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 100), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
+ spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 165), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
+ spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 230), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
+ }\r
+ else\r
+ {\r
+ if (!(players.Count >= 1 && players[0].IsReady))\r
+ spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 35), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
+ else\r
+ spriteBatch.Draw(checkedBox, new Vector2(topOfList.X - 32, topOfList.Y + 30), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
+ if (!(players.Count >= 2 && players[1].IsReady))\r
+ spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 100), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
+ else\r
+ spriteBatch.Draw(checkedBox, new Vector2(topOfList.X - 32, topOfList.Y + 95), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
+ if (!(players.Count >= 3 && players[2].IsReady))\r
+ spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 165), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
+ else\r
+ spriteBatch.Draw(checkedBox, new Vector2(topOfList.X - 32, topOfList.Y + 160), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
+ if (!(players.Count >= 4 && players[3].IsReady))\r
+ spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 230), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
+ else\r
+ spriteBatch.Draw(checkedBox, new Vector2(topOfList.X - 32, topOfList.Y + 225), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
+ }\r
+\r
+ //Chat Labels\r
+ spriteBatch.DrawString(menuFont, "Chat with", new Vector2(topOfList.X + 152, topOfList.Y + 45), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);\r
+ spriteBatch.DrawString(menuFont, "Chat with", new Vector2(topOfList.X + 152, topOfList.Y + 110), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);\r
+ spriteBatch.DrawString(menuFont, "Chat with", new Vector2(topOfList.X + 152, topOfList.Y + 175), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);\r
+ spriteBatch.DrawString(menuFont, "Chat with", new Vector2(topOfList.X + 152, topOfList.Y + 240), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);\r
+ \r
+ //Chat CheckBoxs\r
+ Boolean chatwith = true; // change to reflect info from network, move to update and create one for each player\r
+ if (!chatwith)\r
+ spriteBatch.Draw(deselectBox, new Vector2(topOfList.X +218, topOfList.Y + 35), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
+ else\r
+ spriteBatch.Draw(checkedBox, new Vector2(topOfList.X + 218, topOfList.Y + 30), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
+\r
+ if (!chatwith)\r
+ spriteBatch.Draw(deselectBox, new Vector2(topOfList.X + 218, topOfList.Y + 100), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
+ else\r
+ spriteBatch.Draw(checkedBox, new Vector2(topOfList.X + 218, topOfList.Y + 95), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
+\r
+ if (!chatwith)\r
+ spriteBatch.Draw(deselectBox, new Vector2(topOfList.X + 218, topOfList.Y + 165), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
+ else\r
+ spriteBatch.Draw(checkedBox, new Vector2(topOfList.X + 218, topOfList.Y + 160), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
+\r
+ if (!chatwith)\r
+ spriteBatch.Draw(deselectBox, new Vector2(topOfList.X + 218, topOfList.Y + 230), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
+ else\r
+ spriteBatch.Draw(checkedBox, new Vector2(topOfList.X + 218, topOfList.Y + 225), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
+ \r
+ \r
+ //draw player names\r
+ if (players != null)\r
+ {\r
+ for (int g = 0; g < players.Count; g++)\r
+ {\r
+ spriteBatch.DrawString(menuFont, players[g].Gamertag, new Vector2(topOfList.X + 10, topOfList.Y + 10 + 65*g), Color.White, 0f, zero, .75f, SpriteEffects.None, 1f);\r
+ }\r
+ }\r
+ }\r
}\r
}\r