Ejemplo n.º 1
0
        public void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            Client.arEvent.WaitOne();
            foreach (KeyValuePair <int, Player> entry in playerIndex.ToArray())
            {
                entry.Value.Draw(spriteBatch, camera, entry.Value == world.MainPlayer);
            }
            foreach (KeyValuePair <int, Mob> entry in mobIndex.ToArray())
            {
                entry.Value.Draw(spriteBatch);
            }
            foreach (KeyValuePair <int, ItemDrop> entry in dropIndex.ToArray())
            {
                entry.Value.Draw(spriteBatch, Client.font);
            }
            world.DrawObjects(spriteBatch);
            string timeString = String.Format("{0}:{1}", timeRemaining / 60, (timeRemaining % 60).ToString("00"));

            Universal.DrawStringMore(spriteBatch, Client.font, timeString, new Vector2(camera.CX + Universal.SCREEN_WIDTH / 2, camera.CY + 10), Color.White, 0, Vector2.Zero, new Vector2(2, 2), SpriteEffects.None, 0, Align.Center, true);
            if (world.ServerMode == GameMode.TeamDeathmatch || world.ServerMode == GameMode.CaptureTheFlag)
            {
                redTent.Draw(spriteBatch, Client.font);
                blueTent.Draw(spriteBatch, Client.font);
                Universal.DrawStringMore(spriteBatch, Client.font, Convert.ToString(redTickets), new Vector2(camera.CX + Universal.SCREEN_WIDTH / 2 - 100, camera.CY + 10), Color.Red, 0, Vector2.Zero, new Vector2(2, 2), SpriteEffects.None, 0, Align.Center, true);
                Universal.DrawStringMore(spriteBatch, Client.font, Convert.ToString(blueTickets), new Vector2(camera.CX + Universal.SCREEN_WIDTH / 2 + 100, camera.CY + 10), Color.Blue, 0, Vector2.Zero, new Vector2(2, 2), SpriteEffects.None, 0, Align.Center, true);
            }
            if (gameEnded)
            {
                Universal.DrawStringMore(spriteBatch, Client.font, gameEndMessage, new Vector2(camera.X, camera.Y - 36), Color.White, 0, Vector2.Zero, new Vector2(2, 2), SpriteEffects.None, 0, Align.Center, true);
            }
            chat.Draw(spriteBatch, camera, gameTime);

            Client.arEvent.Set();
        }
Ejemplo n.º 2
0
        private void DrawTeamInfo(SpriteBatch spriteBatch, Team currentTeam, List <Player> teamList, ref int entryCount, ref int lastTeamY)
        {
            spriteBatch.Draw(pixel, new Rectangle(camera.IntX - 280, lastTeamY, 560, (teamList.Count + 1) * 16), new Color(currentTeam.TeamColor, 64));
            spriteBatch.Draw(pixel, new Rectangle(camera.IntX - 280, lastTeamY, 560, 1), Color.Black);
            spriteBatch.Draw(pixel, new Rectangle(camera.IntX - 105, lastTeamY, 1, (teamList.Count + 1) * 16), Color.Black);
            Universal.DrawStringMore(spriteBatch, font, "Kills", new Vector2(camera.IntX - 70, lastTeamY), Color.White, Align.Center, true);
            spriteBatch.Draw(pixel, new Rectangle(camera.IntX - 35, lastTeamY, 1, (teamList.Count + 1) * 16), Color.Black);
            Universal.DrawStringMore(spriteBatch, font, "Assists", new Vector2(camera.IntX, lastTeamY), Color.White, Align.Center, true);
            spriteBatch.Draw(pixel, new Rectangle(camera.IntX + 35, lastTeamY, 1, (teamList.Count + 1) * 16), Color.Black);
            Universal.DrawStringMore(spriteBatch, font, "Deaths", new Vector2(camera.IntX + 70, lastTeamY), Color.White, Align.Center, true);
            spriteBatch.Draw(pixel, new Rectangle(camera.IntX + 105, lastTeamY, 1, (teamList.Count + 1) * 16), Color.Black);
            spriteBatch.Draw(pixel, new Rectangle(camera.IntX + 240, lastTeamY, 1, (teamList.Count + 1) * 16), Color.Black);
            Universal.DrawStringMore(spriteBatch, font, "Ping", new Vector2(camera.IntX + 276, lastTeamY), Color.White, Align.Right, true);
            spriteBatch.Draw(pixel, new Rectangle(camera.IntX - 280, lastTeamY + 16, 560, 1), Color.Black);
            Universal.DrawStringMore(spriteBatch, font, currentTeam.Name, new Vector2(camera.IntX - 276, lastTeamY), Color.White, Align.Left, true);

            entryCount++;
            foreach (Player teamPlayer in teamList)
            {
                DrawPlayerInfo(spriteBatch, teamPlayer, entryCount);
                entryCount++;
            }
            lastTeamY += entryCount * 16;
            teamList.Clear();
        }
