local UIThreeTeamFightMsg = UIViewClass() function UIThreeTeamFightMsg:OnOpened(context) self:RegistSystemEvent(EventID.FunctionUnlockUpdate, self.CheckIfFuncUnlock) -- GMS self:RegistSystemEvent(EventID.UI_ThreeTeamFight_OnSeasonFinish, self.OnSeasonFinish) -- GMS self:Init(context) end function UIThreeTeamFightMsg:Init(context) UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS["IDS_OfflineSoloFight_Event"]) if context and #context > 0 then CTL.ThreeTeamFight.SaveEventTime(context[1].occurTime) UIUtils.SetActive(self.group_UnSoloFightMsg, false) UIUtils.SetActive(self.view_StageSelect, true) self:Refresh(context) else UIUtils.SetActive(self.group_UnSoloFightMsg, true) UIUtils.SetActive(self.view_StageSelect, false) end end function UIThreeTeamFightMsg:Refresh(list) for i, v in ipairs(list) do self.view_StageSelect:AddData(v, 0) end end function UIThreeTeamFightMsg:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIThreeTeamFightMsg:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() end end function UIThreeTeamFightMsg:OnCellInit(scrollRect, index, cellTable, data) local portraitId local level local frameId local guildName = data.headInfo.guildName local playerName = data.name if data.eventType == MDL.SoloFight.EventType.Self_Fight_Other then --我是挑战者,势力名应该用防守方的 guildName = data.defendGuildName if string.isNilOrEmpty(guildName) then cellTable.lab_Msg01.text = string.FormatByIdsId(Const_IDS.IDS_3TeamsPK_Win4, playerName) else cellTable.lab_Msg01.text = string.FormatByIdsId(Const_IDS.IDS_3TeamsPK_Win3, guildName, playerName) end if data.idxDelta == 0 then UIUtils.SetLabelText(cellTable.lab_Msg02, Const_IDS.IDS_3TeamsPK_NoChange) UIUtils.SetActive(cellTable.arrowUp, false) else cellTable.lab_Msg02.text = string.FormatByIdsId(Const_IDS.IDS_3TeamsPK_Up, CTL.ThreeTeamFight.GetRankDesc(data.idxDelta, true, true)) UIUtils.SetActive(cellTable.arrowUp, true) end portraitId = MDL.Character.GetCurWearPortrait() frameId = MDL.Character.GetCurWearFrame() level = MDL.Player.GetRoleLevel() UIUtils.SetActive(cellTable.arrowDown, false) UIUtils.SetActive(cellTable.btn_Challenge, false) elseif data.eventType == MDL.SoloFight.EventType.Other_Fight_Self then if string.isNilOrEmpty(guildName) then cellTable.lab_Msg01.text = string.FormatByIdsId(Const_IDS.IDS_3TeamsPK_Win2, playerName) else cellTable.lab_Msg01.text = string.FormatByIdsId(Const_IDS.IDS_3TeamsPK_Win1, guildName, playerName) end if data.idxDelta == 0 then UIUtils.SetLabelText(cellTable.lab_Msg02, Const_IDS.IDS_3TeamsPK_NoChange) UIUtils.SetActive(cellTable.arrowDown, false) else local rankDesc = CTL.ThreeTeamFight.GetRankDesc(data.idxDelta, true, true) if rankDesc then cellTable.lab_Msg02.text = string.FormatByIdsId(Const_IDS.IDS_3TeamsPK_Down, rankDesc) else cellTable.lab_Msg02.text = string.FormatByIdsId(Const_IDS.IDS_3TeamsPK_Down, UIUtils.GetLocalizedTxt(Const_IDS.IDS_Rank_Unranked)) end UIUtils.SetActive(cellTable.arrowDown, true) end portraitId = data.headInfo.PortraitId frameId = data.headInfo.FrameId level = data.headInfo.level UIUtils.SetActive(cellTable.arrowUp, false) UIUtils.SetActive(cellTable.btn_Challenge, false) elseif data.eventType == MDL.SoloFight.EventType.Self_Fight_Other_Fail then --我是挑战者,势力名应该用防守方的 guildName = data.defendGuildName if string.isNilOrEmpty(guildName) then cellTable.lab_Msg01.text = string.FormatByIdsId(Const_IDS.IDS_3TeamsPK_Lose4, playerName) else cellTable.lab_Msg01.text = string.FormatByIdsId(Const_IDS.IDS_3TeamsPK_Lose3, guildName, playerName) end UIUtils.SetLabelText(cellTable.lab_Msg02, Const_IDS.IDS_3TeamsPK_NoChange) portraitId = MDL.Character.GetCurWearPortrait() frameId = MDL.Character.GetCurWearFrame() level = MDL.Player.GetRoleLevel() UIUtils.SetActive(cellTable.arrowUp, false) UIUtils.SetActive(cellTable.arrowDown, false) UIUtils.SetActive(cellTable.btn_Challenge, false) elseif data.eventType == MDL.SoloFight.EventType.Other_Fight_Self_Fail then if string.isNilOrEmpty(guildName) then cellTable.lab_Msg01.text = string.FormatByIdsId(Const_IDS.IDS_3TeamsPK_Lose2, playerName) else cellTable.lab_Msg01.text = string.FormatByIdsId(Const_IDS.IDS_3TeamsPK_Lose1, guildName, playerName) end UIUtils.SetLabelText(cellTable.lab_Msg02, Const_IDS.IDS_3TeamsPK_NoChange) portraitId = data.headInfo.PortraitId frameId = data.headInfo.FrameId level = data.headInfo.level UIUtils.SetActive(cellTable.arrowUp, false) UIUtils.SetActive(cellTable.arrowDown, false) UIUtils.SetActive(cellTable.btn_Challenge, false) end CTL.Character.SetPortraitAndFrame(cellTable.UIHeroHead190, portraitId, frameId, level) cellTable.lab_Time.text = os.date(UTL.Time.FormatDateEnum.MDHMS, data.occurTime) end function UIThreeTeamFightMsg:CheckIfFuncUnlock(funcId, isUnlock) if funcId and funcId == MDL.Unlock.FunctionType.ThreeTeamFight then self:OnButtonClicked(self.UITemplateTitlePanel.btn_close) end end function UIThreeTeamFightMsg:OnSeasonFinish() self:OnButtonClicked(self.UITemplateTitlePanel.btn_close) end return UIThreeTeamFightMsg