local ScoreBossRewardGridCtrl = class("ScoreBossRewardGridCtrl", BaseCtrl)
ScoreBossRewardGridCtrl._mapNodeConfig = {
	imgBg1 = {},
	imgBg2 = {},
	TMPRanking = {sComponentName = "TMP_Text"},
	tcItem = {
		sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl",
		nCount = 3
	},
	btnItem = {sComponentName = "UIButton", nCount = 3}
}
ScoreBossRewardGridCtrl._mapEventConfig = {}
ScoreBossRewardGridCtrl._mapRedDotConfig = {}
function ScoreBossRewardGridCtrl:Awake()
end
function ScoreBossRewardGridCtrl:FadeIn()
end
function ScoreBossRewardGridCtrl:FadeOut()
end
function ScoreBossRewardGridCtrl:OnEnable()
end
function ScoreBossRewardGridCtrl:OnDisable()
end
function ScoreBossRewardGridCtrl:OnDestroy()
end
function ScoreBossRewardGridCtrl:OnRelease()
end
function ScoreBossRewardGridCtrl:Refresh(nIdx, nSelfIdx)
	local mapRewardCfgData = {}
	local nControlId = PlayerData.ScoreBoss.ControlId or 1
	local foreachItem = function(mapData)
		if mapData.SeasonId == nControlId then
			table.insert(mapRewardCfgData, mapData)
		end
	end
	ForEachTableLine(ConfigTable.Get("ScoreBossRank"), foreachItem)
	if mapRewardCfgData == nil or mapRewardCfgData[nIdx] == nil then
		return
	end
	local nRankingHigher = mapRewardCfgData[nIdx].RankLower
	local nRankLower = 0
	if nIdx ~= 1 and mapRewardCfgData[nIdx - 1] ~= nil then
		nRankLower = mapRewardCfgData[nIdx - 1].RankLower
	end
	self._mapNode.imgBg1:SetActive(nSelfIdx <= nRankingHigher and nSelfIdx > nRankLower)
	self._mapNode.imgBg2:SetActive(nSelfIdx > nRankingHigher or nSelfIdx <= nRankLower)
	if nIdx == 1 then
		NovaAPI.SetTMPText(self._mapNode.TMPRanking, orderedFormat(ConfigTable.GetUIText("ScoreBoss_Rank_Cur"), math.floor(nRankingHigher / 100)))
	elseif nIdx == PlayerData.ScoreBoss.maxRankCount then
		NovaAPI.SetTMPText(self._mapNode.TMPRanking, orderedFormat(ConfigTable.GetUIText("ScoreBoss_Rank_Lv_1"), math.floor(nRankLower / 100)))
	else
		NovaAPI.SetTMPText(self._mapNode.TMPRanking, orderedFormat(ConfigTable.GetUIText("ScoreBoss_Rank_Lv"), math.floor(nRankLower / 100), math.floor(nRankingHigher / 100)))
	end
	local indexBorder = PlayerData.ScoreBoss:GetRankBorderCount(nIdx)
	NovaAPI.SetTMPText(self._mapNode.TMPRankingCount, orderedFormat(ConfigTable.GetUIText("ScoreBoss_RankBorderScore"), indexBorder))
	for i = 1, 3 do
		if mapRewardCfgData[nIdx]["AwardItemTid" .. i] ~= nil and 0 < mapRewardCfgData[nIdx]["AwardItemNum" .. i] then
			self._mapNode.tcItem[i]:SetItem(mapRewardCfgData[nIdx]["AwardItemTid" .. i], nil, mapRewardCfgData[nIdx]["AwardItemNum" .. i], nil, false, false, false, true, false, false)
			self._mapNode.btnItem[i].onClick:RemoveAllListeners()
			self._mapNode.btnItem[i].onClick:AddListener(function()
				self:OnBtn_ClickItem(self._mapNode.btnItem[i], mapRewardCfgData[nIdx]["AwardItemTid" .. i])
			end)
		else
			self._mapNode.btnItem[i].gameObject:SetActive(false)
		end
	end
end
function ScoreBossRewardGridCtrl:OnBtn_ClickItem(btn, itemId)
	UTILS.ClickItemGridWithTips(itemId, btn.transform, true, true, false)
end
return ScoreBossRewardGridCtrl
