PGRData/Script/matrix/xui/xuiguildwar/ranking/XUiGuildWarRankingList.lua

54 lines
1.7 KiB
Lua
Raw Normal View History

--
local XUiGuildWarRankingList = XClass(nil, "XUiGuildWarRankingList")
2024-09-01 22:49:41 +02:00
function XUiGuildWarRankingList:Ctor(uiPrefab,gridScript)
XTool.InitUiObjectByUi(self, uiPrefab)
2024-09-01 22:49:41 +02:00
self.GridScript = gridScript
self:InitDynamicTable()
self:InitMyRank()
end
function XUiGuildWarRankingList:InitDynamicTable()
2024-09-01 22:49:41 +02:00
self.DynamicTable = XDynamicTableNormal.New(self.PanelRankList.gameObject)
local gridProxy = self.GridScript
self.DynamicTable:SetProxy(gridProxy)
self.DynamicTable:SetDelegate(self)
end
function XUiGuildWarRankingList:InitMyRank()
2024-09-01 22:49:41 +02:00
self.MyRank = self.GridScript.New(self.PanelMy)
end
--================
--动态列表事件
--================
function XUiGuildWarRankingList:OnDynamicTableEvent(event, index, grid)
if event == DYNAMIC_DELEGATE_EVENT.DYNAMIC_GRID_ATINDEX then
if self.DataList and self.DataList[index] then
grid:RefreshData(self.DataList[index], self.RankTarget)
end
end
end
function XUiGuildWarRankingList:RefreshList(rankType, id, rankTarget)
XDataCenter.GuildWarManager.RequestRanking(rankType, id, function(rankList, myRank)
2024-09-01 22:49:41 +02:00
self:OnRankingDataResponse(rankList, myRank, rankTarget)
end)
end
function XUiGuildWarRankingList:OnRankingDataResponse(rankList, myRank, rankTarget)
self.DataList = rankList
self.RankTarget = rankTarget
self.DynamicTable:SetDataSource(self.DataList)
self.DynamicTable:ReloadDataASync(1)
local notEmpty = next(self.DataList)
self.PanelNoRank.gameObject:SetActiveEx(not notEmpty)
self.MyRank:RefreshData(myRank, self.RankTarget)
end
--============
--刷新排行榜名
--============
function XUiGuildWarRankingList:RefreshName(name)
self.TxtRankType.text = name
end
return XUiGuildWarRankingList