local UISubjectMonthChallengeRank = UIViewClass() function UISubjectMonthChallengeRank:OnOpened(context) self:RegistSystemEvent(EventID.UI_SubjectMonth_UpdateRankInfo, self.RefreshRank) self:RegistSystemEvent(EventID.UI_SubjectMonth_SelectBoss, self.SelectBoss) self:SelectBoss(context.bossId) end function UISubjectMonthChallengeRank:SelectBoss(bossId) self.bossId = bossId MDL.SubjectMonth.GetSubjectMonthRankRecordReq(MDL.SubjectMonth.SubActivityType.BossChallenge, self.bossId) self:RefreshRank() end function UISubjectMonthChallengeRank:RefreshRank() local rankListInfo = MDL.SubjectMonth.GetRankListInfo(MDL.SubjectMonth.SubActivityType.BossChallenge, self.bossId) if rankListInfo then UIUtils.SetActive(self.obj_Rank, #rankListInfo == 0) self.loop_Rank:ReloadAll(rankListInfo) else UIUtils.SetActive(self.obj_Rank, true) end local myRankInfo = MDL.SubjectMonth.GetMyRankInfo(MDL.SubjectMonth.SubActivityType.BossChallenge, self.bossId) local score = MDL.MonthBossChallenge.GetScoreByBossId(self.bossId) UIUtils.SetLabel(self.myName, BattleDataGetter.GetPlayerName()) UIUtils.SetLabel(self.txt_ServerID, CTL.CrossServer.GetServerShowStr(tonumber(MDL.Login.GetServerShowId()))) UIUtils.SetLabel(self.txt_Score, score) if myRankInfo and myRankInfo.index ~= 0 then self.state_MyRank:SetState(0) UIUtils.SetLabel(self.txt_MyRank, myRankInfo.index) self.state_MyRankBg:SetState(myRankInfo.index <= 3 and myRankInfo.index - 1 or 3) else if score > 0 then self.state_MyRankBg:SetState(3) self.state_MyRank:SetState(0) UIUtils.SetLabelText(self.txt_MyRank, Const_IDS.IDS_HeroMatch1v1_NowResult5) else self.state_MyRank:SetState(1) UIUtils.SetLabelText(self.txt_NoRank, Const_IDS.IDS_FightThrone_None) end end end function UISubjectMonthChallengeRank:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.loop_Rank then UIUtils.SetLabel(cellTable.txt_Others, data.index) cellTable.state_Rank:SetState(data.index <= 3 and data.index - 1 or 3) UIUtils.SetLabel(cellTable.txt_PlayerName, data.name) UIUtils.SetLabel(cellTable.txt_ServerID, CTL.CrossServer.GetServerShowStr(data.serverId)) UIUtils.SetLabel(cellTable.txt_Score, data.param1) end end function UISubjectMonthChallengeRank:OnCellClicked(scrollRect, index, cellTable, data) if scrollRect == self.UICommonPopUpTab.loop_Tab then self:SelectBoss(data) end end return UISubjectMonthChallengeRank