require("Base/BasePanel") TaiChuMiJuanPanel = Inherit(BasePanel) local this = TaiChuMiJuanPanel --初始化组件(用于子类重写) function TaiChuMiJuanPanel:InitComponent() this.spLoader = SpriteLoader.New() -- 屏幕适配修改 this.btnRoot = Util.GetGameObject(self.gameObject, "btnRoot") this.itemPre = Util.GetGameObject(this.btnRoot, "itemPre") this.title = Util.GetGameObject(this.btnRoot, "title") this.grid = Util.GetGameObject(this.btnRoot, "bg/mask/circle/root") this.backBtn = Util.GetGameObject(this.btnRoot, "backBtn") this.NoneImage = Util.GetGameObject(this.btnRoot, "bg/NoneImage") this.cir = Util.GetGameObject(this.btnRoot, "bg/mask/circle") this.itemPres = {} this.upview = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft }) end --绑定事件(用于子类重写) function TaiChuMiJuanPanel:BindEvent() Util.AddClick(this.backBtn,function() this:ClosePanel() end) end --添加事件监听(用于子类重写) function TaiChuMiJuanPanel:AddListener() end --移除事件监听(用于子类重写) function TaiChuMiJuanPanel:RemoveListener() end --副本类型 1 综合 2 万象 function TaiChuMiJuanPanel:OnOpen(data) this.data = data end --界面打开时调用(用于子类重写) function TaiChuMiJuanPanel:OnShow(...) if not this.upview then this.upview = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft }) end this.upview:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.Main }) if not this.data or #this.data < 1 then this.NoneImage.gameObject:SetActive(true) this.cir.gameObject:SetActive(false) else this.NoneImage.gameObject:SetActive(false) this.cir.gameObject:SetActive(true) for i = 1, math.max(#this.itemPres,#this.data) do if not this.data[i] then this.itemPres[i].go.gameObject:SetActive(false) else if not this.itemPres[i] then this.itemPres[i] = {} this.itemPres[i].go = newObjToParent(this.itemPre,this.grid) this.itemPres[i].bg = Util.GetGameObject(this.itemPres[i].go, "mask/bg"):GetComponent("Image") end this.itemPres[i].go.gameObject:SetActive(true) this.itemPres[i].bg.sprite = this.data[i].sprite -- this.itemPres[i].bg:SetNativeSize() Util.AddOnceClick(this.itemPres[i].go,function() OpenWeb(this.data[i].linkAddress) end) end end end end --界面关闭时调用(用于子类重写) function TaiChuMiJuanPanel:OnClose() end --界面销毁时调用(用于子类重写) function TaiChuMiJuanPanel:OnDestroy() this.spLoader:Destroy() this.itemPres = {} SubUIManager.Close(this.upview) this.upview = nil end return TaiChuMiJuanPanel