local UIOfficialPositionBattleResult = UIViewClass() function UIOfficialPositionBattleResult:OnOpened(context) UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS["IDS_OfficialPosition_BattleResult"]) if IsServerDataNotNil(context.pvpInfo) then self.isEmpty = false for _, v in ipairs(context.pvpInfo) do self.LoopScroll_Main_OfficialPositionBattleResult:AddData(v, 0) end else self.isEmpty = true self.LoopScroll_Main_OfficialPositionBattleResult:AddData(context, 0) end end function UIOfficialPositionBattleResult:OnCellInit(scrollRect, index, cellTable, data) local myInfo = self.context.PersonalInformation self:InitCell(cellTable.Part_01, myInfo) if self.isEmpty then cellTable.section_Result:SetState(1) cellTable.obj_state:SetState(1) if cellTable.loc_icon.CurState == 0 then UIUtils.SetLocalizationImage(cellTable.img_icon, "1v1_msz_s.png") else UIUtils.SetLabelText(cellTable.txt_result, Const_IDS.IDS_GuildWar_Win) end else if data.isSelfWin then cellTable.loc_Color:SetState(0) cellTable.section_Result:SetState(1) if cellTable.loc_icon.CurState == 0 then UIUtils.SetLocalizationImage(cellTable.img_icon, "1v1_msz_s.png") else UIUtils.SetLabelText(cellTable.txt_result, Const_IDS.IDS_GuildWar_Win) end else cellTable.loc_Color:SetState(1) cellTable.section_Result:SetState(0) if cellTable.loc_icon.CurState == 0 then UIUtils.SetLocalizationImage(cellTable.img_icon, "1v1_msz_b.png") else UIUtils.SetLabelText(cellTable.txt_result, Const_IDS.IDS_GuildWar_Lose) end end cellTable.obj_state:SetState(0) self:InitCell(cellTable.Part_02, data.enemyInfo) end end function UIOfficialPositionBattleResult:InitCell(comp, memberInfo) if memberInfo.acid == BattleDataGetter.GetAcID() then UIUtils.SetLabel(comp.txt_Name, UTL.Color.FormatGreenColor(memberInfo.name)) else UIUtils.SetLabel(comp.txt_Name, memberInfo.name) end UIUtils.SetLabel(comp.txt_CE, memberInfo.power) CTL.Character.SetPortraitAndFrame(comp.UIHeroHead150, memberInfo.portraitId, memberInfo.frameId, memberInfo.level) end function UIOfficialPositionBattleResult:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIOfficialPositionBattleResult:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() end end return UIOfficialPositionBattleResult