Ejemplo n.º 1
0
        private void AddManaData(PlayerManaTypes type, int num)
        {
            if (type == PlayerManaTypes.Mp || type == PlayerManaTypes.All)
            {
                Mp = Math.Min(Mp + num, EnergyGenerator.LimitMp);
            }
            if (type == PlayerManaTypes.Lp || type == PlayerManaTypes.All)
            {
                Lp = Math.Min(Lp + num, EnergyGenerator.LimitLp);
            }
            if (type == PlayerManaTypes.Pp || type == PlayerManaTypes.All)
            {
                Pp = Math.Min(Pp + num, EnergyGenerator.LimitPp);
            }

            if (ManaChanged != null) //todo 先ws下
            {
                ManaChanged();
            }
        }
Ejemplo n.º 2
0
        private void AddManaData(PlayerManaTypes type, int num)
        {
            if (type == PlayerManaTypes.Mana || type == PlayerManaTypes.All)
            {
                Mp = Math.Min(Mp + num, EnergyGenerator.LimitMp);
            }
            if (type == PlayerManaTypes.LeaderShip || type == PlayerManaTypes.All)
            {
                Lp = Math.Min(Lp + num, EnergyGenerator.LimitLp);
            }
            if (type == PlayerManaTypes.Power || type == PlayerManaTypes.All)
            {
                Pp = Math.Min(Pp + num, EnergyGenerator.LimitPp);
            }

            if (ManaChanged != null) //todo 先ws下
            {
                ManaChanged();
            }
        }
