autoImport("PetComposePreviewCell") autoImport("PetComposeChooseCell") PetComposePopUp = class("PetComposePopUp", ContainerView) PetComposePopUp.ViewType = UIViewType.PopUpLayer PetComposePopUp.CellResID = ResourcePathHelper.UICell("PetComposePreviewCell") local CFG_FIELD = "MaterialPet" local tempVector3 = LuaVector3.zero local packageCheck = GameConfig.PackageMaterialCheck.pet_workspace local function SortPet(a,b) if a == nil or b == nil then return false end if(a.unlocked and b.unlocked)then return a.petid pet.friendlv)then return false end return true end function PetComposePopUp:ShowPetChooseView(data) self.curIndex = data.index local mat = CFG_FIELD..self.curIndex self.curCfg = self.staticData[mat] local pets = self:GetPets() if(not pets or #pets<=0)then MsgManager.ShowMsgByID(25715) return end self:Show(self.petChoosePanel) table.sort( pets, function (a,b) return SortPet(a,b) end ) self.petlist:UpdateInfo(pets) self.petlist:ResetPosition() end function PetComposePopUp:AddIgnoreBounds(obj) if(self.gameObject and self.closecomp)then self.closecomp:AddTarget(obj.transform); end end function PetComposePopUp:SetComposeBtnState() local c = PetComposeProxy.Instance:CanCompose() if(c)then ColorUtil.WhiteUIWidget(self.composeBtn) ColorUtil.WhiteUIWidget(self.composeLab) else ColorUtil.ShaderLightGrayUIWidget(self.composeBtn) ColorUtil.ShaderLightGrayUIWidget(self.composeLab) end self.composeLab.effectStyle = c and UILabel.Effect.Outline or UILabel.Effect.None end function PetComposePopUp:OnCompose() if(self.forbiddenFlag)then return end local canCompose = PetComposeProxy.Instance:CanCompose() if(not canCompose)then return end if(self.staticData.ZenyCost>MyselfProxy.Instance:GetROB())then MsgManager.ShowMsgByID(1) return end local dont = LocalSaveProxy.Instance:GetDontShowAgain(25713) if nil == dont then MsgManager.DontAgainConfirmMsgByID(25713, function () self:_CloseUI() end) else self:_CloseUI() end end function PetComposePopUp:_CloseUI() self.root:PlayComposeEffect() self:PlayUIEffect(EffectMap.UI.NewPet,self.effContainer,false) self.forbiddenFlag = true LeanTween.cancel(self.gameObject) LeanTween.delayedCall(self.gameObject,3,function () local guids = PetComposeProxy.Instance:GetGuids() ServiceScenePetProxy.Instance:CallComposePetCmd(self.staticData.id, guids) MsgManager.ShowMsgByID(25714) self:CloseSelf() self.forbiddenFlag = false end) end