Beispiel #1
0
        public void Draw(SpriteBatch spriteBatch, Camera camera, bool isMain)
        {
            base.Draw(spriteBatch);
            Vector2 fontSize = Client.font.MeasureString(Nickname);

            spriteBatch.Draw(pixel.Texture, new Rectangle((int)(X + 13 - fontSize.X / 2), IntY + sprite.Texture.Height + 2, (int)(fontSize.X + 6), (int)(fontSize.Y)), new Rectangle(1, 1, 1, 1), PlayerTeam.TeamColor * 0.5f);
            //Universal.DrawRectangleOutline(spriteBatch, new Rectangle((int)(X + 13 - fontSize.X / 2), IntY + sprite.Texture.Height + 2, (int)(fontSize.X + 6), (int)(fontSize.Y)), PlayerTeam.TeamColor);
            spriteBatch.DrawString(Client.font, Nickname, new Vector2(X + 16 - fontSize.X / 2, Y + sprite.Texture.Height + 2), Color.White);
            if (HPBarInterval.IsRunning)
            {
                spriteBatch.Draw(pixel.Texture, new Rectangle(IntX + 16 - MaxHP / 2, IntY - 2, HP, 4), new Rectangle(1, 1, 1, 1), Color.LimeGreen * 0.75f);
                Universal.DrawRectangleOutline(spriteBatch, new Rectangle(IntX + 16 - MaxHP / 2, IntY - 2, MaxHP, 4), Color.DarkGreen);
            }
            if (FlagIndex == 1)
            {
                spriteBatch.Draw(redFlag.Texture, new Vector2(IntX, IntY - 24), Color.White);
            }
            else if (FlagIndex == 2)
            {
                spriteBatch.Draw(blueFlag.Texture, new Vector2(IntX, IntY - 24), Color.White);
            }
            if (chatInterval.IsRunning)
            {
                fontSize = Client.font.MeasureString(chatMessage);
                spriteBatch.Draw(pixel.Texture, new Rectangle((int)(X + 13 - fontSize.X / 2), IntY - 12, (int)(fontSize.X + 6), (int)(fontSize.Y)), new Rectangle(1, 1, 1, 1), Color.Black * 0.5f);
                spriteBatch.DrawString(Client.font, chatMessage, new Vector2(X + 16 - fontSize.X / 2, Y - 12), Color.White);
            }
        }
Beispiel #2
0
        public void Draw(SpriteBatch spriteBatch, Camera camera, GameTime gameTime)
        {
            bool caretVisible = true;

            if ((gameTime.TotalGameTime.TotalMilliseconds % 1000) < 500)
            {
                caretVisible = false;
            }
            else
            {
                caretVisible = true;
            }

            if (DisplayBox)
            {
                Universal.DrawRectangleOutline(spriteBatch, new Rectangle(camera.CX + IntX, camera.CY + IntY, Bounds.Width, Bounds.Height), DrawColor);
            }

            if (caretVisible && Selected && visibleText == Text)
            {
                spriteBatch.Draw(pixel, new Rectangle(camera.CX + IntX + (int)textSize.X + 4, camera.CY + IntY + 2, 1, Bounds.Height - 3), DrawColor);
            }

            if (!Selected && Text == "")
            {
                spriteBatch.DrawString(font, DefaultText, new Vector2(camera.CX + X + 4, camera.CY + Y + 2), new Color(Color.Gray, 0.5f));
            }
            else
            {
                if (Shadow)
                {
                    spriteBatch.DrawString(font, visibleText, new Vector2(camera.CX + X + 4, camera.CY + Y + 2) + Vector2.One, Color.Black);
                }
                spriteBatch.DrawString(font, visibleText, new Vector2(camera.CX + X + 4, camera.CY + Y + 2), DrawColor);
            }
        }
Beispiel #3
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);
            }
        }