Ejemplo n.º 3
0
        private void LifeClock_Paint(object sender, PaintEventArgs e)
        {
            if (back == null)//在editor模式下就不绘制了
            {
                return;
            }
            e.Graphics.DrawImage(back, 0, 0, Width, Height);
            if (head != null)
            {
                if (IsLeft)
                {
                    e.Graphics.DrawImage(head, 4, 3, 63, 64);
                }
                else
                {
                    e.Graphics.DrawImage(head, Width - 67, 3, 63, 64);
                }
            }
            PlayerManaTypes        nextAimMana = PlayerManaTypes.None;
            List <PlayerManaTypes> manaQueue   = null;
            float roundRate = 0;

            if (player != null)
            {
                nextAimMana = player.EnergyGenerator.NextAimMana;
                manaQueue   = player.EnergyGenerator.QueuedMana;
                roundRate   = player.GetRoundRate();
            }

            Brush b1  = new LinearGradientBrush(new Rectangle(0, 18, 500, 10), Color.FromArgb(255, 120, 120), Color.FromArgb(255, 0, 0), LinearGradientMode.Vertical);
            Brush b2  = new LinearGradientBrush(new Rectangle(0, 30, 500, 10), Color.FromArgb(120, 120, 255), Color.FromArgb(0, 0, 255), LinearGradientMode.Vertical);
            Pen   pen = new Pen(Brushes.Black, 2);

            if (IsLeft)
            {
                if (manaQueue != null)
                {
                    for (int i = 0; i < manaQueue.Count; i++)
                    {
                        e.Graphics.FillRectangle(PaintTool.GetBrushByManaType((int)manaQueue[i]), 78 - 7, 12 + i * 7, 17, 6);
                    }
                }
                if (nextAimMana != PlayerManaTypes.None)
                {
                    e.Graphics.DrawImage(HSIcons.GetIconsByEName("mix" + (int)nextAimMana), 78, 10, 30, 30);
                }
                var destRegion = new Rectangle(78, 10, 30, (int)(30 * (1 - roundRate)));
                e.Graphics.DrawImage(HSIcons.GetIconsByEName("mix0"), destRegion, 0, 0, 32, 32 * (1 - roundRate), GraphicsUnit.Pixel);
                if (player != null)
                {
                    for (int i = 0; i < player.EnergyGenerator.LimitMp; i++)
                    {
                        if (i < player.Mp)
                        {
                            e.Graphics.FillRectangle(PaintTool.GetBrushByManaType((int)PlayerManaTypes.Mp), 112 + 24 * i, 10, 22, 8);
                        }
                        e.Graphics.DrawRectangle(Pens.Gray, 112 + 24 * i, 10, 22, 8);
                    }
                    for (int i = 0; i < player.EnergyGenerator.LimitPp; i++)
                    {
                        if (i < player.Pp)
                        {
                            e.Graphics.FillRectangle(PaintTool.GetBrushByManaType((int)PlayerManaTypes.Pp), 112 + 24 * i, 20, 22, 8);
                        }
                        e.Graphics.DrawRectangle(Pens.Gray, 112 + 24 * i, 20, 22, 8);
                    }
                    for (int i = 0; i < player.EnergyGenerator.LimitLp; i++)
                    {
                        if (i < player.Lp)
                        {
                            e.Graphics.FillRectangle(PaintTool.GetBrushByManaType((int)PlayerManaTypes.Lp), 112 + 24 * i, 30, 22, 8);
                        }
                        e.Graphics.DrawRectangle(Pens.Gray, 112 + 24 * i, 30, 22, 8);
                    }
                }
            }
            else
            {
                if (manaQueue != null)
                {
                    for (int i = 0; i < manaQueue.Count; i++)
                    {
                        e.Graphics.FillRectangle(PaintTool.GetBrushByManaType((int)manaQueue[i]), Width - 108 + 20, 12 + i * 7, 17, 6);
                    }
                }
                if (nextAimMana != PlayerManaTypes.None)
                {
                    e.Graphics.DrawImage(HSIcons.GetIconsByEName("mix" + (int)nextAimMana), Width - 108, 10, 30, 30);
                }
                var destRegion = new Rectangle(Width - 108, 10, 30, (int)(30 * (1 - roundRate)));
                e.Graphics.DrawImage(HSIcons.GetIconsByEName("mix0"), destRegion, 0, 0, 32, 32 * (1 - roundRate), GraphicsUnit.Pixel);

                if (player != null)
                {
                    for (int i = 0; i < player.EnergyGenerator.LimitMp; i++)
                    {
                        if (i < player.Mp)
                        {
                            e.Graphics.FillRectangle(PaintTool.GetBrushByManaType((int)PlayerManaTypes.Mp), Width - 134 - 24 * i, 10, 22, 8);
                        }
                        e.Graphics.DrawRectangle(Pens.Gray, Width - 134 - 24 * i, 10, 22, 8);
                    }
                    for (int i = 0; i < player.EnergyGenerator.LimitPp; i++)
                    {
                        if (i < player.Pp)
                        {
                            e.Graphics.FillRectangle(PaintTool.GetBrushByManaType((int)PlayerManaTypes.Pp), Width - 134 - 24 * i, 20, 22, 8);
                        }
                        e.Graphics.DrawRectangle(Pens.Gray, Width - 134 - 24 * i, 20, 22, 8);
                    }
                    for (int i = 0; i < player.EnergyGenerator.LimitLp; i++)
                    {
                        if (i < player.Lp)
                        {
                            e.Graphics.FillRectangle(PaintTool.GetBrushByManaType((int)PlayerManaTypes.Lp), Width - 134 - 24 * i, 30, 22, 8);
                        }
                        e.Graphics.DrawRectangle(Pens.Gray, Width - 134 - 24 * i, 30, 22, 8);
                    }
                }
            }
            pen.Dispose();
            b1.Dispose();
            b2.Dispose();
            Font font  = new Font("幼圆", 12 * 1.33f, FontStyle.Bold, GraphicsUnit.Pixel);
            int  lenth = (int)e.Graphics.MeasureString(nameStr, font).Width;

            e.Graphics.DrawString(nameStr, font, Brushes.White, IsLeft ? 72 : Width - 72 - lenth, 44);
            e.Graphics.DrawImage(HSIcons.GetIconsByEName("tsk7"), IsLeft ? Width - 75 : 30, 44, 18, 18);//画剩余卡牌数
            if (player != null)
            {
                e.Graphics.DrawString(player.Cards.LeftCount.ToString(), font, Brushes.White, IsLeft ? Width - 52 : 53, 44);
                if (player.TrapHolder.Count > 0)
                {
                    var icon = HSIcons.GetIconsByEName("tsk6");
                    for (int i = 0; i < player.TrapHolder.Count; i++)
                    {
                        e.Graphics.DrawImage(icon, (IsLeft ? Width - 120 : 80) + i * 8, 44, 18, 18);
                    }
                }
            }
            font.Dispose();
        }