Exemplo n.º 1
0
        void ClearAllBuff()
        {
            List <stStateValue> stateList = new List <stStateValue>();

            foreach (var dic in buffDic)
            {
                uint       itemID   = dic.Key;
                stBuffData buffdata = dic.Value;
                foreach (var state in buffdata.buffDataDic)
                {
                    stStateValue st = state.Value;
                    stateList.Add(st);
                }
            }
            foreach (var st in stateList)
            {
                RemoveEntityBuff(st.baseid, st.thisid);
            }
            buffDic.Clear();
        }
Exemplo n.º 2
0
        public void ReceiveBuffList(List <stStateValue> list)
        {
            IEntity en = m_Master;

            for (int i = 0; i < list.Count; i++)
            {
                var state = list[i];
                ChangeCreatureByBuff(en, state.baseid, true);

                //客户端使用毫秒的精度
                state.ltime = state.ltime * 1000;
                stBuffData buffData;
                if (buffDic.TryGetValue(state.thisid, out buffData))
                {
                    if (buffData.buffDataDic.ContainsKey(state.thisid))
                    {
                        buffData.buffDataDic[state.thisid] = state;
                    }
                    else
                    {
                        buffData.buffDataDic.Add(state.thisid, state);
                    }
                    // Buff Update
                    // 更新时间
                }
                else
                {
                    buffData             = new stBuffData();
                    buffData.buffid      = state.thisid;
                    buffData.buffDataDic = new Dictionary <uint, stStateValue>();
                    buffData.buffDataDic.Add(state.thisid, state);
                    buffDic.Add(state.thisid, buffData);
                    AddBuffEffect(state.baseid, state.thisid);


                    if (en != null)
                    {
                        stAddBuff addBuff = new stAddBuff();
                        addBuff.buffid     = state.baseid;
                        addBuff.uid        = en.GetUID();
                        addBuff.level      = state.level;
                        addBuff.lTime      = state.ltime;
                        addBuff.buffThisID = state.thisid;
                        EventEngine.Instance().DispatchEvent((int)GameEventID.BUFF_ADDTOTARGETBUFF, addBuff);
                    }
                }
            }
            if (list.Count > 0)
            {
                int          len   = list.Count;
                stStateValue state = list[len - 1];

                BuffDataBase bdb = GameTableManager.Instance.GetTableItem <BuffDataBase>(state.baseid);
                if (bdb != null)
                {
                    string str = bdb.buffColor;
                    Color  c   = SkillSystem.GetColorByStr(str);
                    if (c == null)
                    {
                        return;
                    }
                    if (en != null)
                    {
                        m_buffColorEntity = en;
                        en.SendMessage(EntityMessage.EntityCommond_SetColor, c);
                        if (TimerAxis.Instance().IsExist(m_ucolorCountDownTimerID, this))
                        {
                            TimerAxis.Instance().KillTimer(m_ucolorCountDownTimerID, this);
                        }

                        TimerAxis.Instance().SetTimer(m_ucolorCountDownTimerID, state.ltime, this, 1);
                    }
                }
            }
        }