Beispiel #1
0
        public void AddBuff(int buffId, int blevel, double dura)
        {
            BuffConfig buffConfig = ConfigData.GetBuffConfig(buffId);
            var        immuneRate = GetBuffImmuneRate(buffConfig.Group);

            if (immuneRate >= 1)//免疫了
            {
                return;
            }
            if (immuneRate > 0)
            {
                dura *= (1 - immuneRate);
            }

            MemBaseBuff buffdata;

            if (buffDict.TryGetValue(buffId, out buffdata))
            {
                buffdata.TimeLeft = Math.Max(buffdata.TimeLeft, dura);
            }
            else
            {
                Buff buff = new Buff(buffId);
                buff.UpgradeToLevel(blevel);
                buffdata = new MemBaseBuff(buff, dura);
                //buff.CheckBuffEffect(this, 1);
                buffdata.OnAddBuff(self);
                buffDict.Add(buffId, buffdata);
            }
        }
Beispiel #2
0
        public void DrawBuff(Graphics g, int roundKey)
        {
            MemBaseBuff[] copybuffs = new MemBaseBuff[buffDict.Count];
            buffDict.Values.CopyTo(copybuffs, 0);
            if (copybuffs.Length >= 1 && roundKey % 2 == 0)
            {
                int index = 0;
                int wid   = 100 / copybuffs.Length;
                foreach (var buff in copybuffs)
                {
                    var color = BuffBook.GetBuffColor(buff.Id);
                    var brush = new SolidBrush(color);
                    if (index == copybuffs.Length - 1)//最后一个
                    {
                        g.FillRectangle(brush, wid * index, 0, 100 - wid * (index - 1), 100);
                    }
                    else
                    {
                        g.FillRectangle(brush, wid * index, 0, wid, 100);
                    }
                    brush.Dispose();

                    g.DrawImage(BuffBook.GetBuffImage(buff.Id, (buff.RoundMark / 3) % 2), new Rectangle(wid * index + (wid - 20) / 2, 40, 20, 20), new Rectangle(0, 0, 20, 20), GraphicsUnit.Pixel);

                    index++;
                }
            }
        }
Beispiel #3
0
        public void AddBuff(int buffId, int blevel, double dura)
        {
            BuffConfig buffConfig = ConfigData.GetBuffConfig(buffId);
            var immuneRate = GetBuffImmuneRate(buffConfig.Group);
            if (immuneRate >= 1)//免疫了
            {
                return;
            }
            if (immuneRate > 0)
            {
                dura *= (1 - immuneRate);
            }

            MemBaseBuff buffdata;
            if (buffDict.TryGetValue(buffId, out buffdata))
            {
                buffdata.TimeLeft = Math.Max(buffdata.TimeLeft, dura);
            }
            else
            {
                Buff buff = new Buff(buffId);
                buff.UpgradeToLevel(blevel);
                buffdata = new MemBaseBuff(buff, dura);
                //buff.CheckBuffEffect(this, 1);
                buffdata.OnAddBuff(self);
                buffDict.Add(buffId, buffdata);
            }
        }
Beispiel #4
0
        public void DrawBuffToolTip(TipImage tipData)
        {
            MemBaseBuff[] memBasebuffInfos = new MemBaseBuff[buffDict.Count];
            buffDict.Values.CopyTo(memBasebuffInfos, 0);
            foreach (MemBaseBuff buffdata in memBasebuffInfos)
            {
                Buff   buff = buffdata.BuffInfo;
                string tp   = "";
                if (buff.BuffConfig.Type[1] == 's')
                {
                    tp = string.Format("{0}(剩余{1:0.0}回合)", buff.BuffConfig.Name, buffdata.TimeLeft);
                }
                else if (buff.BuffConfig.Type[1] == 'a')
                {
                    tp = string.Format("{0}({1})", buff.BuffConfig.Name, buff.Descript);
                }

                tipData.AddImageNewLine(BuffBook.GetBuffImage(buffdata.Id, 0));

                tipData.AddText(tp, BuffBook.GetBuffColor(buffdata.Id));
            }
        }
Beispiel #5
0
        public void DrawBuff(Graphics g, int roundKey)
        {
            MemBaseBuff[] copybuffs = new MemBaseBuff[buffDict.Count];
            buffDict.Values.CopyTo(copybuffs, 0);
            if (copybuffs.Length >= 1 && roundKey % 2 == 0)
            {
                int index = 0;
                int wid = 100/copybuffs.Length;
                foreach (var buff in copybuffs)
                {
                    var color = BuffBook.GetBuffColor(buff.Id);
                    var brush = new SolidBrush(color);
                    if (index == copybuffs.Length-1)//最后一个
                    {
                        g.FillRectangle(brush, wid * index, 0,100- wid*(index-1), 100);
                    }
                    else
                    {
                        g.FillRectangle(brush, wid * index, 0, wid, 100);
                    }
                    brush.Dispose();

                    g.DrawImage(BuffBook.GetBuffImage(buff.Id,(buff.RoundMark / 3) % 2), new Rectangle(wid * index + (wid-20)/2, 40, 20, 20), new Rectangle(0, 0, 20, 20), GraphicsUnit.Pixel);

                    index++;
                } 
            }
        }
Beispiel #6
0
        public void DrawBuffToolTip(TipImage tipData)
        {
            MemBaseBuff[] memBasebuffInfos = new MemBaseBuff[buffDict.Count];
            buffDict.Values.CopyTo(memBasebuffInfos, 0);
            foreach (MemBaseBuff buffdata in memBasebuffInfos)
            {
                Buff buff = buffdata.BuffInfo;
                string tp = "";
                if (buff.BuffConfig.Type[1] == 's')
                    tp = string.Format("{0}(剩余{1:0.0}回合)", buff.BuffConfig.Name, buffdata.TimeLeft);
                else if (buff.BuffConfig.Type[1] == 'a')
                    tp = string.Format("{0}({1})", buff.BuffConfig.Name, buff.Descript);

                tipData.AddImageNewLine(BuffBook.GetBuffImage(buffdata.Id, 0));

                tipData.AddText(tp, BuffBook.GetBuffColor(buffdata.Id));
            }
        }