local UIBattlePlayerHeadPin = require("View/Battle/UIBattlePlayerHeadPin") local UIBattlePlayerHeadPinGuildWar = UIViewClass(UIBattlePlayerHeadPin) function UIBattlePlayerHeadPinGuildWar:OnOpened() -- 势力战使用复活计时回调,不需要在OnHeroSwitch后更新计时 self.enableReviveTimerUpdate = false self:RegistSystemEvent(EventID.UI_GuildWarSelfDead, self.OnGuildWarHeroDead) self:RegistSystemEvent(EventID.GuildWar_HeroRevive, self.OnGuildWarHeroRevive) end function UIBattlePlayerHeadPinGuildWar:OnGuildWarHeroDead(info) local heroIDs = info.heroIDs local times = info.time local totalTimes = info.totalTime local guildWarHeadInfo = {} for index, heroID in ipairs(heroIDs) do guildWarHeadInfo[heroID] = { heroID = heroID, reviveTime = self:GetTime(times[index]), reviveTotalTime = totalTimes[index] } end self.headInfoDic = guildWarHeadInfo logging.log(LTAG.LOG, "OnGuildWarHeroDead-----------------") self:SetDeadHead(guildWarHeadInfo) end -- 势力战的死亡事件使用的旧接口,数据结构与现在的单将复活结构不同。 -- 所以单独处理了死亡复活的headInfo function UIBattlePlayerHeadPinGuildWar:SetDeadHead(headDicInfo) for index, heroId in ipairs(self.headOrder) do self:UpdateHeroShow(headDicInfo[heroId], index) end end function UIBattlePlayerHeadPinGuildWar:OnGuildWarHeroRevive(entity) if entity:GetPlayerID() == self.context.playerID then for index, heroId in ipairs(self.headOrder) do if heroId == entity._logicInitData.CharacterID then self:PlayReviveEffect(index) self:SetHeroRevive(heroId, index) end end end end function UIBattlePlayerHeadPinGuildWar:PlayReviveEffect(index) self.group_Info[index].effect_Reborn:PlayUIEffect() end function UIBattlePlayerHeadPinGuildWar:SetHeroRevive(heroId, index) self.group_Info[index].effect_Reborn:PlayUIEffect() UTL.Item.SetHeroIconByHeroId(self.headImg_Group[index].texture_Head, heroId, BattleDataGetter.GetHeroIsAwaken(self.context.playerID, heroId)) UIUtils.SetGray(self.headImg_Group[index].texture_Head, false) UIUtils.SetActive(self.headImg_Group[index].black_Bg, false) self.group_Info[index].txt_Number:EndTimer() end function UIBattlePlayerHeadPinGuildWar:UpdateHeroShow(info, index) if not info then return end UTL.Item.SetHeroIconByHeroId(self.headImg_Group[index].texture_Head, info.heroID, BattleDataGetter.GetHeroIsAwaken(self.context.playerID, info.heroID)) UIUtils.SetGray(self.headImg_Group[index].texture_Head, self:IsHeroInCD(info)) UIUtils.SetActive(self.headImg_Group[index].black_Bg, index ~= 1 and not self:IsHeroInCD(info)) local countDownObj = self.group_Info[index] if info.reviveTime and info.reviveTime > 0 then countDownObj.txt_Number:ResetAndBeginTimer(false,math.ceil(info.reviveTime),math.ceil(info.reviveTotalTime)) else countDownObj.txt_Number:EndTimer() end end function UIBattlePlayerHeadPinGuildWar:GetTime( value) if value then return (value - LogicUpdateManager._clientHandleFrame) * LuaConst.TimeSpan end end return UIBattlePlayerHeadPinGuildWar