local UISyncFourCountryWarMatchSuccessPanel = UIViewClass() local ConstMatchSuccessCountDown = DataSheetManager.ConstData:GetDataByID("TVTEnterTime").IntValue function UISyncFourCountryWarMatchSuccessPanel:OnOpened(context) local playerInfos = self:GetCountPlayerList(context) for i, v in ipairs(playerInfos) do for index, playerInfo in ipairs(v) do self:SetHeroInfoCell(self.group_Country[i].players[index], playerInfo) end UIUtils.SetActive(self.group_Country[i].img_OurSide, v[1].campId == self.myCampId) self:SetHeroCountry(i, self.group_Country[i].img_CountryIcon) end self._remainCountDown = ConstMatchSuccessCountDown self:StartRepeatFunc(self.OnUpdateFun, 1) self:OnUpdateFun() CTL.Sound.PlayGameSound("MUSIC_pvp_zhunbei") CTL.Sound.PlayGameSound("UI_buildarmy") end -- 设置武将国别 function UISyncFourCountryWarMatchSuccessPanel:SetHeroCountry(countryId, uiTemplate) local countryData = DataSheetManager.HeroCountry:GetDataByID(countryId) UTL.Item.SetAtlasSprite(uiTemplate.img_Country, "UI_Formation", countryData.Uipath) if uiTemplate.loc_Country.CurState == 0 then UTL.Item.SetLocalizationImage(nil, uiTemplate.img_Country2, string.format("zr_msz_%s.png", countryId)) else UTL.Item.SetLocalizationImage(nil, uiTemplate.img_Country3, string.format("zr_msz_%s.png", countryId)) end end function UISyncFourCountryWarMatchSuccessPanel:GetCountPlayerList(msg) local campPlayerList = {} for i, v in ipairs(msg.friendlyFighters) do campPlayerList[v.campId] = campPlayerList[v.campId] or {} table.insert(campPlayerList[v.campId], v) self.myCampId = v.campId end for i, v in ipairs(msg.enemyFighters) do campPlayerList[v.campId] = campPlayerList[v.campId] or {} table.insert(campPlayerList[v.campId], v) end return campPlayerList end function UISyncFourCountryWarMatchSuccessPanel:SetHeroInfoCell(cell, info) if info then CTL.Character.SetPortraitAndFrame(cell.UIHeroHead190, info.portraitId, info.frameId) --self:SetHeroImgById(cell.UIHeroHead190, info.portraitId, info.frameId) if BattleDataGetter.GetAcID() == info.acid then cell.lab_Name.text = UTL.Color.FormatGreenColor(info.name) else cell.lab_Name.text = info.name end cell.lab_Server.text = string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, info.serId) else UIUtils.SetActive(cell.gameObject, false) end end --匹配成功倒计时 function UISyncFourCountryWarMatchSuccessPanel:OnUpdateFun(deltaTime, timeSinceUpdate) -- body if self._remainCountDown <= 0 then UIManager.CloseView(Const_UI_Lua.UIEnum.UISyncFourCountryWarMatchSuccessPanel) UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UISyncFourCountryWarSelectHeroPanel, { countryId = self.myCampId }, Const_UI_Lua.UIEnum.UISyncTeamPVPSelectHeroPanel) return end self.Lab_close.text = string.FormatByIdsId(Const_IDS.IDS_SyncFourCountry_MateSuccess, self._remainCountDown) CTL.Sound.PlayCountDown(self._remainCountDown) self._remainCountDown = self._remainCountDown - 1 end return UISyncFourCountryWarMatchSuccessPanel