require("Base/BasePanel") NotEnoughPopup = Inherit(BasePanel) local this = NotEnoughPopup -- 跳转商店购买窗口,物品id对应界面及参数 local _JumpConfig = { [16] = 36008, --[15] = {36010}, --[16] = {36010}, } --初始化组件(用于子类重写) function NotEnoughPopup:InitComponent() this.spLoader = SpriteLoader.New() this.title = Util.GetGameObject(self.transform, "buttom/title"):GetComponent("Text") this.content = Util.GetGameObject(self.transform, "buttom/content"):GetComponent("Text") this.btnLeft = Util.GetGameObject(self.transform, "buttom/op/btnLeft") this.btnRight = Util.GetGameObject(self.transform, "buttom/op/btnRight") this._toggle= Util.GetGameObject (self.transform, "buttom/Toggle") end --绑定事件(用于子类重写) function NotEnoughPopup:BindEvent() Util.AddClick(this.btnLeft, function() this:ClosePanel() end) Util.AddClick(this.btnRight, function() this:ClosePanel() if _JumpConfig[this._ItemId] then JumpManager.GoJump(_JumpConfig[this._ItemId]) else PopupTipPanel.ShowTip(Language[11311]) end end) end --添加事件监听(用于子类重写) function NotEnoughPopup:AddListener() end --移除事件监听(用于子类重写) function NotEnoughPopup:RemoveListener() end --界面打开时调用(用于子类重写) function NotEnoughPopup:OnOpen(itemId) this._ItemId = itemId local itemName = GetLanguageStrById(ConfigManager.GetConfigData(ConfigName.ItemConfig, itemId).Name) this.content.text = string.format(Language[11312], itemName) this.title.text = Language[11313] this._toggle.gameObject:SetActive(false) end --界面打开或者重新打开后,界面刷新时调用(用于子类重写) function NotEnoughPopup:OnShow() end --界面关闭时调用(用于子类重写) function NotEnoughPopup:OnClose() end --界面销毁时调用(用于子类重写) function NotEnoughPopup:OnDestroy() this.spLoader:Destroy() end -- function NotEnoughPopup:Show(itemId, func) if not MapManager.Mapping and _JumpConfig[itemId] then if itemId == 15 and not ShopManager.IsActive(SHOP_TYPE.SOUL_STONE_SHOP)then PopupTipPanel.ShowTip(Language[10839]) return end if func then func() end UIManager.OpenPanel(UIName.NotEnoughPopup, itemId) else PopupTipPanel.ShowTip(Language[10839]) end end return NotEnoughPopup