Ejemplo n.º 1
0
        public void DrawOnBattle(Graphics g2, Color uponColor)
        {
            Bitmap   image = new Bitmap(100, 100);
            Graphics g     = Graphics.FromImage(image);

            if (!IsGhost)
            {
                var monImg = MonsterBook.GetMonsterImage(Avatar.Id, 100, 100);
                if (monImg != null)
                {
                    g.DrawImage(monImg, 0, 0, 100, 100);
                }

                if (uponColor != Color.White)
                {
                    SolidBrush brush = new SolidBrush(Color.FromArgb(150, uponColor));
                    g.FillRectangle(brush, 0, 0, 100, 100);
                    brush.Dispose();
                }
                var  pen       = new Pen(!IsLeft ? Brushes.Blue : Brushes.Red, 3);
                Font font2     = new Font("Arial", 14 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel);
                Font fontLevel = new Font("Arial", 20 * 1.33f, FontStyle.Bold, GraphicsUnit.Pixel);
                g.DrawRectangle(pen, 1, 1, 98, 98);
                pen.Dispose();

                HpBar.Draw(g);

                g.FillPie(Brushes.Gray, 65, 65, 30, 30, 0, 360);
                var skillPercent = SkillManager.GetRoundSkillPercent();
                if (skillPercent > 0)
                {
                    //画集气槽
                    g.FillPie(Brushes.Purple, 65, 65, 30, 30, 0, skillPercent * 360 / 100);
                    //画行动槽
                    g.FillPie(CanAttack ? Brushes.Yellow : Brushes.LightGray, 70, 70, 20, 20, 0, Action * 360 / GameConstants.LimitAts);
                }
                else
                {
                    //画行动槽
                    g.FillPie(CanAttack ? Brushes.Yellow : Brushes.LightGray, 65, 65, 30, 30, 0, Action * 360 / GameConstants.LimitAts);
                }

                var starIcon = HSIcons.GetIconsByEName("sysstar");
                for (int i = 0; i < Avatar.MonsterConfig.Star; i++)
                {
                    g.DrawImage(starIcon, i * 12, 8, 16, 16);
                }

                g.DrawString(Level.ToString(), fontLevel, Brushes.Wheat, Level < 10 ? 71 : 67, 68);
                g.DrawString(Level.ToString(), fontLevel, Brushes.DarkBlue, Level < 10 ? 70 : 66, 67);
                font2.Dispose();
                fontLevel.Dispose();

                if (Weapon != null)
                {
                    g.DrawImage(Weapon.GetImage(32, 32), 5, 60, 32, 32);
                    g.DrawRectangle(Pens.Lime, 5, 60, 32, 32);
                }
                BuffManager.DrawBuff(g, roundPast / 20);
            }
            else
            {
                Image img = PicLoader.Read("System", "Rip.PNG");
                g.DrawImage(img, 19, 11, 63, 78);
                img.Dispose();

                var pen = new Pen(!IsLeft ? Brushes.Blue : Brushes.Red, 3);
                g.DrawRectangle(pen, 1, 1, 98, 98);
                pen.Dispose();

                g.FillRectangle(Brushes.Red, 0, 2, 100, 5);
                g.FillRectangle(Brushes.Cyan, 0, 2, Math.Min(GhostTime * 100, 100), 5);
            }

            g.Dispose();
            int size = BattleManager.Instance.MemMap.CardSize;

            g2.DrawImage(image, new Rectangle(Position.X, Position.Y, size, size), 0, 0, 100, 100, GraphicsUnit.Pixel);
            image.Dispose();
        }