--[[ 主界面邀请繁殖弹窗 ]]-- local UIPetInviteView = UIViewClass() local PetBornInterfaceCountdown = DataSheetManager.ConstData:GetDataByID("PetBornInterfaceCountdown").IntValue function UIPetInviteView:OnOpened(context) local breedInfo = context.msg.breedInfo UIUtils.SetLabel(self.txt_Name, breedInfo.playerName) local collection = self.group_PetHead.pet_Arr[1] CTL.Pet.SetPetIconComp(collection.img_Pet, collection.img_Qua, nil, breedInfo.petId, MDL.Pet.PetState.Basic ) UIUtils.SetLabel(collection.txt_Level, string.FormatByIdsId(Const_IDS.IDS_RankOptimization_StarName, breedInfo.petPedigree)) self:StartRepeatFunc(self.OnUpdateFun,0,-1) self:SetPushStyle(LuaConst.PushStyleEnum.CLOSENOTRECOVER) end function UIPetInviteView:OnButtonClicked(comp) if comp == self.btn_Accept then local breedInfo = self.context.msg.breedInfo MDL.Pet.BreedPetInviteHandleReq(breedInfo.playerAcid, breedInfo.petId, {playerAcid = breedInfo.playerAcid, playerName = breedInfo.playerName, petId = breedInfo.petId}) self.isAccepted = true self:CloseView() elseif comp == self.btn_Close then self:CloseView() end end function UIPetInviteView:OnUpdateFun(deltaTime, timeSinceUpdate) self.passTime = timeSinceUpdate local ratio = 1 - self.passTime / PetBornInterfaceCountdown if ratio <= 0 then self:CloseView() return end self.Slider_pro.value = ratio end function UIPetInviteView:OnClosed() if not self.isAccepted and not self.context.msg.isCallBack then MDL.Pet.AddPetBreedInvitedNotice(self.context.msg) end end return UIPetInviteView