【逍遥游】归元弹窗添加

dev_chengFeng
jiaoyangna 2020-10-19 20:21:01 +08:00 committed by gaoxin
parent ed26e9e758
commit 91778b2f77
1 changed files with 78 additions and 0 deletions

View File

@ -0,0 +1,78 @@
----- 归元弹窗 -----
local this = {}
--传入父脚本模块
local parent
--层级
local sortingOrder = 0
--传入不定参
local _args = {}
local itemviews = {}
local itemId = 0
local heroConfig=ConfigManager.GetConfig(ConfigName.HeroConfig)
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
function this:InitComponent(gameObject)
this.titleText = Util.GetGameObject(gameObject, "TitleText"):GetComponent("Text")
this.bodyText = Util.GetGameObject(gameObject, "BodyText"):GetComponent("Text")
this.cancelBtn = Util.GetGameObject(gameObject, "CancelBtn")
this.confirmBtn = Util.GetGameObject(gameObject, "ConfirmBtn")
this.tipText = Util.GetGameObject(gameObject, "tipText"):GetComponent("Text")
this.addBtn = Util.GetGameObject(gameObject, "addBtn")
this.root = Util.GetGameObject(gameObject, "Root/Content")
end
function this:BindEvent()
Util.AddClick(this.cancelBtn,function()
parent:ClosePanel()
end)
Util.AddClick(this.confirmBtn,function()
local count = 1
if BagManager.GetItemCountById(itemId) > 0 then
ShopManager.RequestBuyShopItem(7, 10033, count, function()
PopupTipPanel.ShowTip("恢复50点云游值")
Game.GlobalEvent:DispatchEvent(GameEvent.XiaoYao.RefreshEventShow)
parent:ClosePanel()
end)
else
PopupTipPanel.ShowTip("云游宝玉不足")
end
end)
Util.AddClick(this.addBtn,function()
UIManager.OpenPanel(UIName.ShopBuyPopup, 7,10032,0)
parent:ClosePanel()
end)
end
function this:AddListener()
end
function this:RemoveListener()
end
function this:OnShow(_parent,...)
parent=_parent
sortingOrder =_parent.sortingOrder
local args = {...}
itemId = args[1]
this.titleText.text=itemConfig[itemId].Name
this.bodyText.text = itemConfig[itemId].ItemDescribe
this.tipText.text = "剩余数量:"..BagManager.GetItemCountById(itemId)
for i,v in pairs(itemviews) do
v.gameObject:SetActive(false)
end
if not itemviews[1] then
itemviews[1] = SubUIManager.Open(SubUIConfig.ItemView,this.root.transform)
end
itemviews[1].gameObject:SetActive(true)
itemviews[1]:OnOpen(false,{itemId,0},1,false)
end
function this:OnClose()
end
function this:OnDestroy()
itemviews={}
end
return this