void OnValueUpdateEventArgs(object obj, ValueUpdateEventArgs v) { if (v != null) { if (v.key == PetDispatchEventString.ChangePet.ToString()) { ResetData(); InitItem(); SetFirstHigh(); } else if (v.key == PetDispatchEventString.PetSkillInit.ToString()) { InitItem(); } else if (v.key == PetDispatchEventString.LockSkill.ToString()) { stLockSkillPetUserCmd_CS cmd = (stLockSkillPetUserCmd_CS)v.newValue; if (cmd != null) { RefreshLockInfo(cmd); } } else if (v.key == PetDispatchEventString.PetRefreshProp.ToString()) { InitItem(); } } }
void SendSkillLock(uint skillID, bool block) { if (CurPet != null) { stLockSkillPetUserCmd_CS cmd = new stLockSkillPetUserCmd_CS(); cmd.id = CurPet.GetID(); cmd.skill = (int)skillID; cmd.@lock = block; NetService.Instance.Send(cmd); } }
public void OnLockPetSkill(stLockSkillPetUserCmd_CS cmd) { IPet pet = GetPetByThisID(cmd.id); if (pet != null) { pet.SetPetSkillLock((int)cmd.skill, cmd.@lock); } DispatchValueUpdateEvent(new ValueUpdateEventArgs() { key = PetDispatchEventString.LockSkill.ToString(), newValue = cmd }); }
void RefreshLockInfo(stLockSkillPetUserCmd_CS cmd) { int skillID = cmd.skill; for (int i = 0; i < 6; i++) { string itemName = "petskill" + (i + 1).ToString(); Transform go = transform.Find(itemName); if (go != null) { PetSkillItem skill = go.GetComponent <PetSkillItem>(); if (skill != null) { if (skill.SkillData.wdID == skillID) { Transform trans = go.transform.Find("gouxuan"); if (trans != null) { SetLockDic(itemName, cmd.@lock); trans.gameObject.SetActive(cmd.@lock); } uint n = 0; var iter = lockSkillDic.GetEnumerator(); while (iter.MoveNext()) { var dic = iter.Current; if (dic.Value) { n += 1; } } petDataManager.LockSkillNum = n; } } } } }
public void OnLockPetSkill(stLockSkillPetUserCmd_CS cmd) { DataManager.Manager <PetDataManager>().OnLockPetSkill(cmd); }