]> Dogcows Code - chaz/carfire/commitdiff
testing
authorbrady <brady@92bb83a3-7c8f-8a45-bc97-515c4e399668>
Sat, 20 Mar 2010 10:42:47 +0000 (10:42 +0000)
committerbrady <brady@92bb83a3-7c8f-8a45-bc97-515c4e399668>
Sat, 20 Mar 2010 10:42:47 +0000 (10:42 +0000)
git-svn-id: https://bd85.net/svn/cs3505_group@21 92bb83a3-7c8f-8a45-bc97-515c4e399668

Project06/CS 3505 Project 06/CS 3505 Project 06/LobbyGUI.cs
Project06/CS 3505 Project 06/CS 3505 Project 06/NetworkGame.cs

index d8fa910913ea33ce81f8521036ced1e35900f052..15d0955946f737d1709355648ec4cc7ac0d35b56 100644 (file)
@@ -55,7 +55,9 @@ namespace CS_3505_Project_06
         KeyboardState currentKeyboardState;\r
 \r
         GamerCollection<NetworkGamer> players;\r
+        LocalNetworkGamer localPlayer;\r
         AvailableNetworkSessionCollection availableSessions;\r
+        bool allReady;\r
 \r
         int selectedSessionIndex;\r
 \r
@@ -133,7 +135,7 @@ namespace CS_3505_Project_06
 \r
             if (networkGame.sessionExists())\r
             {\r
-                players = networkGame.LocalGamers;\r
+                players = networkGame.NetworkGamers;\r
             }\r
 \r
             //check inputs\r
@@ -203,16 +205,26 @@ namespace CS_3505_Project_06
                         currentState = lobbyState.Welcome;\r
                     }\r
                     if (currentKeyboardState.IsKeyDown(Keys.R) && previousKeyboardState.IsKeyUp(Keys.R))\r
-                        ready = true;\r
+                        networkGame.LocalGamer.IsReady = true;\r
 \r
                     if (networkGame.sessionExists())\r
                     {\r
-                        players = networkGame.LocalGamers;\r
+                        localPlayer = networkGame.LocalGamer;\r
+                        players = networkGame.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
                     else\r
                         currentState = lobbyState.Welcome;\r
 \r
-\r
                     break;\r
 \r
             }\r
@@ -276,7 +288,13 @@ namespace CS_3505_Project_06
 \r
                 case lobbyState.Connected:\r
                     DrawPlayerList(spriteBatch);\r
-                    spriteBatch.DrawString(menuFont, "Waiting for ready players...", new Vector2(MaxX / 2, MaxY / 2), Color.White, 0f, zero, .7f, SpriteEffects.None, 0.5f);\r
+                    \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
@@ -314,62 +332,69 @@ namespace CS_3505_Project_06
             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
+            //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
-            //player 1\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
-            if(!ready)\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
-                spriteBatch.Draw(checkedBox, new Vector2(topOfList.X - 32, topOfList.Y + 30), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
-            \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 = false;  // 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
-            //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, "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
-            else\r
-                spriteBatch.Draw(checkedBox, new Vector2(topOfList.X - 32, topOfList.Y + 95), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
-\r
-            spriteBatch.DrawString(menuFont, "Chat with", new Vector2(topOfList.X + 152, topOfList.Y + 110), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);\r
-            // change to reflect info from network\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
-            //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, "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
-            else\r
-                spriteBatch.Draw(checkedBox, new Vector2(topOfList.X - 32, topOfList.Y + 160), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
 \r
-            spriteBatch.DrawString(menuFont, "Chat with", new Vector2(topOfList.X + 152, topOfList.Y + 175), Color.DarkGray, 0f, zero, .6f, 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
-            //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, "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 - 32, topOfList.Y + 225), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);\r
 \r
-            spriteBatch.DrawString(menuFont, "Chat with", new Vector2(topOfList.X + 152, topOfList.Y + 240), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);\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
index 62c4b948f762634c517fe7e95fb66b2510d7e3d4..52486c8b5f06b75f066710d1635755b66ad7f450 100644 (file)
@@ -69,7 +69,7 @@ namespace CS_3505_Project_06
 \r
         // I added this as I needed a way to display all gamers not just the first gamer\r
         //    -Brady\r
-        public GamerCollection<NetworkGamer> LocalGamers\r
+        public GamerCollection<NetworkGamer> NetworkGamers\r
         {\r
             get\r
             {\r
This page took 0.032578 seconds and 4 git commands to generate.