X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=Project06%2FlobbyTest%2FlobbyTest%2FLobbyGUI.cs;h=49702d585ba152bf07461cc7b49c4d73ccc44f03;hb=10d5e89c133423a44f112a1b16cbec0d393fcf2f;hp=b1205672cb48b962663afdfee0e15e05b2a85b2e;hpb=356c8e65fc38a3c44c9cee73c38f1bdccef2f30f;p=chaz%2Fcarfire diff --git a/Project06/lobbyTest/lobbyTest/LobbyGUI.cs b/Project06/lobbyTest/lobbyTest/LobbyGUI.cs index b120567..49702d5 100644 --- a/Project06/lobbyTest/lobbyTest/LobbyGUI.cs +++ b/Project06/lobbyTest/lobbyTest/LobbyGUI.cs @@ -11,9 +11,12 @@ namespace lobbyTest { public class lobbyGUI { + float scale; + Texture2D background; Texture2D spotLight; Texture2D cs; + Texture2D selectGameScreen; Vector2 backgroundPos; Vector2 spotLightPos; @@ -28,6 +31,13 @@ namespace lobbyTest int MaxY; int MinY; + Texture2D checkedBox; + Texture2D deselectBox; + Texture2D emptySelectBox; + Texture2D menuItem; + + Boolean ready; + SpriteFont menuFont; string selected; Vector2 createGamePos; @@ -35,6 +45,9 @@ namespace lobbyTest Vector2 findGamePos; string findGameText; + Vector2 returnToMainPos; + string returnToMainText; + KeyboardState previousKeyboardState; KeyboardState currentKeyboardState; @@ -58,6 +71,7 @@ namespace lobbyTest background = contentManager.Load("background"); spotLight = contentManager.Load("spotlight"); cs = contentManager.Load("cs"); + selectGameScreen = contentManager.Load("selectGameScreen"); backgroundPos = new Vector2(0f, 0f); spotLightPos = new Vector2(100f, graphics.GraphicsDevice.Viewport.Height - 98); spotLightCenter = new Vector2(800f, 800f); @@ -71,6 +85,15 @@ namespace lobbyTest MaxY = graphics.GraphicsDevice.Viewport.Height; MinY = 100; + scale = MaxX / 1600f; + //playerlist stuff + checkedBox = contentManager.Load("checkedBox"); + deselectBox = contentManager.Load("deselectBox"); + emptySelectBox = contentManager.Load("emptySelectBox"); + menuItem = contentManager.Load("menuItem"); + + ready = false; + //menu fonts menuFont = contentManager.Load("menuFont"); createGamePos = new Vector2(100f, MaxY / 3); @@ -79,6 +102,11 @@ namespace lobbyTest findGamePos = new Vector2(100f, (MaxY / 3) + 60); findGameText = "Find Game"; + + returnToMainPos = new Vector2(MaxX / 2, MaxY - 120); + returnToMainText = "press [ X ] to return to main menu"; + + } public void UnloadContent() @@ -98,25 +126,39 @@ namespace lobbyTest { if (currentKeyboardState.IsKeyDown(Keys.Enter) && previousKeyboardState.IsKeyUp(Keys.Enter)) currentState = lobbyState.CreateGame; - if (currentKeyboardState.IsKeyDown(Keys.Down) || currentKeyboardState.IsKeyDown(Keys.Up)) + if (currentKeyboardState.IsKeyDown(Keys.Down)) selected = findGameText; } else { if (currentKeyboardState.IsKeyDown(Keys.Enter) && previousKeyboardState.IsKeyUp(Keys.Enter)) currentState = lobbyState.FindGame; - if (currentKeyboardState.IsKeyDown(Keys.Down) || currentKeyboardState.IsKeyDown(Keys.Up)) + if (currentKeyboardState.IsKeyDown(Keys.Up)) selected = createGameText; } break; case lobbyState.CreateGame: - + if (currentKeyboardState.IsKeyDown(Keys.X) && previousKeyboardState.IsKeyUp(Keys.X)) + { + currentState = lobbyState.Welcome; + ready = false; + } + if (currentKeyboardState.IsKeyDown(Keys.R) && previousKeyboardState.IsKeyUp(Keys.R)) + ready = true; break; case lobbyState.FindGame: + if (currentKeyboardState.IsKeyDown(Keys.X) && previousKeyboardState.IsKeyUp(Keys.X)) + { + currentState = lobbyState.Welcome; + ready = false; + } break; case lobbyState.Connected: - + if (currentKeyboardState.IsKeyDown(Keys.X) && previousKeyboardState.IsKeyUp(Keys.X)) + currentState = lobbyState.Welcome; + if (currentKeyboardState.IsKeyDown(Keys.R) && previousKeyboardState.IsKeyUp(Keys.R)) + ready = true; break; } @@ -130,12 +172,13 @@ namespace lobbyTest /// public long Draw(SpriteBatch spriteBatch) { - spriteBatch.Draw(background, backgroundPos, null, Color.White, 0, zero, 0.5f, SpriteEffects.None, 0); + spriteBatch.Draw(background, backgroundPos, null, Color.White, 0, zero, scale, SpriteEffects.None, 0); spriteBatch.Draw(cs, csPos, null, Color.White, 0, zero, 0.5f, SpriteEffects.None, 0); spriteBatch.Draw(spotLight, spotLightPos, null, Color.White, 0, spotLightCenter, 1f, SpriteEffects.None, 0); switch (currentState) { case lobbyState.Welcome: + spriteBatch.DrawString(menuFont, "press [ Home ] to login", new Vector2(350, 20), Color.LightGray, 0f, zero, .6f, SpriteEffects.None, 0.5f); if (selected == createGameText) spriteBatch.DrawString(menuFont, createGameText, createGamePos, Color.Red, 0, zero, 1f, SpriteEffects.None, 0.5f); else @@ -145,14 +188,19 @@ namespace lobbyTest else spriteBatch.DrawString(menuFont, findGameText, findGamePos, Color.Gray, 0, zero, 1f, SpriteEffects.None, 0.5f); break; + case lobbyState.CreateGame: - + DrawPlayerList(spriteBatch); + break; case lobbyState.FindGame: - + spriteBatch.Draw(selectGameScreen, backgroundPos, null, Color.White, 0, zero, scale, SpriteEffects.None, 0); + //spriteBatch.DrawString(menuFont, "Select Game", new Vector2(100, 100), Color.Gray, 0, zero, 1f, SpriteEffects.None, 0.5f); + + //spriteBatch.DrawString(menuFont, returnToMainText, returnToMainPos, Color.Gray, 0, new Vector2(180 , 0), .6f, SpriteEffects.None, 0.5f); break; case lobbyState.Connected: - + DrawPlayerList(spriteBatch); break; } @@ -173,5 +221,77 @@ namespace lobbyTest spotLightVelocity = new Vector2(spotLightVelocity.X, spotLightVelocity.Y * -1); } } + + + private void DrawPlayerList(SpriteBatch spriteBatch) + { + + Vector2 topOfList = new Vector2(MaxX / 8, MaxY / 4); + spriteBatch.DrawString(menuFont, "Current Players", new Vector2(topOfList.X + 15, topOfList.Y - 25), Color.White); + + //top player + spriteBatch.Draw(menuItem, topOfList, null, Color.White, 0, zero, scale, SpriteEffects.None, 1f); + spriteBatch.DrawString(menuFont, "****Player 1****", new Vector2(topOfList.X + 10, topOfList.Y + 10), Color.White, 0f, zero, .75f, SpriteEffects.None, 1f); + spriteBatch.DrawString(menuFont, "Ready", new Vector2(topOfList.X + 5, topOfList.Y + 45), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f); + if(!ready) + spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 35), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f); + else + spriteBatch.Draw(checkedBox, new Vector2(topOfList.X - 32, topOfList.Y + 30), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f); + + spriteBatch.DrawString(menuFont, "Chat with", new Vector2(topOfList.X + 152, topOfList.Y + 45), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f); + Boolean chatwith = false; // 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 + spriteBatch.Draw(checkedBox, new Vector2(topOfList.X + 218, topOfList.Y + 30), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f); + + //player 2 + spriteBatch.Draw(menuItem, new Vector2(topOfList.X, topOfList.Y + 65), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f); + spriteBatch.DrawString(menuFont, "****Player 1****", new Vector2(topOfList.X + 10, topOfList.Y + 75), Color.White, 0f, zero, .75f, SpriteEffects.None, 1f); + spriteBatch.DrawString(menuFont, "Ready", new Vector2(topOfList.X + 5, topOfList.Y + 110), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f); + if (!ready) + spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 100), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f); + else + spriteBatch.Draw(checkedBox, new Vector2(topOfList.X - 32, topOfList.Y + 95), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f); + + spriteBatch.DrawString(menuFont, "Chat with", new Vector2(topOfList.X + 152, topOfList.Y + 110), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f); + // change to reflect info from network + if (!chatwith) + spriteBatch.Draw(deselectBox, new Vector2(topOfList.X + 218, topOfList.Y + 100), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f); + else + spriteBatch.Draw(checkedBox, new Vector2(topOfList.X + 218, topOfList.Y + 95), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f); + + //player 3 + spriteBatch.Draw(menuItem, new Vector2(topOfList.X, topOfList.Y + 130), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f); + spriteBatch.DrawString(menuFont, "****Player 1****", new Vector2(topOfList.X + 10, topOfList.Y + 140), Color.White, 0f, zero, .75f, SpriteEffects.None, 1f); + spriteBatch.DrawString(menuFont, "Ready", new Vector2(topOfList.X + 5, topOfList.Y + 175), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f); + if (!ready) + spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 165), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f); + else + spriteBatch.Draw(checkedBox, new Vector2(topOfList.X - 32, topOfList.Y + 160), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f); + + spriteBatch.DrawString(menuFont, "Chat with", new Vector2(topOfList.X + 152, topOfList.Y + 175), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f); + + if (!chatwith) + spriteBatch.Draw(deselectBox, new Vector2(topOfList.X + 218, topOfList.Y + 165), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f); + else + spriteBatch.Draw(checkedBox, new Vector2(topOfList.X + 218, topOfList.Y + 160), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f); + + //player 4 + spriteBatch.Draw(menuItem, new Vector2(topOfList.X, topOfList.Y + 195), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f); + spriteBatch.DrawString(menuFont, "****Player 1****", new Vector2(topOfList.X + 10, topOfList.Y + 205), Color.White, 0f, zero, .75f, SpriteEffects.None, 1f); + spriteBatch.DrawString(menuFont, "Ready", new Vector2(topOfList.X + 5, topOfList.Y + 240), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f); + if (!ready) + spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 230), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f); + else + spriteBatch.Draw(checkedBox, new Vector2(topOfList.X - 32, topOfList.Y + 225), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f); + + spriteBatch.DrawString(menuFont, "Chat with", new Vector2(topOfList.X + 152, topOfList.Y + 240), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f); + if (!chatwith) + spriteBatch.Draw(deselectBox, new Vector2(topOfList.X + 218, topOfList.Y + 230), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f); + else + spriteBatch.Draw(checkedBox, new Vector2(topOfList.X + 218, topOfList.Y + 225), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f); + + } } }