PGRData/Script/matrix/xui/xuirpgmakergame/character/XUiPanelGraphic.lua

53 lines
No EOL
1.7 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

--------------图示格子节点 begin --------------------
local XUiGridGraphic = XClass(nil, "XUiGridGraphic")
function XUiGridGraphic:Ctor(ui, rootUi)
self.GameObject = ui.gameObject
self.Transform = ui.transform
XTool.InitUiObject(self)
self.RootUi = rootUi
end
function XUiGridGraphic:Refresh(beforeIcon, afterIcon)
self.RootUi:SetUiSprite(self.ImgBefore, beforeIcon)
self.RootUi:SetUiSprite(self.ImgAfter, afterIcon)
end
--------------图示格子节点 end ----------------------
--图示面板
local XUiPanelGraphic = XClass(nil, "XUiPanelGraphic")
function XUiPanelGraphic:Ctor(ui, rootUi)
self.GameObject = ui.gameObject
self.Transform = ui.transform
XTool.InitUiObject(self)
self.RootUi = rootUi
self:InitDynamicTable()
end
function XUiPanelGraphic:InitDynamicTable()
self.DynamicTable = XDynamicTableNormal.New(self.SViewGraphicList)
self.DynamicTable:SetDelegate(self)
self.DynamicTable:SetProxy(XUiGridGraphic, self.RootUi)
self.GridGraphic.gameObject:SetActiveEx(false)
end
--roleIdRpgMakerGameRole表的Id
function XUiPanelGraphic:Refresh(roleId)
self.GraphicBeforeList = XRpgMakerGameConfigs.GetRoleGraphicBefore(roleId)
self.GraphicAfterList = XRpgMakerGameConfigs.GetRoleGraphicAfter(roleId)
self.DynamicTable:SetDataSource(self.GraphicBeforeList)
self.DynamicTable:ReloadDataSync()
end
function XUiPanelGraphic:OnDynamicTableEvent(event, index, grid)
if event == DYNAMIC_DELEGATE_EVENT.DYNAMIC_GRID_ATINDEX then
local beforeIcon = self.GraphicBeforeList[index]
local afterIcon = self.GraphicAfterList[index]
grid:Refresh(beforeIcon, afterIcon)
end
end
return XUiPanelGraphic