using System.Collections.Generic;\r
using System.Linq;\r
using System.Text;\r
-using Microsoft.Xna.Framework.Content;\r
-using Microsoft.Xna.Framework.Input;\r
-using Microsoft.Xna.Framework;\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
\r
namespace CS_3505_Project_06\r
{\r
KeyboardState previousKeyboardState;\r
KeyboardState currentKeyboardState;\r
\r
+ GamerCollection<LocalNetworkGamer> players;\r
+ \r
+\r
private enum lobbyState\r
{\r
Welcome,\r
\r
public lobbyGUI()\r
{\r
- currentState = lobbyState.Welcome;\r
+ currentState = lobbyState.Welcome; \r
}\r
\r
public void LoadContent(ContentManager contentManager, GraphicsDeviceManager graphics)\r
\r
public long Update(GameTime gameTime, NetworkGame networkGame)\r
{\r
+ \r
UpdateSpotLight(gameTime);\r
currentKeyboardState = Keyboard.GetState();\r
+\r
//check inputs\r
switch (currentState)\r
{\r
{\r
currentState = lobbyState.Welcome;\r
ready = false;\r
+ networkGame.LeaveSession();\r
}\r
- if (currentKeyboardState.IsKeyDown(Keys.R) && previousKeyboardState.IsKeyUp(Keys.R))\r
- ready = true;\r
+ if (currentKeyboardState.IsKeyDown(Keys.Y) && previousKeyboardState.IsKeyUp(Keys.Y))\r
+ {\r
+ currentState = lobbyState.Connected;\r
+ networkGame.CreateSession(4);\r
+ players = networkGame.LocalGamers;\r
+ } \r
break;\r
case lobbyState.FindGame:\r
if (currentKeyboardState.IsKeyDown(Keys.X) && previousKeyboardState.IsKeyUp(Keys.X))\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
\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
case lobbyState.FindGame:\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, 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, 60), Color.DarkGreen, 0f, zero, .6f, SpriteEffects.None, 1f);\r
+ \r
\r
- //top player\r
spriteBatch.Draw(menuItem, topOfList, null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
- spriteBatch.DrawString(menuFont, "****Player 1****", new Vector2(topOfList.X + 10, topOfList.Y + 10), Color.White, 0f, zero, .75f, SpriteEffects.None, 1f);\r
+\r
+ //player 1\r
spriteBatch.DrawString(menuFont, "Ready", new Vector2(topOfList.X + 5, topOfList.Y + 45), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);\r
if(!ready)\r
spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 35), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
\r
//player 2\r
spriteBatch.Draw(menuItem, new Vector2(topOfList.X, topOfList.Y + 65), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
- spriteBatch.DrawString(menuFont, "****Player 1****", new Vector2(topOfList.X + 10, topOfList.Y + 75), Color.White, 0f, zero, .75f, 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
if (!ready)\r
spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 100), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
\r
//player 3\r
spriteBatch.Draw(menuItem, new Vector2(topOfList.X, topOfList.Y + 130), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
- spriteBatch.DrawString(menuFont, "****Player 1****", new Vector2(topOfList.X + 10, topOfList.Y + 140), Color.White, 0f, zero, .75f, 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
if (!ready)\r
spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 165), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
\r
//player 4\r
spriteBatch.Draw(menuItem, new Vector2(topOfList.X, topOfList.Y + 195), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
- spriteBatch.DrawString(menuFont, "****Player 1****", new Vector2(topOfList.X + 10, topOfList.Y + 205), Color.White, 0f, zero, .75f, 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
if (!ready)\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 + 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
+ //top player\r
}\r
}\r
}\r