--- 国战晚间BOSS结算 和 八卦图boss信息界面 local UICountryNightBossSummary = UIViewClass() local SLASH_STR = "-" function UICountryNightBossSummary:OnOpened(context) self:RegistSystemEvent(EventID.UI_CountryNightBoss_UpdateBossResult, self.RefreshInfo) self.isBattleSummary = context.isBattleSummary or false self.bossData = DataSheetManager.CountryNightBoss:GetDataByID(context.bossID) -- 请求结算信息 if not self.isBattleSummary then MDL.CountryNightBoss.CountryBossBalanceInfoReq(context.bossID) end self.state_Flag:SetState(self.bossData.BossNation - 1) self:LoadBossModel() end function UICountryNightBossSummary:OnClosed() UTL.UIRender.DisposeModelComponentData(self.modelComponentDataHandle) end function UICountryNightBossSummary:LoadBossModel() UIUtils.SetLabelText(self.txt_PlayerName, Const_IDS[self.bossData.WordBossName]) self.modelComponentDataHandle = UTL.UIRender.CreateModelComponentDatas(self.renderModel) UTL.UIRender.CreateRTSceneTrans( self.modelComponentDataHandle, self.bossData.ModelLight ) -- 加载模型、武器、灯光 UTL.UIRender.CreateRTRenderModel( self.modelComponentDataHandle, self.bossData.BossShow, self.bossData.ModelScale, self.bossData.ShowEquipmentID, self.bossData.RenderID ) end -- {result.playerScoreRank 放大镜玩家伤害排行, result.myRank 我的伤害信息, result.DamageLimit 达标积分} function UICountryNightBossSummary:RefreshInfo(result) self.result = result -- 达标积分 -- 伤害国家排行 UIUtils.SetActive(self.img_TitleBg, self.isBattleSummary) if #result.finalScoreRank > 0 then self.loop_CountryRank:ReloadAll(result.finalScoreRank) else self.loop_CountryRank:ClearCells() for i = 1, 4 do self.loop_CountryRank:AddData(nil, 0) end end UIUtils.SetLabel(self.txt_DamageNum, not result.myRank and "-" or result.myRank.index) -- 刷新特殊数据 self:RefreshSpecialInfo(result.finalPlayerRank) end function UICountryNightBossSummary:RefreshSpecialInfo(specialInfoArr) for index, collection in ipairs(self.group_Player) do local info = specialInfoArr[index] if info and not string.isNilOrEmpty(info.acid) then UIUtils.SetLabel(collection.txt_Name, info.playerName) UIUtils.SetLabel(collection.txt_Server, CTL.CrossServer.GetServerShowStr(info.serverId)) CTL.Country.SetCountryInRank(collection.img_Country, collection.txt_Country, info.countryId) collection.state_Flag:SetState(0) else UIUtils.SetLabel(collection.txt_Country, "") UIUtils.SetLabel(collection.txt_Server, "") collection.state_Flag:SetState(1) end end end function UICountryNightBossSummary:OnCellInit(scrollRect, index, cellTable, data) if not data then CTL.Country.SetCountryInRank(cellTable.img_Country, cellTable.txt_Country, index + 1) UIUtils.SetLabel(cellTable.txt_Damage, "-") UIUtils.SetLabel(cellTable.txt_Integral, "-") else CTL.Country.SetCountryInRank(cellTable.img_Country, cellTable.txt_Country, data.countryId) -- 百分比伤害 local isLowerPercent = data.CountryDamage < self.result.DamageLimit local percentStr if data.totalDamage <= 0 then percentStr = SLASH_STR else local damageShow = UTL.String.GetPercentFormatFloat(data.totalDamage*100, 1, 2) percentStr = isLowerPercent and UTL.Color.FormatRedColor(damageShow) or damageShow end UIUtils.SetLabel(cellTable.txt_Damage, percentStr) -- 总积分 UIUtils.SetLabel(cellTable.txt_Integral, isLowerPercent and SLASH_STR or data.gainScore) -- 奖励显示 UIUtils.SetActive(cellTable.ItemContent.gameObject, not isLowerPercent) UIUtils.SetActive(cellTable.txt_Empty, isLowerPercent) if not isLowerPercent then for _, rewardData in ipairs(data.JoinPlayerReward) do local contentItem = self:InstantiateCellCollection(cellTable.cell.gameObject, cellTable.ItemContent, self.item_Template.gameObject) UIUtils.SetActive(contentItem.gameObject, true) UIUtils.SetActive(contentItem.img_All.gameObject, rewardData.IfAllMember ~= nil) contentItem.ItemID = rewardData.itemId UTL.Item.SetItemCell(contentItem.item, rewardData.itemId, rewardData.itemNum, false) end end end end function UICountryNightBossSummary:OnCellClicked(scrollRect, index, cellTable, target, data) for i, v in ipairs(cellTable.ItemContent) do if target == v.item.event_Click then UTL.ItemTips.ShowCommonTipsById(v.ItemID) end end end function UICountryNightBossSummary:OnBackButtonPressed() self:OnButtonClicked(self.btn_Close) end function UICountryNightBossSummary:OnButtonClicked(comp) if comp == self.btn_Close then if self.isBattleSummary then MDL.Level.SendRoleLeaveFuben() end self:CloseView() elseif comp == self.btn_Damage then UIManager.OpenView(Const_UI_Lua.UIEnum.UICountryNightBossDamageRank, { bossID = self.bossData.ID, playerRankToBoss = self.result.playerScoreRank, myRankData = self.result.myRank}) elseif comp == self.btn_Info then self:SetReminder(self.btn_Info, string.FormatByIdsId(Const_IDS["IDS_CountryNightBoss_TotalDamageTips"], MDL.CountryNightBoss.DamageCountryLimitFactor)) elseif comp == self.btn_TipsClose then UIUtils.SetActive(self.group_InfoNotice.gameObject, false) end end function UICountryNightBossSummary:SetReminder(comp, txt) UIUtils.SetActive(self.group_InfoNotice.gameObject, true) UIUtils.SetLabel(self.lab_Info, txt) self.group_InfoNotice.transform:SetPosition(comp.transform.position.x + 0.2, comp.transform.position.y - 0.05, 0) end return UICountryNightBossSummary