// 激活指定图标的宠物aa public void ActivePet(int iIndex) { GameObject kPetObj = mPetIconObjectList[iIndex] as GameObject; sdPetShortCutIcon kPetShortCutIcon = kPetObj.GetComponentInChildren <sdPetShortCutIcon>(); if (kPetShortCutIcon != null) { kPetObj.SetActive(true); kPetShortCutIcon.OnClick(); } }
// 更新宠物相关UIaa public void RefreshPet() { skillPetObject.SetActive(false); friendPetIconObject.SetActive(false); int iActivePetIndex = sdNewPetMgr.Instance.ActivePetIndex; for (int i = 0; i < sdNewPetMgr.Instance.BattlePetNum; i++) { GameObject petObj = mPetIconObjectList[i] as GameObject; UInt64 ulDBID = sdNewPetMgr.Instance.GetPetFromTeamByIndex(i); if (ulDBID != UInt64.MaxValue) { Hashtable kPetProperty = sdNewPetMgr.Instance.GetPetPropertyFromDBID(ulDBID); if (kPetProperty == null) { continue; } // 宠物图标. if (sdConfDataMgr.Instance().PetAtlas != null) { petObj.transform.FindChild("Button").FindChild("Bg").GetComponent <UISprite>().atlas = sdConfDataMgr.Instance().PetAtlas; } else { LoadPetIcon(); } petObj.transform.FindChild("Button").FindChild("Bg").GetComponent <UISprite>().spriteName = kPetProperty["Icon"] as string; // 宠物品质框. UISprite spFrame = petObj.transform.FindChild("Button").FindChild("Bg1").GetComponent <UISprite>(); spFrame.spriteName = sdConfDataMgr.Instance().GetPetQuilityBorder(int.Parse(kPetProperty["Ability"].ToString())); // 宠物激活状态. sdPetShortCutIcon petIcon = petObj.transform.FindChild("Button").GetComponent <sdPetShortCutIcon>(); petIcon.id = (uint)i; if (i == iActivePetIndex) { petIcon.ActivePet(); int iSpSkillId = (int)kPetProperty["SpSkill"]; if (iSpSkillId != 0) { skillPetObject.SetActive(true); UISprite sp = mPetSkillIconBackgroundObject.GetComponent <UISprite>(); if (sp != null) { Hashtable kSkillInfo = sdConfDataMgr.Instance().m_MonsterSkillInfo[iSpSkillId] as Hashtable; if (kSkillInfo != null) { sp.spriteName = kSkillInfo["icon"] as string; if (sdConfDataMgr.Instance().PetSkillAtlas != null) { sp.atlas = sdConfDataMgr.Instance().PetSkillAtlas; } else { LoadPetSkillIcon(); } } } } } else { petIcon.DeactivePet(); } } else { if (petObj != null) { petObj.SetActive(false); } } } // 好友宠物. Hashtable kFriendPetProperty = sdNewPetMgr.Instance.FriendPetProperty; if (kFriendPetProperty != null) { friendPetIconObject.SetActive(true); if (sdConfDataMgr.Instance().PetAtlas != null) { friendPetIconObject.transform.FindChild("Button").FindChild("Bg").GetComponent <UISprite>().atlas = sdConfDataMgr.Instance().PetAtlas; } else { LoadPetIcon(); } friendPetIconObject.transform.FindChild("Button").FindChild("Bg").GetComponent <UISprite>().spriteName = kFriendPetProperty["Icon"] as string; // 宠物品质框. UISprite spFrame = friendPetIconObject.transform.FindChild("Button").FindChild("Bg1").GetComponent <UISprite>(); spFrame.spriteName = sdConfDataMgr.Instance().GetPetQuilityBorder(int.Parse(kFriendPetProperty["Ability"].ToString())); // 宠物激活状态. sdPetShortCutIcon petIcon = friendPetIconObject.transform.FindChild("Button").GetComponent <sdPetShortCutIcon>(); petIcon.id = (ulong)sdNewPetMgr.Instance.BattlePetNum; if (sdNewPetMgr.Instance.IsFriendPetActived) { petIcon.ActivePet(); } else { petIcon.DeactivePet(); } } }