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); } } } ); }
public NpcSkillAttr GetSkillAttr(int index) { NpcSkillAttr attr = null; if (skillAttrDic.TryGetValue(index, out attr)) { return(attr); } return(null); }
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); } } }
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); } }