Ejemplo n.º 3
0
 private void DrawPlayerInfo(SpriteBatch spriteBatch, Player player, int entryCount)
 {
     Universal.DrawStringMore(spriteBatch, font, player.Nickname, new Vector2(camera.IntX - 276, camera.IntY + 16 - infoHeight / 2 + entryCount * 16), Color.White, Align.Left, true);
     Universal.DrawStringMore(spriteBatch, font, Convert.ToString(player.Kills), new Vector2(camera.IntX - 70, camera.IntY + 16 - infoHeight / 2 + entryCount * 16), Color.White, Align.Center, true);
     Universal.DrawStringMore(spriteBatch, font, Convert.ToString(player.Assists), new Vector2(camera.IntX, camera.IntY + 16 - infoHeight / 2 + entryCount * 16), Color.White, Align.Center, true);
     Universal.DrawStringMore(spriteBatch, font, Convert.ToString(player.Deaths), new Vector2(camera.IntX + 70, camera.IntY + 16 - infoHeight / 2 + entryCount * 16), Color.White, Align.Center, true);
     Universal.DrawStringMore(spriteBatch, font, Convert.ToString(player.Ping), new Vector2(camera.IntX + 276, camera.IntY + 16 - infoHeight / 2 + entryCount * 16), Color.White, Align.Right, true);
 }
Ejemplo n.º 4
0
 public override void Draw(SpriteBatch spriteBatch)
 {
     Universal.DrawStringMore(spriteBatch, Client.font, "-" + damage, new Vector2((int)X, (int)Y), Color.White, 0, new Vector2(0, 0), new Vector2(2, 2), SpriteEffects.None, 0, Align.Left, true);
 }
