PetSupportUnlockView = PetSupportUnlockView or BaseClass(BaseView) local PetSupportUnlockView = PetSupportUnlockView function PetSupportUnlockView:__init() self.base_file = "pet" self.layout_file = "PetSupportUnlockView" self.layer_name = "Activity" self.destroy_imm = true self.use_background = true self.change_scene_close = true self.append_to_ctl_queue = false --是否要添加进界面堆栈 self.need_show_money = false --是否要显示顶部的金钱栏 self.is_set_zdepth = true self.model = PetModel:getInstance() self.load_callback = function () self:LoadSuccess() self:AddEvent() end self.open_callback = function ( ) self:OpenSuccess() end self.destroy_callback = function ( ) self:DestroySuccess() end end function PetSupportUnlockView:Open(support_slot) self.support_slot = support_slot BaseView.Open(self) end function PetSupportUnlockView:LoadSuccess() local nodes = { "bg:raw", "closeBtn:obj","goEvolveBtn:obj","confirmBtn:obj", "tips2:txt", } self:GetChildren(nodes) lua_resM:setOutsideRawImage(self,self.bg_raw,GameResPath.GetViewBigBg("tips_comm_bg6"),false) end function PetSupportUnlockView:AddEvent() local on_click = function ( click_obj ) if self.closeBtn_obj == click_obj then self:Close() elseif self.confirmBtn_obj == click_obj then self:Close() elseif self.goEvolveBtn_obj == click_obj then self:Close() OpenFun.Open(163,1) end end AddClickEvent(self.closeBtn_obj, on_click,LuaSoundManager.SOUND_UI.NONE) AddClickEvent(self.confirmBtn_obj, on_click) AddClickEvent(self.goEvolveBtn_obj, on_click) end function PetSupportUnlockView:OpenSuccess() self:UpdateView() end function PetSupportUnlockView:UpdateView() local need_stars = self.model:GetPetSupportSlotCfg(self.support_slot).open_sum_star local sum_stars = self.model:CountPetStars() self.tips2_txt.text = "所有宠物累计星级达到"..sum_stars.."/"..need_stars.."星" end function PetSupportUnlockView:DestroySuccess( ) end