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

79 lines
2.7 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

require("Base/BasePanel")
NotEnoughPopup = Inherit(BasePanel)
local this = NotEnoughPopup
-- 跳转商店购买窗口物品id对应界面及参数
local _JumpConfig = {
[16] = {panelName = UIName.MainRechargePanel, params = {1} },
--[15] = {panelName = UIName.MainRechargePanel, params = {1} },
--[16] = {panelName = UIName.ShopExchangePopup, params = {SHOP_TYPE.FUNCTION_SHOP, 10013, "兑换妖晶"} },
}
--初始化组件(用于子类重写)
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
PopupTipPanel.ShowTip("暂时未找到此物品的获取方式,敬请期待")
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("您的%s不足是否立即获取", itemName)
this.title.text = "提 示"
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.Mapping and _JumpConfig[itemId] then
if itemId == 15 and not ShopManager.IsActive(SHOP_TYPE.SOUL_STONE_SHOP)then
PopupTipPanel.ShowTip("所需物品不足")
return
end
if func then func() end
UIManager.OpenPanel(UIName.NotEnoughPopup, itemId)
else
PopupTipPanel.ShowTip("所需物品不足")
end
end
return NotEnoughPopup