local UIBattleKillTitle = UIViewClass() local Duration = 3 --持续时间 local TweenScalTime = 2.5 local SetGrayTime = 0.3 --头像置灰时间 local FriendFrame = "3v3_txk_l" local EnemyFrame = "3v3_txk_h" --killInfo[name_left,heroId_left,name_right,heroId_right,isKillerEnemy] function UIBattleKillTitle:OnOpened(killInfo) if BattleDataGetter.IsSyncTeamPVP() then self.Container:SetAnchoredPosition(520, -37) else self.Container:SetAnchoredPosition(125, -375) end if self.loc_State.CurState == 0 then UIUtils.SetLocalizationImage(self.img_Txt, "3v3_msz_js.png") end self:RegistSystemEvent(EventID.UIBattle_KillTitle_StartShow, self.StartShow) self.killInfoList = {} self:StartShow(killInfo) self:StartRepeatFunc(self.OnUpdateFun, SetGrayTime) CTL.Sound.PlayGameSound("UI_jibai") self.isPlaying = true self:ShowInfo() end function UIBattleKillTitle:StartShow(killInfo) table.insert(self.killInfoList, killInfo) end function UIBattleKillTitle:ShowInfo() local killInfo = table.remove(self.killInfoList, 1) if killInfo == nil then self:CloseView() else if self.MovingSlash then self:StopUIAnimation(self.MovingSlash) end if self.ZoomingContainer then self:StopUIAnimation(self.ZoomingContainer) end self.hasTweenScale = false self.hasSetGray = false UTL.Item.ItemSquareIconByHeroId(killInfo.heroId_left, self.texture_left, nil, nil, killInfo.leftAwaken) UTL.Item.ItemSquareIconByHeroId(killInfo.heroId_right, self.texture_right, nil, nil, killInfo.rightAwaken) if killInfo.isKillerEnemy then --杀手是敌人,左边应该显示红色 UTL.Item.SetAtlasSprite(self.img_headleft, "UI_3V3", EnemyFrame) UTL.Item.SetAtlasSprite(self.img_headright, "UI_3V3", FriendFrame) else UTL.Item.SetAtlasSprite(self.img_headleft, "UI_3V3", FriendFrame) UTL.Item.SetAtlasSprite(self.img_headright, "UI_3V3", EnemyFrame) end self.lab_left.text = killInfo.name_left self.lab_right.text = killInfo.name_right UIUtils.SetGray(self.texture_right, false) if self.MovingSlash then self:PlayUIAnimation(self.MovingSlash) else self.MovingSlash = self:PlayUIAnimation("BattleKill_img_Kill") end end end function UIBattleKillTitle:OnUpdateFun(deltaTime, timeSinceUpdate) if self.isPlaying == false then self.isPlaying = true self:ShowInfo() else if timeSinceUpdate >= Duration then self.isPlaying = false self:ResetRepeatFunc(self.OnUpdateFun) elseif (self.hasTweenScale == false and timeSinceUpdate >= TweenScalTime) then self.hasTweenScale = true if self.ZoomingContainer then self:PlayUIAnimation(self.ZoomingContainer) else self.ZoomingContainer = self:PlayUIAnimation("BattleKillZoom") end elseif (self.hasSetGray == false and timeSinceUpdate >= SetGrayTime) then self.hasSetGray = true UIUtils.SetGray(self.texture_right, true) end end end return UIBattleKillTitle