local UITeamFairChampionshipReward = UIViewClass() local TypeTab = { ChampionReward = 1, --冠军奖励 FinalsReward = 2, --决赛奖励(冠军 亚军 4强) AdvanceReward_1 = 3, --晋级赛奖励(8强 16强) GroupReward = 4, --小组赛奖励 GuessReward = 5, --竞猜奖励 } local rewardsTabData = { Const_IDS.IDS_FairTournament_ReWardPreTitle1, Const_IDS.IDS_FairTournament_ReWardPreTitle2, Const_IDS.IDS_FairTournament_ReWardPreTitle3, Const_IDS.IDS_FairTournament_ReWardPreTitle4, Const_IDS.IDS_FairTournament_ReWardPreTitle5 } function UITeamFairChampionshipReward:OnCreated() self.lightEffectId1 = nil -- 冠军奖励 self.lightEffectId2 = nil -- 亚军奖励 end function UITeamFairChampionshipReward:OnOpened(context) for i, v in ipairs(rewardsTabData) do self.loop_LeftRewardTab:AddData(v, 0) end self.clickItemDict = {} self.loop_LeftRewardTab:SelectIndex(0) self:SetMyRank() end function UITeamFairChampionshipReward:ShowHideTips(isShow) UIUtils.SetActive(self.group_RewardInfo, isShow) UIUtils.SetActive(self.btn_TipClose, isShow) end function UITeamFairChampionshipReward:OnButtonClicked(comp) if comp == self.btn_Close then self:CloseView() elseif comp == self.btn_PointReward then UIManager.OpenView(Const_UI_Lua.UIEnum.UITeamFairChampionshipStore, nil, Const_UI_Lua.UIEnum.UIFairSoloTournamentStore) elseif comp == self.group_High.btn_Info_Appearance1 then CTL.ItemSources.ExecuteSourceFunctionById(MDL.ItemSources.SourceType.HeroLightEffect, self.lightEffectId1) elseif comp == self.group_Low.btn_Info_Appearance2 then CTL.ItemSources.ExecuteSourceFunctionById(MDL.ItemSources.SourceType.HeroLightEffect, self.lightEffectId2) elseif comp == self.btn_TipClose then self:ShowHideTips(false) elseif comp == self.btn_Info then self:ShowHideTips(true) end end function UITeamFairChampionshipReward:OnCellSelect(scrollRect, index, cellTable, data) UIUtils.SetActive(self.group_Self, true) if scrollRect == self.loop_LeftRewardTab then local tabIndex = index + 1 self.curTabIndex = tabIndex if tabIndex == TypeTab.ChampionReward then UIUtils.SetActive(self.group_Reward01, true) UIUtils.SetActive(self.group_Reward02, false) UIUtils.SetActive(self.group_Reward03, false) UIUtils.SetActive(self.group_Reward04, false) UIUtils.SetActive(self.group_Reward05, false) UIUtils.SetActive(self.group_RewardInfo, false) UIUtils.SetActive(self.group_Self, false) if not self.lightEffectId1 then local rewardList = DataSheetManager.TeamFairMatchStageRankReward:GetDataByID(MDL.TeamFairChampionship.Stage.match_2T1).RankRewardShowID local rewardArray = DataSheetManager.FairTournamentRewardRepeat:GetDataByAttrRepeatID(rewardList[1]).Item_Table for __, reawadItem in ipairs(rewardArray) do local itemCfgData = DataSheetManager.ItemData:GetDataByID(reawadItem.ItemID) if itemCfgData.SecondType == LuaConst.ItemType.HeroEffect then if not self.lightEffectId1 then self.lightEffectId1 = reawadItem.ItemID UTL.Item.ItemIconByName(self.group_High.img_Show, "hrtx_icon_gjmy01big") UIUtils.SetLabelText(self.group_High.lab_High, Const_IDS[itemCfgData.Name]) else self.lightEffectId2 = reawadItem.ItemID UTL.Item.ItemIconByName(self.group_Low.img_Show, "hrtx_icon_hysr01big") UIUtils.SetLabelText(self.group_Low.lab_Low, Const_IDS[itemCfgData.Name]) end end end end elseif tabIndex == TypeTab.FinalsReward then self:InitFinalsReward() elseif tabIndex == TypeTab.AdvanceReward_1 then self:InitFAdvanceReward() elseif tabIndex == TypeTab.GroupReward then self:InitGroupRewardReward() elseif tabIndex == TypeTab.GuessReward then UIUtils.SetActive(self.group_Reward01, false) UIUtils.SetActive(self.group_Reward02, false) UIUtils.SetActive(self.group_Reward03, true) UIUtils.SetActive(self.group_Reward04, false) UIUtils.SetActive(self.group_Reward05, false) UIUtils.SetActive(self.group_RewardInfo, false) UIUtils.SetActive(self.group_Self, false) end end end function UITeamFairChampionshipReward:InitFinalsReward() UIUtils.SetActive(self.group_Reward01, false) UIUtils.SetActive(self.group_Reward02, true) UIUtils.SetActive(self.group_Reward03, false) UIUtils.SetActive(self.group_Reward04, false) UIUtils.SetActive(self.group_Reward05, false) UIUtils.SetActive(self.group_RewardInfo, false) self.loop_FTReward:ClearCells() for i, v in DataSheetManager.TeamFairMatchStageRankReward:GetEnumerator() do if v.ID <= 1600 and v.ID >= 1500 then self.loop_FTReward:AddData(v.RankRewardShowID[1], 0) if v.ID == 1500 then self.loop_FTReward:AddData(v.RankRewardShowID[2], 0) end end end end function UITeamFairChampionshipReward:InitFAdvanceReward() UIUtils.SetActive(self.group_Reward01, false) UIUtils.SetActive(self.group_Reward02, false) UIUtils.SetActive(self.group_Reward03, false) UIUtils.SetActive(self.group_Reward04, true) UIUtils.SetActive(self.group_Reward05, false) UIUtils.SetActive(self.group_RewardInfo, false) self.loop_RankReward:ClearCells() for i, v in DataSheetManager.TeamFairMatchStageRankReward:GetEnumerator() do if v.ID >= 1700 then self.loop_RankReward:AddData(v.RankRewardShowID[1], 0) end end end function UITeamFairChampionshipReward:InitGroupRewardReward() UIUtils.SetActive(self.group_Reward01, false) UIUtils.SetActive(self.group_Reward02, false) UIUtils.SetActive(self.group_Reward03, false) UIUtils.SetActive(self.group_Reward04, false) UIUtils.SetActive(self.group_Reward05, true) UIUtils.SetActive(self.group_RewardInfo, false) self.loop_ScreenReward:ClearCells() local rewardList = DataSheetManager.TeamFairMatchStageRankReward:GetDataByID(1300).RankRewardShowID local groupReward = DataSheetManager.ConstData:GetDataByID("TeamFairTournamentJoinReward").IntValue self.loop_ScreenReward:AddData(groupReward, 0) for i, v in ipairs(rewardList) do self.loop_ScreenReward:AddData(v, 0) end end function UITeamFairChampionshipReward:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.loop_LeftRewardTab then UIUtils.SetLabelText(cellTable.txt_SelectedTabName, data) UIUtils.SetLabelText(cellTable.txt_UnselectedTabName, data) else local rewardArray = DataSheetManager.FairTournamentRewardRepeat:GetDataByAttrRepeatID(data).Item_Table for i, v in ipairs(rewardArray) do local item = cellTable.ItemContent[i] if item == nil then item = self:InstantiateCellCollection(cellTable.cell.gameObject, cellTable.ItemContent, self.item.gameObject) end UIUtils.SetActive(item.gameObject, true) UTL.Item.SetItemCell(item, v.ItemID, v.ItemNum) self.clickItemDict[item.event_Click] = v.ItemID end for i = #rewardArray + 1, #cellTable.ItemContent do local item = cellTable.ItemContent[i] UIUtils.SetActive(item.gameObject, false) end self:OnCellInitText(scrollRect, index, cellTable, data) end end function UITeamFairChampionshipReward:OnCellInitText(scrollRect, index, cellTable, data) if self.curTabIndex == TypeTab.ChampionReward then UIUtils.SetActive(self.group_Reward01, true) UIUtils.SetActive(self.group_Reward02, false) UIUtils.SetActive(self.group_Reward03, false) UIUtils.SetActive(self.group_Reward04, false) UIUtils.SetActive(self.group_Reward05, false) UIUtils.SetActive(self.group_RewardInfo, false) elseif self.curTabIndex == TypeTab.FinalsReward then local ConfigStage = MDL.TeamFairChampionship.Stage if index == 0 then cellTable.UIState_Rank:SetState(0) UIUtils.SetLabelText(cellTable.txt_Rank01, Const_IDS["IDS_FairTournament_FinalFirst"]) self:ShowMyRankFlag(cellTable, ConfigStage.ShowHero) elseif index == 1 then cellTable.UIState_Rank:SetState(1) UIUtils.SetLabelText(cellTable.txt_Rank02, Const_IDS["IDS_FairTournament_FinalSecond"]) self:ShowMyRankFlag(cellTable, ConfigStage.match_2T1) elseif index == 2 then cellTable.UIState_Rank:SetState(2) UIUtils.SetLabel(cellTable.txt_Rank, string.FormatByIdsId(Const_IDS.IDS_HeroMatch1v1_NowResult2, 4)) self:ShowMyRankFlag(cellTable, ConfigStage.match_4T2) elseif index == 3 then cellTable.UIState_Rank:SetState(2) UIUtils.SetLabel(cellTable.txt_Rank, string.FormatByIdsId(Const_IDS.IDS_HeroMatch1v1_NowResult2, 8)) end elseif self.curTabIndex == TypeTab.AdvanceReward_1 then local ConfigStage = MDL.TeamFairChampionship.Stage if index == 0 then UIUtils.SetLabel(cellTable.txt_Rank, string.FormatByIdsId(Const_IDS.IDS_HeroMatch1v1_NowResult2, 8)) self:ShowMyRankFlag(cellTable, ConfigStage.match_8T4) elseif index == 1 then UIUtils.SetLabel(cellTable.txt_Rank, string.FormatByIdsId(Const_IDS.IDS_HeroMatch1v1_NowResult2, 16)) self:ShowMyRankFlag(cellTable, ConfigStage.match_16T8) elseif index == 2 then UIUtils.SetLabel(cellTable.txt_Rank, string.FormatByIdsId(Const_IDS.IDS_HeroMatch1v1_NowResult2, 32)) self:ShowMyRankFlag(cellTable, ConfigStage.match_32T16) elseif index == 3 then UIUtils.SetLabel(cellTable.txt_Rank, string.FormatByIdsId(Const_IDS.IDS_HeroMatch1v1_NowResult2, 64)) self:ShowMyRankFlag(cellTable, ConfigStage.match_64T32) end elseif self.curTabIndex == TypeTab.GroupReward then if index == 0 then UIUtils.SetLabelText(cellTable.txt_Rank, Const_IDS.IDS_HeroMatch1v1_JoinReward) else cellTable.txt_Rank.text = string.FormatByIdsId(Const_IDS.IDS_FairTournament_RaceOneRank1, index) local bestRank = MDL.TeamFairChampionship.GetMyFilterGroupRank() UIUtils.SetActive(cellTable.group_Now, bestRank == index) end end end function UITeamFairChampionshipReward:OnCellClicked(scrollRect, index, cellTable, target, data) if target and self.clickItemDict[target] then UTL.ItemTips.ShowCommonTipsById(self.clickItemDict[target]) end end function UITeamFairChampionshipReward:SetMyRank() -- 设置我的排名 local myRankDesc = CTL.TeamFairChampionship.GetMyRankDesc() if myRankDesc then if MDL.TeamFairChampionship.GetMyFilterGroupId()>0 then self.txt_Rank.text = UIUtils.GetLocalizedTxt(Const_IDS.IDS_Chat_BestRank) .. myRankDesc else self.txt_Rank.text = UIUtils.GetLocalizedTxt(Const_IDS.IDS_Chat_BestRank) .. myRankDesc end else self.txt_Rank.text = UIUtils.GetLocalizedTxt(Const_IDS.IDS_Chat_BestRank) .. UIUtils.GetLocalizedTxt(Const_IDS.IDS_FairTournament_NoRaceRank) end end function UITeamFairChampionshipReward:ShowMyRankFlag(cellTable, configStage) local bestStage = MDL.TeamFairChampionship.GetMyHighestStage() if configStage == bestStage then UIUtils.SetActive(cellTable.group_Now, true) else UIUtils.SetActive(cellTable.group_Now, false) end end return UITeamFairChampionshipReward