87 lines
2.3 KiB
Lua
87 lines
2.3 KiB
Lua
----灵脉跳转界面 -----
|
|
local this = {}
|
|
--传入父脚本模块
|
|
local parent
|
|
--传入特效层级
|
|
local sortingOrder=0
|
|
|
|
function this:InitComponent(gameObject)
|
|
self.spLoader = SpriteLoader.New()
|
|
self.btnSure = Util.GetGameObject(gameObject,"BtnSure")
|
|
self.btnCancel = Util.GetGameObject(gameObject,"BtnCancel")
|
|
self.money = Util.GetGameObject(gameObject,"Content/money"):GetComponent("Text")
|
|
self.grid1 = Util.GetGameObject(gameObject,"Grid1/scroll")
|
|
self.grid2 = Util.GetGameObject(gameObject,"Grid2")
|
|
self.itemList1 = {}
|
|
self.itemList2 = {}
|
|
end
|
|
|
|
function this:BindEvent()
|
|
Util.AddClick(self.btnCancel,function()
|
|
self.parent:ClosePanel()
|
|
end)
|
|
Util.AddClick(self.btnSure,function()
|
|
NetManager.LifeStoneUpRequest(2,nil,nil,nil,nil,function ()
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.Gem.RefreshPanel)
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.Bag.OnTempBagChanged)
|
|
PopupTipPanel.ShowTip("一键合成成功!")
|
|
self.parent:ClosePanel()
|
|
end)
|
|
end)
|
|
end
|
|
|
|
function this:AddListener()
|
|
end
|
|
|
|
function this:RemoveListener()
|
|
end
|
|
|
|
function this:OnShow(_parent,...)
|
|
self.args = {...}
|
|
self.parent = _parent
|
|
self:Refresh()
|
|
end
|
|
|
|
function this:Refresh()
|
|
self.money.text = self.args[2]
|
|
local list = {}
|
|
for key, value in pairs(self.args[1]) do
|
|
-- LogGreen("id:"..tostring(key).." num:"..tostring(value))
|
|
local data = {}
|
|
data.id = key
|
|
data.num = value
|
|
table.insert(list,data)
|
|
end
|
|
table.sort(list,function (a,b)
|
|
return a.id < b.id
|
|
end)
|
|
local grid = nil
|
|
if #list > 5 then
|
|
grid = self.grid1
|
|
self.grid1:SetActive(true)
|
|
self.grid2:SetActive(false)
|
|
else
|
|
grid = self.grid2
|
|
self.grid1:SetActive(false)
|
|
self.grid2:SetActive(true)
|
|
end
|
|
for i = 1, #list do
|
|
local go = self.itemList1[i]
|
|
if not go then
|
|
go = SubUIManager.Open(SubUIConfig.ItemView,grid.transform)
|
|
self.itemList1[i] = go
|
|
end
|
|
go:OnOpen(false, {list[i].id,list[i].num}, 1, false,false,false,self.parent.sortingOrder + 1)
|
|
go.gameObject:SetActive(true)
|
|
end
|
|
end
|
|
|
|
function this:OnClose()
|
|
end
|
|
|
|
function this:OnDestroy()
|
|
this.spLoader:Destroy()
|
|
self.itemList1 = {}
|
|
end
|
|
|
|
return this |