2023-07-14 19:35:33 +00:00
|
|
|
local XUiArenaActivityResult = XLuaUiManager.Register(XLuaUi, "UiArenaActivityResult")
|
|
|
|
|
|
|
|
function XUiArenaActivityResult:OnAwake()
|
|
|
|
self:AutoAddListener()
|
|
|
|
end
|
|
|
|
|
|
|
|
function XUiArenaActivityResult:OnStart(data, callBack, closeCb)
|
|
|
|
self.GridCommon.gameObject:SetActive(false)
|
|
|
|
|
|
|
|
self.DynamicTable = XDynamicTableNormal.New(self.SViewReward.transform)
|
|
|
|
self.DynamicTable:SetProxy(XUiGridCommon)
|
|
|
|
self.DynamicTable:SetDelegate(self)
|
|
|
|
|
|
|
|
self.Data = data
|
|
|
|
self.CallBack = callBack
|
|
|
|
self.CloseCb = closeCb
|
|
|
|
|
2024-09-01 20:49:41 +00:00
|
|
|
self:Refresh()
|
2023-07-14 19:35:33 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function XUiArenaActivityResult:AutoAddListener()
|
|
|
|
self:RegisterClickEvent(self.BtnBg, self.OnBtnBgClick)
|
|
|
|
self:RegisterClickEvent(self.BtnRanking, self.OnBtnRankingClick)
|
|
|
|
end
|
|
|
|
|
|
|
|
function XUiArenaActivityResult:OnBtnBgClick()
|
|
|
|
self:Close()
|
|
|
|
if self.CloseCb then
|
|
|
|
self.CloseCb()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function XUiArenaActivityResult:OnBtnRankingClick()
|
2024-09-01 20:49:41 +00:00
|
|
|
XDataCenter.ArenaManager.ScoreQueryReq(function()
|
|
|
|
self:Close()
|
|
|
|
XLuaUiManager.Open("UiArenaRank")
|
|
|
|
end)
|
2023-07-14 19:35:33 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function XUiArenaActivityResult:Refresh()
|
|
|
|
if not self.Data then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
local arenaLevelCfg = XArenaConfigs.GetArenaLevelCfgByLevel(self.Data.NewArenaLevel)
|
|
|
|
local str
|
|
|
|
|
|
|
|
--降级保护
|
|
|
|
if self.Data.IsProtected then
|
|
|
|
str = CS.XTextManager.GetText("ArenaActivityProtected", arenaLevelCfg.Name)
|
|
|
|
else
|
|
|
|
if self.Data.OldArenaLevel < self.Data.NewArenaLevel then
|
|
|
|
str = CS.XTextManager.GetText("ArenaActivityResultUp", arenaLevelCfg.Name)
|
|
|
|
elseif self.Data.OldArenaLevel == self.Data.NewArenaLevel then
|
|
|
|
str = CS.XTextManager.GetText("ArenaActivityResultKeep", arenaLevelCfg.Name)
|
2024-09-01 20:49:41 +00:00
|
|
|
-- 英雄小队
|
|
|
|
local challengeCfg = XArenaConfigs.GetChallengeArenaCfgById(self.Data.ChallengeId)
|
|
|
|
if challengeCfg.ArenaLv == XArenaConfigs.ArenaHeroLv and challengeCfg.DanUpRankCostContributeScore > 0 and self.Data.GroupRank <= challengeCfg.DanUpRank then
|
|
|
|
str = XUiHelper.GetText("ArenaActivityResultNotContributeScore", challengeCfg.DanUpRankCostContributeScore, arenaLevelCfg.Name)
|
|
|
|
end
|
2023-07-14 19:35:33 +00:00
|
|
|
else
|
|
|
|
str = CS.XTextManager.GetText("ArenaActivityResultDown", arenaLevelCfg.Name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
self.RewardGoodsList = self:RewardGoodsList()
|
|
|
|
|
|
|
|
self.TxtInfo.text = str
|
|
|
|
self.RImgArenaLevel:SetRawImage(arenaLevelCfg.Icon)
|
|
|
|
self.DynamicTable:SetDataSource(self.RewardGoodsList)
|
|
|
|
self.DynamicTable:ReloadDataASync()
|
|
|
|
|
|
|
|
if self.CallBack then
|
|
|
|
self.CallBack()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function XUiArenaActivityResult:OnDynamicTableEvent(event, index, grid)
|
|
|
|
if event == DYNAMIC_DELEGATE_EVENT.DYNAMIC_GRID_ATINDEX then
|
|
|
|
local data = self.RewardGoodsList[index]
|
|
|
|
grid.RootUi = self
|
|
|
|
grid:Refresh(data)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function XUiArenaActivityResult:RewardGoodsList()
|
|
|
|
local list = {}
|
|
|
|
for i,v in ipairs(self.Data.RewardGoodsList) do
|
|
|
|
table.insert(list, v)
|
|
|
|
end
|
|
|
|
|
|
|
|
local challengeCfg = XArenaConfigs.GetChallengeArenaCfgById(self.Data.ChallengeId)
|
2024-09-01 20:49:41 +00:00
|
|
|
local point = self.Data.Point or 0
|
2023-07-14 19:35:33 +00:00
|
|
|
local contributeScore = XDataCenter.ArenaManager.GetContributeScoreByCfg(self.Data.GroupRank, challengeCfg, point)
|
|
|
|
|
|
|
|
--显示战区贡献积分
|
|
|
|
if contributeScore then
|
|
|
|
table.insert(list, {
|
|
|
|
TemplateId = XArenaConfigs.CONTRIBUTESCORE_ID,
|
|
|
|
Count = contributeScore,
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
return list
|
|
|
|
end
|