Пример #1
0
        public virtual TData Add(TData buff)
        {
            if (!SelfBaseUnit.IsLive)
            {
                return(null);
            }
            TData     newBuff   = null;
            BuffGroup buffGroup = null;

            //有buff组的buff叠加
            if (!string.IsNullOrEmpty(buff.BuffGroupID))
            {
                if (!Data.ContainsKey(buff.BuffGroupID))
                {
                    var tempGroup = new BuffGroup();
                    Data.Add(buff.BuffGroupID, tempGroup);
                    ListData.Add(tempGroup);
                    //没有隐藏的buff加入显示队列
                    if (!buff.IsHide)
                    {
                        ShowData.Add(tempGroup);
                    }
                    //非永久buff加入 update队列
                    if (buff.IsHaveMaxTime)
                    {
                        UpdateData.Add(tempGroup);
                    }
                }
                buffGroup = Data[buff.BuffGroupID];
                newBuff   = buffGroup.Add(buff, SelfBaseUnit);
            }
            //没有buff组的buff合并
            else
            {
                if (!Data.ContainsKey(buff.TDID))
                {
                    var tempGroup = new BuffGroup();
                    Data.Add(buff.TDID, tempGroup);
                    ListData.Add(tempGroup);
                    //没有隐藏的buff加入显示队列
                    if (!buff.IsHide)
                    {
                        ShowData.Add(tempGroup);
                    }
                    //非永久buff加入 update队列
                    if (buff.IsHaveMaxTime)
                    {
                        UpdateData.Add(tempGroup);
                    }
                }
                buffGroup = Data[buff.TDID];
                newBuff   = buffGroup.Merge(buff, SelfBaseUnit);
            }
            if (BaseGlobal.IsUnReadData)
            {
                Callback_OnBuffChange?.Invoke();
            }
            return(newBuff);
        }
Пример #2
0
        public virtual TData Add(TData buff, BaseUnit caster = null, float step = 0.0f, TDBaseSkillData skill = null)
        {
            if (!SelfBaseUnit.IsLive)
            {
                return(null);
            }
            TData     newBuff   = null;
            BuffGroup buffGroup = null;

            //有buff组的buff叠加
            if (!string.IsNullOrEmpty(buff.BuffGroupID))
            {
                if (!Data.ContainsKey(buff.BuffGroupID))
                {
                    var tempGroup = new BuffGroup();
                    Data.Add(buff.BuffGroupID, tempGroup);
                    ListData.Add(tempGroup);

                    //非永久buff加入 update队列
                    if (buff.MaxTime > 0)
                    {
                        UpdateDataList.Add(tempGroup);
                    }
                }
                buffGroup = Data[buff.BuffGroupID];
                newBuff   = buffGroup.Add(buff, SelfBaseUnit, caster, skill);
            }
            //没有buff组的buff合并
            else
            {
                if (!Data.ContainsKey(buff.TDID))
                {
                    var tempGroup = new BuffGroup();
                    Data.Add(buff.TDID, tempGroup);
                    ListData.Add(tempGroup);

                    //非永久buff加入 update队列
                    if (buff.MaxTime > 0)
                    {
                        UpdateDataList.Add(tempGroup);
                    }
                }
                buffGroup = Data[buff.TDID];
                newBuff   = buffGroup.Merge(buff, SelfBaseUnit, caster, skill);
            }
            Callback_OnBuffChange?.Invoke();
            if (newBuff != null)
            {
                newBuff.SetStep(step);
            }
            return(newBuff);
        }
Пример #3
0
 public virtual void Remove(TData buff)
 {
     if (buff == null)
     {
         return;
     }
     //buff叠加
     if (!string.IsNullOrEmpty(buff.BuffGroupID))
     {
         if (Data.ContainsKey(buff.BuffGroupID))
         {
             var tempGroup = Data[buff.BuffGroupID];
             tempGroup.Remove(buff);
             if (tempGroup.Layer <= 0)
             {
                 Data.Remove(buff.BuffGroupID);
                 ListData.Remove(tempGroup);
                 if (!buff.IsHide)
                 {
                     ShowData.Remove(tempGroup);
                 }
                 if (buff.IsHaveRTMaxTime)
                 {
                     UpdateData.Remove(tempGroup);
                 }
             }
         }
     }
     //buff合并
     else
     {
         if (Data.ContainsKey(buff.TDID))
         {
             var tempGroup = Data[buff.TDID];
             tempGroup.Remove(buff);
             if (tempGroup.Layer <= 0)
             {
                 Data.Remove(buff.TDID);
                 ListData.Remove(tempGroup);
                 if (!buff.IsHide)
                 {
                     ShowData.Remove(tempGroup);
                 }
                 if (buff.IsHaveRTMaxTime)
                 {
                     UpdateData.Remove(tempGroup);
                 }
             }
         }
     }
     Callback_OnBuffChange?.Invoke();
 }
Пример #4
0
        public virtual void Remove(TData buff)
        {
            //buff叠加
            if (!string.IsNullOrEmpty(buff.BuffGroupID))
            {
                if (Data.ContainsKey(buff.BuffGroupID))
                {
                    var tempGroup = Data[buff.BuffGroupID];
                    tempGroup.Remove(buff);
                    if (tempGroup.Layer <= 0)
                    {
                        Data.Remove(buff.BuffGroupID);
                        ListData.Remove(tempGroup);

                        if (buff.MaxTime > 0)
                        {
                            UpdateDataList.Remove(tempGroup);
                        }
                    }
                }
            }
            //buff合并
            else
            {
                if (Data.ContainsKey(buff.TDID))
                {
                    var tempGroup = Data[buff.TDID];
                    tempGroup.Remove(buff);
                    if (tempGroup.Layer <= 0)
                    {
                        Data.Remove(buff.TDID);
                        ListData.Remove(tempGroup);

                        if (buff.MaxTime > 0)
                        {
                            UpdateDataList.Remove(tempGroup);
                        }
                    }
                }
            }
            Callback_OnBuffChange?.Invoke();
        }