--[[ 宠物激活、进阶、突破、捕捉、繁殖成功弹窗 ]]-- local UIPetActiveSuccess = UIViewClass() function UIPetActiveSuccess:OnCreated() self.modelComponentDataHandle = UTL.UIRender.CreateModelComponentDatas(self.model_Show) self.btn_Release:SetText(Const_IDS.IDS_PetRelease1) self.btn_Save:SetText(Const_IDS.IDS_BUTTON_CONFIRM) self.btn_Confirm:SetText(Const_IDS.IDS_BUTTON_CONFIRM) UIUtils.SetActive(self.UIPetPopUp.btn_Info, false) end function UIPetActiveSuccess:OnOpened(context) UIManager.ActiveUIModle(false, "UIPetActiveSuccess") self:RegistSystemEvent(EventID.UI_Pet_ClosePetPanel, self.OnClosePanel) self:RegistSystemEvent(EventID.UI_CloseAndRecoverView, self.OnCloseAndRecoverView) self.panelType = context.panelType self.petUniqueID = context.petUniqueID self.petInfo = context.petInfo self.petConfig = context.petConfig self.isReqGet = context.isReqGet self:RefreshPanel() self:LoadModelShow() end function UIPetActiveSuccess:OnClosePanel(viewName) if viewName == Const_UI_Lua.UIEnum.UIPetActiveSuccess then self:CloseView(true) end end function UIPetActiveSuccess:OnClosed() UIManager.ActiveUIModle(true, "UIPetActiveSuccess") UIUtils.SetActive(self.UIPetPopUp.btn_Info, true) UTL.UIRender.DisposeModelComponentData(self.modelComponentDataHandle) if self.isReqGet and MDL.Pet.GetCapturingInfo() ~= nil then MDL.Pet.ConfirmObtainPetReq() MDL.Pet.SetCapturingInfo(nil) end end function UIPetActiveSuccess:OnBackButtonPressed() self:OnButtonClicked(self.UIPetPopUp.btn_Close) end function UIPetActiveSuccess:OnButtonClicked(comp) if comp == self.btn_Release then UIManager.OpenView(Const_UI_Lua.UIEnum.UIPetReleasePopUp, { petInfo = self.petInfo, releaseType = CTL.Pet.ReleasePanelType.CatchAndReproduction }) elseif comp == self.UIPetPopUp.btn_Close or comp == self.btn_Save or comp == self.btn_Confirm then --直接关闭即可带进背包 self:CloseView(true) else for i, v in ipairs(self.cells) do if v.btn_Skill == comp then CTL.Pet.ShowSkillTips(self.petInfo.congenitalSkill[i]) return end if v.img_Locked == comp then CTL.Pet.ShowSkillUnlockTips(i) return end end for i, v in ipairs(self.Info_Attr.Attr_arr) do if comp == v.btn_Attr then CTL.Pet.ShowTalentDesc(self.petConfig, self.petInfo, i, comp) return end end end end function UIPetActiveSuccess:LoadModelShow() UTL.UIRender.CreateRTSceneTrans(self.modelComponentDataHandle, self.petConfig.PetModelLight) local modelPath, modelScale, showEquipmentID, renderID, idleAnimCilp, heroEffectPath, psEffectPath, modelXYZ, modelRot = CTL.Pet.GetRenderTextureModelParam(self.petConfig, self.__viewClassPath) UTL.UIRender.CreateRTRenderModel(self.modelComponentDataHandle, modelPath, modelScale, showEquipmentID, renderID, idleAnimCilp, heroEffectPath, psEffectPath) UTL.UIRender.SetRTRootParam(self.modelComponentDataHandle, modelXYZ, modelRot) end function UIPetActiveSuccess:UpdateTitle() if self.UIPetPopUp.loc_Title.CurState == 0 then if self.panelType == CTL.Pet.PetPopPanelType.Catch then UIUtils.SetLocalizationImage(self.UIPetPopUp.img_Title, "UI_Pet/gxhd_msz.png") elseif self.panelType == CTL.Pet.PetPopPanelType.Reproduction then UIUtils.SetLocalizationImage(self.UIPetPopUp.img_Title, "UI_Pet/gxhd_msz.png") elseif self.panelType == CTL.Pet.PetPopPanelType.Mutation then UIUtils.SetLocalizationImage(self.UIPetPopUp.img_Title, "UI_Pet/bycg_msz.png") elseif self.panelType == CTL.Pet.PetPopPanelType.Advanced then UIUtils.SetLocalizationImage(self.UIPetPopUp.img_Title, "UI_Pet/cwjj_msz_01.png") elseif self.panelType == CTL.Pet.PetPopPanelType.Active or self.panelType == CTL.Pet.PetPopPanelType.EggActive then UIUtils.SetLocalizationImage(self.UIPetPopUp.img_Title, "UI_Pet/jhcg_msz_01.png") end else if self.panelType == CTL.Pet.PetPopPanelType.Catch then UIUtils.SetLabelText(self.UIPetPopUp.txt_Title, Const_IDS.IDS_DrawCard_Title_Congratulations) elseif self.panelType == CTL.Pet.PetPopPanelType.Reproduction then UIUtils.SetLabelText(self.UIPetPopUp.txt_Title, Const_IDS.IDS_DrawCard_Title_Congratulations) elseif self.panelType == CTL.Pet.PetPopPanelType.Mutation then UIUtils.SetLabelText(self.UIPetPopUp.txt_Title, Const_IDS.IDS_PetWash5) elseif self.panelType == CTL.Pet.PetPopPanelType.Advanced then UIUtils.SetLabelText(self.UIPetPopUp.txt_Title, Const_IDS.IDS_PetAdvance4) elseif self.panelType == CTL.Pet.PetPopPanelType.Active or self.panelType == CTL.Pet.PetPopPanelType.EggActive then UIUtils.SetLabelText(self.UIPetPopUp.txt_Title, Const_IDS.IDS_MagicWeapon_SmallActivation) end end end function UIPetActiveSuccess:RefreshPanel() self:UpdateTitle() if self.panelType == CTL.Pet.PetPopPanelType.Catch or self.panelType == CTL.Pet.PetPopPanelType.EggActive then self.btn_State:SetState(0) elseif self.panelType == CTL.Pet.PetPopPanelType.Reproduction then self.btn_State:SetState(0) elseif self.panelType == CTL.Pet.PetPopPanelType.Mutation then self.btn_State:SetState(1) UIUtils.SetLabelText(self.UIPetPopUp.txt_Title, Const_IDS.IDS_PetWash5) elseif self.panelType == CTL.Pet.PetPopPanelType.Advanced then self.btn_State:SetState(1) UIUtils.SetLabelText(self.UIPetPopUp.txt_Title, Const_IDS.IDS_PetAdvance4) elseif self.panelType == CTL.Pet.PetPopPanelType.Active then self.btn_State:SetState(2) UIUtils.SetLabelText(self.UIPetPopUp.txt_Title, Const_IDS.IDS_PetAdvance4) end CTL.Pet.SetPetName(self.txt_Name, self.petInfo, self.petConfig) CTL.Pet.SetPetStar(self.group_Star, self.petInfo.petPedigree, self.petInfo.petGeneration) CTL.Pet.SetPetSign(self.group_Sign, self.petInfo, self.petConfig) CTL.Pet.FormatGrowUpScoreText(self.Info_Attr.txt_BaseAttr, self.petInfo, self.petConfig) CTL.Pet.SetPetAptitude(self.Info_Attr.Attr_arr, self.petInfo, self.petConfig) self:SetTalentSkill(self.cells, self.cell_ActiveSkill, self.petInfo.congenitalSkill) if self.panelType == CTL.Pet.PetPopPanelType.Catch or self.panelType == CTL.Pet.PetPopPanelType.Reproduction then CTL.Sound.PlayGameSound("UI_jeweled_01") elseif self.panelType == CTL.Pet.PetPopPanelType.Active or self.panelType == CTL.Pet.PetPopPanelType.EggActive then CTL.Sound.PlayGameSound("UI_active_03") end end function UIPetActiveSuccess:SetTalentSkill(cellArr, cellTemplate, talentArr) local max = math.max(CTL.Pet.TOTAL_SKILL_COUNT, #talentArr) for i = 1, max do local content = self.cells[i] if not content then content = self:InstantiateCollection(cellArr, cellTemplate.gameObject) UIUtils.SetActive(content.gameObject, true) end if talentArr[i] then content.skill_state:SetState(0) CTL.Pet.SetTalentSkillCell(talentArr[i], content.sprite_Skill, content.txt_SkillType) else content.skill_state:SetState(1) UIUtils.SetLabelText(content.txt_SkillType, CTL.Pet.SkillTypeDesc[i]) end end for i = #cellArr, max + 1, -1 do UIUtils.SetActive(cellArr[i].gameObject, false) end end return UIPetActiveSuccess