PGRData/Resources/Scripts/XUi/XUiTask/XUiPanelTaskWeekly.lua
2022-12-26 14:06:01 +05:30

46 lines
No EOL
1.4 KiB
Lua

XUiPanelTaskWeekly = XClass(nil, "XUiPanelTaskWeekly")
function XUiPanelTaskWeekly:Ctor(ui, parent)
self.GameObject = ui.gameObject
self.Transform = ui.transform
self.Parent = parent
XTool.InitUiObject(self)
self.DynamicTable = XDynamicTableNormal.New(self.PanelTaskWeeklyList)
self.DynamicTable:SetProxy(XDynamicDailyTask)
self.DynamicTable:SetDelegate(self)
end
function XUiPanelTaskWeekly:ShowPanel()
self.GameObject:SetActive(true)
self.WeeklyTasks = self:GetWeeklyTasks()
self.PanelNoneWeeklyTask.gameObject:SetActive(#self.WeeklyTasks <= 0)
self.DynamicTable:SetDataSource(self.WeeklyTasks)
self.DynamicTable:ReloadDataASync()
end
function XUiPanelTaskWeekly:HidePanel()
self.GameObject:SetActive(false)
end
function XUiPanelTaskWeekly:Refresh()
self.WeeklyTasks = self:GetWeeklyTasks()
self.PanelNoneWeeklyTask.gameObject:SetActive(#self.WeeklyTasks <= 0)
self.DynamicTable:SetDataSource(self.WeeklyTasks)
self.DynamicTable:ReloadDataSync()
end
--动态列表事件
function XUiPanelTaskWeekly:OnDynamicTableEvent(event, index, grid)
if event == DYNAMIC_DELEGATE_EVENT.DYNAMIC_GRID_ATINDEX then
local data = self.WeeklyTasks[index]
grid.RootUi = self.Parent
grid:ResetData(data)
end
end
function XUiPanelTaskWeekly:GetWeeklyTasks()
return XDataCenter.TaskManager.GetWeeklyTaskList()
end