miduo_client/Assets/ManagedResources/~Lua/Modules/Message/NotEnoughPopup.lua

81 lines
2.5 KiB
Lua
Raw Normal View History

2021-04-21 13:12:04 +08:00
require("Base/BasePanel")
2020-05-09 13:31:21 +08:00
NotEnoughPopup = Inherit(BasePanel)
local this = NotEnoughPopup
-- 跳转商店购买窗口物品id对应界面及参数
local _JumpConfig = {
2021-03-31 19:33:12 +08:00
[16] = 36008,
2021-03-30 20:17:26 +08:00
--[15] = {36010},
--[16] = {36010},
2020-05-09 13:31:21 +08:00
}
--初始化组件(用于子类重写)
function NotEnoughPopup:InitComponent()
2021-04-21 13:12:04 +08:00
this.spLoader = SpriteLoader.New()
2020-05-09 13:31:21 +08:00
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
2021-03-30 20:17:26 +08:00
JumpManager.GoJump(_JumpConfig[this._ItemId])
2020-05-09 13:31:21 +08:00
else
2021-03-02 16:53:12 +08:00
PopupTipPanel.ShowTip(Language[11311])
2020-05-09 13:31:21 +08:00
end
end)
end
--添加事件监听(用于子类重写)
function NotEnoughPopup:AddListener()
end
--移除事件监听(用于子类重写)
function NotEnoughPopup:RemoveListener()
end
--界面打开时调用(用于子类重写)
function NotEnoughPopup:OnOpen(itemId)
this._ItemId = itemId
2021-01-26 17:08:39 +08:00
local itemName = GetLanguageStrById(ConfigManager.GetConfigData(ConfigName.ItemConfig, itemId).Name)
2021-03-02 16:53:12 +08:00
this.content.text = string.format(Language[11312], itemName)
this.title.text = Language[11313]
2020-05-09 13:31:21 +08:00
this._toggle.gameObject:SetActive(false)
end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
function NotEnoughPopup:OnShow()
end
--界面关闭时调用(用于子类重写)
function NotEnoughPopup:OnClose()
end
--界面销毁时调用(用于子类重写)
function NotEnoughPopup:OnDestroy()
2021-04-21 13:12:04 +08:00
this.spLoader:Destroy()
2020-05-09 13:31:21 +08:00
end
--
function NotEnoughPopup:Show(itemId, func)
if not MapManager.Mapping and _JumpConfig[itemId] then
2020-05-09 13:31:21 +08:00
if itemId == 15 and not ShopManager.IsActive(SHOP_TYPE.SOUL_STONE_SHOP)then
2021-03-02 16:53:12 +08:00
PopupTipPanel.ShowTip(Language[10839])
2020-05-09 13:31:21 +08:00
return
end
if func then func() end
UIManager.OpenPanel(UIName.NotEnoughPopup, itemId)
else
2021-03-02 16:53:12 +08:00
PopupTipPanel.ShowTip(Language[10839])
2020-05-09 13:31:21 +08:00
end
end
2020-06-23 18:36:24 +08:00
return NotEnoughPopup