local Base = require("Battle/Logic/Level/LevelFunction/LevelFunction") local StormChallengeLevelFunction = class("StormChallengeLevelFunction",Base) local EventSystem = require('Event/EventSystem') function StormChallengeLevelFunction:InitLevel() self.stormScore = 0 -- 积分 LevelPlayerManager.SetCanSwitchHeroByCommand(false) --禁止手动切将(为了保险加上了这句代码) Base.InitLevel(self) self.dontIgnoreEnemy = true --不使用忽略敌人机制,节省性能 EventSystem.Regist(EventID.UIBattle_Mission_CompleteAim, self.MissionCompleted, self) end -- 怪物死亡计算积分 function StormChallengeLevelFunction:MonsterDeadCountStatisticAdd(monsterID, entity) Base.MonsterDeadCountStatisticAdd(self, monsterID, entity) if not self.stormScorePauseFrame or LogicUpdateManager._clientHandleFrame > self.stormScorePauseFrame then local killer = entity.components.record.KillerEntity if killer and killer:IsHero() then local scoreData = DataSheetManager.StormMonsterPointData:GetDataByID(monsterID) if scoreData then self.stormScore = self.stormScore + scoreData.MonsterPoint EventSystem.Dispatch(EventID.StormChallenge_ScoreChange, self.stormScore) end end end end function StormChallengeLevelFunction:GetLevelScore() return self.stormScore end function StormChallengeLevelFunction:MissionCompleted(mission, complete) if complete then self.stormScorePauseFrame = LogicUpdateManager._clientHandleFrame end end function StormChallengeLevelFunction:StopLevel() EventSystem.UnRegist(EventID.UIBattle_Mission_CompleteAim, self.MissionCompleted, self) Base.StopLevel(self) end function StormChallengeLevelFunction:OnPlayerOneHeroDead(entity) Base.OnPlayerOneHeroDead(self ,entity) if LevelPlayerManager.IsAllDead(entity) then self:ShowVictoryPose() end end function StormChallengeLevelFunction:ShowVictoryPose() Base.ShowVictoryPose(self) EventSystem.Dispatch(EventID.Level_CloseAllBaseUI) end function StormChallengeLevelFunction:OnLevelSucceed(withShow) local showPose = false local mainEntity = LevelPlayerManager.GetPlayerActiveEntity(LuaConst.STANDALONE_PLAYER_PlayID) if mainEntity and mainEntity:IsAlive() then showPose = true end Base.OnLevelSucceed(self, showPose) end return StormChallengeLevelFunction