local UIThreeTeamFightBattleOver = UIViewClass() local WINIMAGEPATH = "UI_PVP/1v1_msz_sl.png" local FAILEDIMAGEPATH = "UI_PVP/1v1_msz_sb.png" local WINCOINPATH = "1v1_msz_s.png" local FAILDEDCOINPATH = "1v1_msz_b.png" local TIME_VALUE = 3 local TIME_DURATION = 5 function UIThreeTeamFightBattleOver:OnOpened(context) self.txt_NameEnemy.text = BattleDataGetter.GetEnemyPlayerName() self.txt_NameOwn.text = BattleDataGetter.GetPlayerName() local result, myHeroInfoList, enemyHeroInfoList, myGsList, enemyGsList = BattleDataGetter.Get3TeamPKResult() self.myHeroInfoList = myHeroInfoList self.enemyHeroInfoList = enemyHeroInfoList self.myGsList = myGsList self.enemyGsList = enemyGsList local winNum = 0 for i, v in ipairs(result) do self.scroll_Team:AddData(v.isWin, 0) if v.isWin then winNum = winNum + 1 end end self.txt_Score.text = winNum .. ":" .. #result - winNum self.isWin = winNum >= 2 self.curTime = TIME_DURATION self.txt_ExitTime.text = nil self:SetWinExp(self.isWin) self:StartRepeatFunc(self.OnUpdateFun, TIME_VALUE) self.canClose = false end function UIThreeTeamFightBattleOver:OnUpdateFun() if self.canClose == false then self.canClose = true self:StopRepeatFunc(self.OnUpdateFun) self:StartRepeatFunc(self.OnUpdateFun, 1) end self.curTime = self.curTime - 1 self.txt_ExitTime.text = string.FormatByIdsId(Const_IDS.IDS_OfflineSoloFight_UIshowAfterBattles, self.curTime) if self.curTime <= 0 then self:CloseView() end end function UIThreeTeamFightBattleOver:SetWinExp(isWin) if isWin then CTL.Sound.PlayGameSound("MUSIC_Victory") if self.loc_Title.CurState == 0 then self.loc_Title:SetImage(0, WINIMAGEPATH, true) else self.loc_Title:SetText(0, UIUtils.GetLocalizedTxt(Const_IDS["IDS_GuildWar_Win"])) self.loc_Color:SetState(0) end self.state_Result:SetState(0) else CTL.Sound.PlayGameSound("MUSIC_Fail") if self.loc_Title.CurState == 0 then self.loc_Title:SetImage(0, FAILEDIMAGEPATH, true) else self.loc_Title:SetText(0, UIUtils.GetLocalizedTxt(Const_IDS["IDS_GuildWar_Lose"])) self.loc_Color:SetState(1) end self.state_Result:SetState(1) end end function UIThreeTeamFightBattleOver:OnClosed() MDL.Level.SendRoleLeaveFuben() end function UIThreeTeamFightBattleOver:OnButtonClicked(comp) if comp == self.img_Bottom and self.canClose then self:StopRepeatFunc(self.OnUpdateFun) self:CloseView() end end function UIThreeTeamFightBattleOver:OnCellInit(scrollRect, index, cellTable, data) local isWin = data self:SetCellWinExp(cellTable, isWin) cellTable.txt_Round.text = string.FormatByIdsId(Const_IDS.IDS_OfflineSoloFight_UIshowBattleTitle, index + 1) local myInfoArray local myGs if index == 0 then myInfoArray = self.myHeroInfoList.heroLineUpInfos1 myGs = self.myGsList[1] elseif index == 1 then myInfoArray = self.myHeroInfoList.heroLineUpInfos2 myGs = self.myGsList[2] elseif index == 2 then myInfoArray = self.myHeroInfoList.heroLineUpInfos3 myGs = self.myGsList[3] end cellTable.txt_CEOwn.text = myGs self:SetCellHeroArray(cellTable.group_TeamOwn, myInfoArray, true) local enemyInfoArray local enemyGs if index == 0 then enemyInfoArray = self.enemyHeroInfoList.heroLineUpInfos1 enemyGs = self.enemyGsList[1] elseif index == 1 then enemyInfoArray = self.enemyHeroInfoList.heroLineUpInfos2 enemyGs = self.enemyGsList[2] elseif index == 2 then enemyInfoArray = self.enemyHeroInfoList.heroLineUpInfos3 enemyGs = self.enemyGsList[3] end cellTable.txt_CEEnemy.text = enemyGs self:SetCellHeroArray(cellTable.group_TeamEnemy, enemyInfoArray, false) end function UIThreeTeamFightBattleOver:SetCellHeroArray(comps, fightInfos, isSelf) if fightInfos == nil then for i, v in ipairs(comps) do self:SetHeroItem(v.template_HeroMain, 0) self:SetHeroItem(v.template_HeroAssistant, 0) end else for i, v in ipairs(comps) do local info for _, val in ipairs(fightInfos) do if val.pos == (i-1) * 2 then info = val break end end if info then local mainAwaken, viceAwaken = BattleDataGetter.GetHeroIsAwaken(isSelf and BattleDataGetter.GetCurPlayerID() or LuaConst.STANDALONE_ENEMYPLAYER1_PLAYID, info.heroId) self:SetHeroItem(v.template_HeroMain, info.heroId, mainAwaken) self:SetHeroItem(v.template_HeroAssistant, info.ViceHeroId, viceAwaken) else self:SetHeroItem(v.template_HeroMain, 0) self:SetHeroItem(v.template_HeroAssistant, 0) end end end end function UIThreeTeamFightBattleOver:SetHeroItem(template, heroId, isAwaken) UIUtils.SetActive(template.group_Level, false) if heroId and heroId > 0 then UIUtils.SetActive(template.img_Empty, false) UIUtils.SetActive(template.img_HeroHead, true) UTL.Item.SetHeroIconByHeroId(template.img_HeroHead, heroId, isAwaken) else UIUtils.SetActive(template.img_Empty, true) UIUtils.SetActive(template.img_HeroHead, false) end end function UIThreeTeamFightBattleOver:SetCellWinExp(cellTable, isWin) if isWin then if cellTable.loc_icon.CurState == 0 then cellTable.loc_icon:SetImage(0, WINCOINPATH, true) else cellTable.loc_icon:SetText(0, UIUtils.GetLocalizedTxt(Const_IDS["IDS_GuildWar_Win"])) cellTable.loc_Color:SetState(0) end else if cellTable.loc_icon.CurState == 0 then cellTable.loc_icon:SetImage(0, FAILDEDCOINPATH, true) else cellTable.loc_icon:SetText(0, UIUtils.GetLocalizedTxt(Const_IDS["IDS_GuildWar_Lose"])) cellTable.loc_Color:SetState(1) end end end return UIThreeTeamFightBattleOver