Ejemplo n.º 5
0
        public void Draw(SpriteBatch spriteBatch)
        {
            int  blockX       = (camera.CX + mouseState.X) / 16;
            int  blockY       = (camera.CY + mouseState.Y) / 16;
            Item selectedItem = world.MainPlayer.SelectedItem;

            if (drawBlockOutline)
            {
                spriteBatch.Draw(blockoutline, new Vector2(blockX * 16 - 2, blockY * 16 - 2), new Color(Color.White, 0.15f));
                if (selectedItem.Sprite != null && mouseState.RightButton == ButtonState.Released)
                {
                    spriteBatch.Draw(selectedItem.Sprite.Texture, new Vector2(blockX * 16, blockY * 16), new Color(Color.White, 0.5f));
                }
            }
            else if (selectedItem.Sprite != null)
            {
                spriteBatch.Draw(selectedItem.Sprite.Texture, new Vector2(camera.CX + mouseState.X - selectedItem.Sprite.SourceWidth / 2, camera.CY + mouseState.Y - selectedItem.Sprite.SourceHeight / 2), new Color(Color.White, 0.5f));
            }

            foreach (Item item in world.MainPlayer.Items)
            {
                item.Draw(spriteBatch, camera);
            }

            if (world.MainPlayer.RespawnInterval.IsRunning)
            {
                int respawnTime = (int)world.MainPlayer.RespawnInterval.Left;
                spriteBatch.Draw(pixel, new Rectangle(camera.CX, camera.IntY - 4, Universal.SCREEN_WIDTH, 24), new Color(Color.Black, 128));
                Universal.DrawStringMore(spriteBatch, font, String.Format("Respawning in {0}...", respawnTime), camera.Position, Color.White, Align.Center, true);
            }

            //bar.Draw(spriteBatch, camera);
            //foreach (Button button in buttonList)
            //button.Draw(spriteBatch, camera);
            Universal.DrawStringMore(spriteBatch, font, Universal.GAME_VERSION, new Vector2(camera.CX + 10, camera.CY + 8), Color.White, Align.Left, true);
            if (keyState.IsKeyDown(Keys.Tab))
            {
                int playerCount = world.PlayerIndex.Count;
                int teamCount   = world.TeamCount;
                infoHeight = playerCount * 16 + teamCount * 16 + 16;

                spriteBatch.Draw(pixel, new Rectangle(camera.IntX - 280, camera.IntY - infoHeight / 2, 560, 16), new Color(Color.Black, 64));
                Universal.DrawStringMore(spriteBatch, font, "Players Online: " + playerCount, new Vector2(camera.IntX - 276, camera.IntY - infoHeight / 2), Color.White, Align.Left, true);
                Universal.DrawStringMore(spriteBatch, font, world.ServerName, new Vector2(camera.IntX, camera.IntY - infoHeight / 2), Color.White, Align.Center, true);
                Universal.DrawStringMore(spriteBatch, font, modeName, new Vector2(camera.IntX + 276, camera.IntY - infoHeight / 2), Color.White, Align.Right, true);

                int           entryCount = 0, lastTeamY = camera.IntY - infoHeight / 2 + 16;
                bool          setTeam     = false;
                List <Player> teamList    = new List <Player>();
                Team          currentTeam = new Team("No Team", Color.Black);
                foreach (KeyValuePair <int, Player> entry in world.PlayerIndex.OrderBy(o => o.Value.PlayerTeam.Name).ToList())
                {
                    Player player = entry.Value;
                    if (!setTeam)
                    {
                        currentTeam = player.PlayerTeam;
                        teamList.Add(player);
                        setTeam = true;
                    }
                    else if (currentTeam.Name != player.PlayerTeam.Name)
                    {
                        DrawTeamInfo(spriteBatch, currentTeam, teamList, ref entryCount, ref lastTeamY);
                        teamList.Add(player);
                        currentTeam = player.PlayerTeam;
                    }
                    else
                    {
                        teamList.Add(player);
                    }
                }
                if (teamList.Count > 0)
                {
                    DrawTeamInfo(spriteBatch, currentTeam, teamList, ref entryCount, ref lastTeamY);
                }

                Universal.DrawRectangleOutline(spriteBatch, new Rectangle(camera.IntX - 280, camera.IntY - infoHeight / 2, 560, infoHeight), Color.Black);

                spriteBatch.Draw(pixel, new Rectangle(camera.CX + 20, camera.IntY - 150, 320, 300), new Color(Color.Black, 200));
                Universal.DrawStringMore(spriteBatch, font, "Rules: " + modeName, new Vector2(camera.CX + 30, camera.IntY - 140), Color.White, Align.Left, true);
                Universal.DrawStringMore(spriteBatch, font, rules, new Vector2(camera.CX + 40, camera.IntY - 120), Color.White, Align.Left, true);
                Universal.DrawStringMore(spriteBatch, font, "Controls", new Vector2(camera.CX + 30, camera.IntY), Color.White, Align.Left, true);
                Universal.DrawStringMore(spriteBatch, font, controls, new Vector2(camera.CX + 40, camera.IntY + 20), Color.White, Align.Left, true);
            }
        }