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

79 lines
2.6 KiB
Lua
Raw Normal View History

2020-08-25 15:46:38 +08:00
require("Base/BasePanel")
2020-05-09 13:31:21 +08:00
NotEnoughPopup = Inherit(BasePanel)
local this = NotEnoughPopup
-- 跳转商店购买窗口物品id对应界面及参数
local _JumpConfig = {
2020-06-03 19:09:01 +08:00
[16] = {panelName = UIName.MainRechargePanel, params = {1} },
--[15] = {panelName = UIName.MainRechargePanel, params = {1} },
--[16] = {panelName = UIName.ShopExchangePopup, params = {SHOP_TYPE.FUNCTION_SHOP, 10013, "兑换妖晶"} },
2020-05-09 13:31:21 +08:00
}
--初始化组件(用于子类重写)
function NotEnoughPopup:InitComponent()
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
UIManager.OpenPanel(_JumpConfig[this._ItemId].panelName, unpack(_JumpConfig[this._ItemId].params))
else
2020-06-23 18:36:24 +08:00
PopupTipPanel.ShowTip(Language[11353])
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
local itemName = ConfigManager.GetConfigData(ConfigName.ItemConfig, itemId).Name
2020-06-23 18:36:24 +08:00
this.content.text = string.format(Language[11354], itemName)
this.title.text = Language[11355]
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()
end
--
function NotEnoughPopup:Show(itemId, func)
if not MapManager.isInMap and _JumpConfig[itemId] then
if itemId == 15 and not ShopManager.IsActive(SHOP_TYPE.SOUL_STONE_SHOP)then
2020-06-23 18:36:24 +08:00
PopupTipPanel.ShowTip(Language[10847])
2020-05-09 13:31:21 +08:00
return
end
if func then func() end
UIManager.OpenPanel(UIName.NotEnoughPopup, itemId)
else
2020-06-23 18:36:24 +08:00
PopupTipPanel.ShowTip(Language[10847])
2020-05-09 13:31:21 +08:00
end
end
2020-06-23 18:36:24 +08:00
return NotEnoughPopup