コード例 #1
0
        public void NpcSkillCD(IpcSkillMsg msg)
        {
            NpcSkillAttr attr = new NpcSkillAttr()
            {
                npcId      = msg.uniqueID,
                skillIndex = msg.index,
                baseCd     = msg.baseCD,
                cdValue    = msg.baseCD,
                isInCd     = true,
            };

            AsyncTask.QueueOnMainThread(
                () =>
            {
                WarClientManager mgr = WarClientManager.Instance;
                if (mgr != null)
                {
                    ClientNPC npc = mgr.npcMgr.GetNpc(msg.uniqueID);
                    if (npc != null)
                    {
                        npc.AddSkillAttr(msg.index, attr);
                    }
                }
            }
                );
        }
コード例 #2
0
        public NpcSkillAttr GetSkillAttr(int index)
        {
            NpcSkillAttr attr = null;

            if (skillAttrDic.TryGetValue(index, out attr))
            {
                return(attr);
            }
            return(null);
        }
コード例 #3
0
        public void OnHeroSelected(int id)
        {
            Debug.Log("switch to npc : " + id);
            WarClientManager mgr = WarClientManager.Instance;

            if (mgr != null)
            {
                cachedNpc = mgr.npcMgr.GetNpc(id);
                if (cachedNpc != null)
                {
                    string name = cachedNpc.data.configData.model + "_skill_" + index;
                    sprite.spriteName = name;
                    attr = cachedNpc.GetSkillAttr(index - 1);
                }
            }
        }
コード例 #4
0
        public void AddSkillAttr(int index, NpcSkillAttr atr)
        {
            NpcSkillAttr attr = null;

            if (skillAttrDic.TryGetValue(index, out attr))
            {
                attr.baseCd  = atr.baseCd;
                attr.cdValue = atr.baseCd;
                attr.isInCd  = true;
            }
            else
            {
                NpcSkillAttr attr2 = new NpcSkillAttr()
                {
                    baseCd     = atr.baseCd,
                    cdValue    = atr.baseCd,
                    isInCd     = true,
                    skillIndex = index,
                    npcId      = UniqueId,
                };
                skillAttrDic.Add(index, attr2);
            }
        }