--指令管理器 local ExpSystemManager = {} local private = { timer = 0, renderHash2ExpEntityDic = {}, forceLookRenderEntity = nil, -- 相机强制看的renderEntity } local string_isNilOrEmpty=string.isNilOrEmpty local EventSystem = require('Event/EventSystem') --加载需要的模块 local ExpAnimSystem = require "Battle/Expression/ExpEntity/System/ExpAnimSystem" local ExpEffectSystem = require "Battle/Expression/ExpEntity/System/ExpEffectSystem" local ExpModelSystem = require "Battle/Expression/ExpEntity/System/ExpModelSystem" local ExpUISystem = require "Battle/Expression/ExpEntity/System/ExpUISystem" local ExpCameraSystem = require "Battle/Expression/ExpEntity/System/ExpCameraSystem" local ExpSoundSystem = require "Battle/Expression/ExpEntity/System/ExpSoundSystem" local ExpDriveSystem = require "Battle/Expression/ExpEntity/System/ExpDriveSystem" local ExpVisualFieldSystem = require "Battle/Expression/ExpEntity/System/ExpVisualFieldSystem" local targetOnMainEntityMinionCount = 0 --以主玩家为目标的小兵单位数量, 主视角代码,仅可用于视图。目前只有音效用到了 local targetOnMainEntityBossCount = 0 --以主玩家为目标的Boss单位数量, 主视角代码,仅可用于视图。目前只有音效用到了 local reactiveCameraTime = nil function ExpSystemManager.OnUpdate(deltaTime) private.timer = private.timer + deltaTime ExpDriveSystem.OnUpdate(deltaTime) ExpSoundSystem.OnUpdate(deltaTime) ExpUISystem.OnUpdate(deltaTime) ExpCameraSystem.OnUpdate(deltaTime) ExpEffectSystem.OnUpdate(deltaTime) if reactiveCameraTime and reactiveCameraTime <= private.timer then reactiveCameraTime = nil if CTL.HomeMain.GetFocusTarget() then CameraController.Instance:ReactiveCamera() end end end function ExpSystemManager.Clear() private.timer = 0 private.renderHash2ExpEntityDic = {} private.forceLookRenderEntity = nil ExpDriveSystem.Clear() ExpUISystem.Clear() ExpCameraSystem.Clear() ExpEffectSystem.Clear() end function ExpSystemManager.OnSetAnimIDOverride(expEntity, originID, overrideToID) ExpAnimSystem.OnSetAnimIDOverride(expEntity, originID, overrideToID) end function ExpSystemManager.TryUpdateHorseAnim(entity, rideSpeedRate, horseExpAngle, wantRotateDir) if LogicUpdateManager.IsInReconnectFastPlay() then return end ExpAnimSystem.TryUpdateHorseAnim(entity, rideSpeedRate, horseExpAngle, wantRotateDir) end function ExpSystemManager.OnExpEntityInited(expEntity) if expEntity.RenderEntity then private.renderHash2ExpEntityDic[expEntity.RenderEntity:GetHashCode()] = expEntity end end function ExpSystemManager.OnFastPlayOver() if LogicUpdateManager._curEntity then ExpLevelManager.EnterLevel(LevelManager.GetCurInfoData()) end for eid,entity in pairs(LogicUpdateManager._entityDic) do --print(eid," | active = " ,entity:IsActive() ," |state = " ,entity.components.aiBase.CurStateType) local baseComp = entity.components.base if baseComp.IsActive or baseComp.HidingNeedUpdate then entity.ExpEntity:ApplyExpTrans() entity.ExpEntity:ApplyPetExpTrans(true) ExpAnimSystem.OnFastPlayOver(entity.ExpEntity) ExpEffectSystem.OnFastPlayOver(entity) ExpUISystem.OnFastPlayOver(entity.ExpEntity) ExpSoundSystem.OnFastPlayOver(entity.ExpEntity) end end LevelManager.CurLevelFunc.exp:OnFastPlayOver() if LogicUpdateManager._curEntity then if #SystemManager.syncTimelineRecordList > 0 then local record = SystemManager.syncTimelineRecordList[1] ExpSystemManager.PlayTimeline(record.path, record.pauseLevel, record.autoPassTime, nil, record, record.isStandaloneMode, record.adsorbType, record.adsorbParam) end end end function ExpSystemManager.OnLevelInited() private.timer = 0 targetOnMainEntityMinionCount = 0 targetOnMainEntityBossCount = 0 ExpSystemManager.excludedBuffPsEffectDic = {} --排除掉的Buff粒子特效,key是该粒子特效的路径,value为true时代表排除 ExpSoundSystem.OnLevelInited() ExpCameraSystem.OnLevelInit() end --[[ 激活 --]] function ExpSystemManager.OnActive(expEntity) ExpUISystem.OnActive(expEntity) ExpModelSystem.OnActive(expEntity) ExpCameraSystem.OnActive(expEntity) ExpSoundSystem.OnActive(expEntity) expEntity:ApplyExpTrans() expEntity:ApplyPetExpTrans(true) private.PlaySignEffect(expEntity,true) ---:gws:若是主玩家的武将显示出来,则执行dummy转Visual(让身上的buff特效播放出来) local entity = expEntity.Entity local masterEntity = entity._logicInitData.RootMasterEntity if entity._logicInitData.IsPlayerSelf or (masterEntity and masterEntity._logicInitData.IsPlayerSelf) then if expEntity.RenderEntity then ExpSystemManager.OnConvertRenderVisual(expEntity.RenderEntity, true) end end end --[[ 设置显隐 ,contentPet 是否宠物也隐藏 --]] function ExpSystemManager.OnSetVisible(expEntity, visible, contentPet) ---:gws:若是主玩家的武将显隐变化,则执行dummy与Visual互转(让身上的buff特效播放出来或隐藏) local entity = expEntity.Entity local masterEntity = entity._logicInitData.RootMasterEntity if entity._logicInitData.IsPlayerSelf or (masterEntity and masterEntity._logicInitData.IsPlayerSelf) then if expEntity.RenderEntity then ExpSystemManager.OnConvertRenderVisual(expEntity.RenderEntity, visible) end end ExpModelSystem.OnSetVisible(expEntity, visible, contentPet) end function ExpSystemManager.OnBackground(expEntity) ExpUISystem.OnDisActive(expEntity, true) ExpCameraSystem.OnDisActive(expEntity) ExpModelSystem.OnSetVisible(expEntity, false, true) ---:gws:若是主玩家的武将显隐变化,则执行dummy与Visual互转(让身上的buff特效播放出来或隐藏) local entity = expEntity.Entity local masterEntity = entity._logicInitData.RootMasterEntity if entity._logicInitData.IsPlayerSelf or (masterEntity and masterEntity._logicInitData.IsPlayerSelf) then if expEntity.RenderEntity then ExpSystemManager.OnConvertRenderVisual(expEntity.RenderEntity, false) end end end function ExpSystemManager.OnDisActive(expEntity, contentPet) ExpUISystem.OnDisActive(expEntity, contentPet) ExpCameraSystem.OnDisActive(expEntity) ExpModelSystem.OnSetVisible(expEntity, false, contentPet) ---:gws:若是主玩家的武将显隐变化,则执行dummy与Visual互转(让身上的buff特效播放出来或隐藏) local entity = expEntity.Entity local masterEntity = entity._logicInitData.RootMasterEntity if entity._logicInitData.IsPlayerSelf or (masterEntity and masterEntity._logicInitData.IsPlayerSelf) then if expEntity.RenderEntity then ExpSystemManager.OnConvertRenderVisual(expEntity.RenderEntity, false) end end end --causer :谁造成的状态切换,可以为空,是一个Entity ;hitFlyRate-击飞高度参数,从子弹中获取的 function ExpSystemManager.OnNextStateIn(stateType , expEntity, causer, hitFlyRate,hitFlyRandom) if LogicUpdateManager.IsInReconnectFastPlay() then return end -- 一下随机是只给表现用,所以不用逻辑随机 if hitFlyRandom and hitFlyRandom > 0 then local pn = math.random(0,1) -- positive and negative if pn == 0 then pn = -1 end local randomFly = math.random() -- 0-1的浮点数 local floatRandom = randomFly * randomFly * hitFlyRandom * pn -- GWS:策划需求的随机高度正态分布,但是涉及到了开根求对数等耗时的操作(Box-Muller算法) ,所以用一个类似的数学模型代替 。即:几->人(几人不是汉子是图形) hitFlyRate = floatRandom + hitFlyRate end ExpAnimSystem.OnNextStateIn(stateType, expEntity, causer , hitFlyRate) end function ExpSystemManager.OnFightModeChanged(entity,fightMode) ExpUISystem.OnFightModeChanged(entity,fightMode) end function ExpSystemManager.OnDead(expEntity) ExpUISystem.OnDead(expEntity) ExpCameraSystem.OnDead(expEntity) ExpSoundSystem.OnDead(expEntity) ExpEffectSystem.OnDead(expEntity) private.PlaySignEffect(expEntity,false) expEntity:BreakPsEffectAll() -- 宠物模型要隐藏 expEntity:SetPetVisible(false) end function ExpSystemManager.OnUnload(expEntity, unloadImmediate) ExpUISystem.OnDisActive(expEntity, true) ExpEffectSystem.Unload(expEntity) ExpSoundSystem.Unload(expEntity) local useDissolve = false if expEntity.components.model then useDissolve = expEntity.components.model.NeedDissolve if unloadImmediate then useDissolve = false end end if expEntity.RenderEntity then private.renderHash2ExpEntityDic[expEntity.RenderEntity:GetHashCode()] = nil end expEntity:ClearRenderEntity(useDissolve) end --复活 :关闭界面, 彩色相机 function ExpSystemManager.OnRevive(expEntity) -- 宠物模型要显示 if expEntity.Entity:IsMainEntityOfPlayer() then expEntity:SetPetVisible(true) end expEntity:ApplyExpTrans() expEntity:ApplyPetExpTrans(true) ExpUISystem.OnRevive(expEntity) ExpCameraSystem.OnRevive(expEntity) private.PlaySignEffect(expEntity,true) expEntity:ReplayAllBuffEffect() --复活时重播特效 --这个代码是临时处理方案。正式的做法应该是各个类在OnDead的时候自己去判定要删除哪些特效。目前是直接在ExpSystemManager.OnDead里调用了expEntity:BreakPsEffectAll(),会删掉所有特效,这个方法过于笼统了 expEntity:PlayCurModelEffect() expEntity:RecoverActorPsEffect() -- 恢复记录的长久特效(不是buff管理的) end function ExpSystemManager.OnWinBattle(expEntity, winEffect) LuaInputManager.SetVirtualMoveDir(0,0) LuaInputManager.ReleaseAttackKeyHard() expEntity:ApplyExpTrans() expEntity:ForceVisual() ExpAnimSystem.PlayAnimationDirectly(expEntity, LuaConst.Animation_win) ExpEffectSystem.OnWinBattle(expEntity, winEffect) ExpSoundSystem.OnWinBattle(expEntity) expEntity:SetAnimInvalid() end function ExpSystemManager.ResetTransform(expEntity) expEntity:ApplyExpTrans() expEntity:ApplyPetExpTrans() end function ExpSystemManager.OnConvey(expEntity, camAngle) if expEntity.RenderEntity then expEntity.RenderEntity:OnConvey() end ExpCameraSystem.OnConvey(expEntity, camAngle) end --region --*************** 属性相关 ***************-- -- viewerType : 可以看到这个冒字的单位类型。需要跟BattleEffect的说明一致 function ExpSystemManager.ShowNoRealTimeAttrChangeTips(expEntity, casterEntity, attrType, delta, viewerType) ExpUISystem.ShowNoRealTimeAttrChangeTips(expEntity, casterEntity, attrType, delta, viewerType) end --[[ 血量变化 batch:伤害冒字合批显示的批次,nil表示不合批 ]]-- function ExpSystemManager.OnHPChange(expEntity, caster, delta, value , op , hpChangeType,batch) if LogicUpdateManager.IsInReconnectFastPlay() then return end local entityismyself = expEntity.Entity == LogicUpdateManager._curEntity if entityismyself == false then local entity_driveComp = expEntity.Entity.components.drive entityismyself = entity_driveComp.BeDrivedByEntity == LogicUpdateManager._curEntity end local casterIsmyself = caster and caster:GetOriginEntity() == LogicUpdateManager._curEntity and (not expEntity.ignoreUIHPFromMaster) local isAboutMe = entityismyself or casterIsmyself -- 与我相关 ExpUISystem.OnHPChange(expEntity, caster, delta, value, false, hpChangeType, batch ,isAboutMe) ExpAnimSystem.OnHPChange(expEntity,op ,hpChangeType ,isAboutMe) end --[[ 无双量变化 ]]-- function ExpSystemManager.OnSAChange(expEntity, delta, value) if LogicUpdateManager.IsInReconnectFastPlay() then return end ExpUISystem.OnSAChange(expEntity,value,false) end --[[ 霸体值变化 ]]-- function ExpSystemManager.OnAMChange(expEntity, delta, value) if LogicUpdateManager.IsInReconnectFastPlay() then return end ExpUISystem.OnAMChange(expEntity,value,false) end -- 护盾添加 function ExpSystemManager.OnAddPCBuff(expEntity , addValue) if LogicUpdateManager.IsInReconnectFastPlay() then return end ExpUISystem.OnPCChange(expEntity,addValue,false) end -- 护盾减少 function ExpSystemManager.OnSubPCAttr(expEntity, opEntity, delta ,justExp ,needShowHurtNum, limitBuffId) if LogicUpdateManager.IsInReconnectFastPlay() then return end local showHurt = needShowHurtNum if justExp then showHurt = false else showHurt = false local isPlayerSelf = opEntity:SelfAndMasterIsPlayerSelf() if not isPlayerSelf and not expEntity.Entity:SelfAndMasterIsPlayerSelf() then showHurt = false else showHurt = true end end if limitBuffId then -- 仅仅是扣除特定buff提供的护盾值时不显示冒字 showHurt = false end ExpUISystem.OnPCChange(expEntity,FP.Const.Zero,false ,showHurt ) end --护盾的分母值减小 function ExpSystemManager.OnSubTotalPCAttr(expEntity , delta) ExpUISystem.OnPCChange(expEntity,-delta,false) end -- 时间缩放变化 function ExpSystemManager.OnTimeScaleChange(expEntity, ignoreSound, timescaleChannel) expEntity:RefreshTimeScale(ignoreSound, timescaleChannel) end -- 设置 奔跑的动作 动画播放速度 function ExpSystemManager.ChangeMoveAnimationPlaySpeed(expEntity, speed) ExpAnimSystem.ChangeMoveAnimationSpeed(expEntity, speed) end function ExpSystemManager.SetEntityUIDamageType(expEntity,uiDamageType) local comp_ExpUI = expEntity.components.ui comp_ExpUI.CurUIDamageType = uiDamageType end --endregion 属性相关 --region --*************** 攻击相关 ***************-- --[[ 开始是否技能 --]] function ExpSystemManager.OnAttackEnter(expEntity, skillData, batchEffect) if LogicUpdateManager.IsInReconnectFastPlay() then return end expEntity:ApplyExpTrans() ExpEffectSystem.OnAttackEnter(expEntity, batchEffect) ExpAnimSystem.OnAttackEnter(expEntity) ExpUISystem.OnAttackEnter(expEntity,skillData) ExpDriveSystem.OnAttackEnter(expEntity) ExpSoundSystem.OnAttackEnter(expEntity,skillData) ExpCameraSystem.OnAttackEnter(expEntity) end function ExpSystemManager.OnAttackQuit(expEntity) ExpEffectSystem.OnAttackQuit(expEntity) ExpCameraSystem.OnAttackQuit(expEntity) end function ExpSystemManager.OnInterruptSkill(expEntity) ExpEffectSystem.OnInterruptSkill(expEntity) end --[[ 添加特殊 buff 击飞 --]] function ExpSystemManager.OnExpHitFly(entity) --ExpHitSystem.OnHitFly(entity) end function ExpSystemManager.OnHitEnter(entity, hitAddPos) --ExpHitSystem.OnHitEnter(entity,hitAddPos) end --endregion 攻击相关 --region --*************** 变身相关 ***************-- --[[ 变身 --]] function ExpSystemManager.OnSwitchHero(fromExpEntity, toExpEntity, dontBackground) ExpUISystem.OnSwitchHero(fromExpEntity,toExpEntity) if not dontBackground then ExpSystemManager.OnSetVisible(fromExpEntity, false, true) ExpSystemManager.OnSetVisible(toExpEntity, true, true) end ExpSoundSystem.OnSwitchHero(fromExpEntity, toExpEntity) private.PlaySignEffect(toExpEntity,true) ExpEffectSystem.OnSwitchHero(fromExpEntity, toExpEntity, dontBackground) toExpEntity:ApplyExpTrans() toExpEntity:ApplyPetExpTrans(true) end function ExpSystemManager.OnChangeAvatar(expEntity, withMagicWeapon) ExpSystemManager.OnChangeModel(expEntity, withMagicWeapon) ExpUISystem.OnChangeAvatar(expEntity) end -- 变身表现响应 :withMagicWeapon 变身后是否需要持有神兵 function ExpSystemManager.OnChangeModel(expEntity, withMagicWeapon) local comp_ExpModel = expEntity.components.model local modelData = comp_ExpModel.AppearanceModelData or expEntity.Entity.components.replace:GetCurExpModelData() -- 模型显示优先级:特殊外显 > 时装外显 > 当前逻辑外显 expEntity:ChangeModel(modelData, withMagicWeapon) expEntity:DisposeWeaponHalo() expEntity:CreateWeaponHalo() ExpCameraSystem.OnChangeModel(expEntity) ExpSoundSystem.OnChangeModel(expEntity) end --神兵特效变化 function ExpSystemManager.OnChangeMagicWeaponEffect(expEntity) expEntity:ChangeMagicWeaponEffect() end --endregion 变身相关 --region --*************** 子弹相关 ***************-- --[[ 子弹tick --]] function ExpSystemManager.OnExpMissileUpdate(deltaTime) MissileManager.OnExpUpdate(deltaTime) end --[[ 子弹:发射 ;index 是第几个子模型(军团怪才有效) --]] function ExpSystemManager.OnMissileFire(expMissile, paramData ,offsetx, offsetz) if LogicUpdateManager.IsInReconnectFastPlay() then return end if offsetx and offsetz then -- 有特殊的基准位置 expMissile:OnFire(paramData ,offsetx, offsetz) else expMissile:OnFire(paramData) end end function ExpSystemManager.OnMissileCancled(expMissile) if LogicUpdateManager.IsInReconnectFastPlay() then return end ExpDriveSystem.OnMissileCancle(expMissile) end --endregion 子弹相关 function ExpSystemManager.SetCurEntity(expEntity) ExpSoundSystem.OnSetCurEntity(expEntity) if private.forceLookRenderEntity == nil then AuxUtil.SetCurRenderEntity(expEntity:GetRenderEntity()) end end function ExpSystemManager.OnSetTarget(entity, target, oldTarget) if not entity:IsPlayerSelf() then if target ~= oldTarget then if entity:IsMonster() then local old = entity:IsMinion() and targetOnMainEntityMinionCount or targetOnMainEntityBossCount if target and target.isHero then if entity:IsMinion() then targetOnMainEntityMinionCount = targetOnMainEntityMinionCount + 1 else targetOnMainEntityBossCount = targetOnMainEntityBossCount + 1 end end if oldTarget and oldTarget.isHero then if entity:IsMinion() then targetOnMainEntityMinionCount = targetOnMainEntityMinionCount - 1 else targetOnMainEntityBossCount = targetOnMainEntityBossCount - 1 end end if old == 0 and ((entity:IsMinion() and targetOnMainEntityMinionCount or targetOnMainEntityBossCount) > 0) then if entity:IsMinion() then ExpSystemManager.OnTargetOnMainEntityMinionNoZero(entity) else ExpSystemManager.OnTargetOnMainEntityBossNoZero(entity) end end end end end end function ExpSystemManager.OnTargetOnMainEntityMinionNoZero(causerEntity) ExpSoundSystem.OnTargetOnMainEntityMinionNoZero(causerEntity) end function ExpSystemManager.OnTargetOnMainEntityBossNoZero(causerEntity) ExpSoundSystem.OnTargetOnMainEntityBossNoZero(causerEntity) end function ExpSystemManager.OnSetFollowTarget(expEntity, target) -- 暂时不做任何事情,只留个时间点 end ---动作声音相关 --causer :谁造成的状态切换,可以为空,是一个Entity function ExpSystemManager.PlayAinmSound(expEntity, playAnimName, causer) if LogicUpdateManager.IsInReconnectFastPlay() then return end ExpSoundSystem.PlayAinmSound(expEntity,playAnimName, causer) end function ExpSystemManager.StopAinmSound(expEntity) ExpSoundSystem.StopAinmSound(expEntity) end function ExpSystemManager.PlayHorseWalkSound(expEntity) if LogicUpdateManager.IsInReconnectFastPlay() then return end ExpSoundSystem.PlayAinmSound(expEntity,expEntity.Entity._logicInitData.HorseModelData.HorseWalkAudio, expEntity.Entity)-- 和其他播放马的声音一样暂时写死 end function ExpSystemManager.SetSignEffectVisible(expEntity, isVisible) private.PlaySignEffect(expEntity, isVisible) end function private.PlaySignEffect(expEntity,show) if LevelManager.IsReplayBattle() then return end local entity = expEntity.Entity if LevelManager.IsSyncLevel() and not LevelManager.IsSyncWorldBossLevel() and not LevelManager.IsWarZoneWorldBossLevel() and not entity._logicInitData.IsPlayerSelf and entity._logicInitData.CharacterType == LuaConst.CharacterType.Hero then local isEnemy = CampManager.IsEnemyCamp(entity:GetCampID(),LevelPlayerManager.MainEntityCampID) local isSameGuild = false if isEnemy then local playerInfo = LevelPlayerManager.GetPlayerInfoByPlayerIDInRoom(LevelPlayerManager.MyPlayerIDInRoom) if playerInfo then local myGuildID = playerInfo.guildID if myGuildID and myGuildID ~= "" then isSameGuild = entity:GetGuildID() == myGuildID end --else --do nothing 正常现象,比如在关卡结束时过来,数据会清空 end -- 同步公平1v1 ,天地群雄等需要同势力也显示红色圈 if LevelManager.IsSolo() or LevelManager.IsNineVsNineFightLevel() or LevelManager.IsSyncTeamPVP() then isSameGuild = false end end if isEnemy and not isSameGuild then SystemManager.OnShowEffect(entity,LuaConst.EffectType.HeroSighEnemy,show, true) else SystemManager.OnShowEffect(entity,LuaConst.EffectType.HeroSignFriend,show, true) end end end --上马 function ExpSystemManager.OnRideHorse(expEntity, horseModelData, horseMoveData, dontShowEff , notSendHorseState) ExpEffectSystem.BeforeChangeRideState(expEntity) ExpModelSystem.OnRideHorse(expEntity, horseModelData.HorseModel, horseModelData.HorseShowEffect, horseModelData.Scale) if not dontShowEff then ExpEffectSystem.OnRideHorse(expEntity, horseModelData.HorseEffect) end ExpUISystem.OnRideHorse(expEntity) ExpCameraSystem.OnRideHorse(expEntity, horseModelData) if not notSendHorseState then EventSystem.Dispatch(EventID.Level_HorseState, expEntity.Entity, true) end ExpEffectSystem.AfterChangeRideState(expEntity) end --下马 function ExpSystemManager.OnOffHorse(expEntity) ExpEffectSystem.BeforeChangeRideState(expEntity) ExpEffectSystem.OnOffHorse(expEntity, expEntity.Entity._logicInitData.HorseModelData and expEntity.Entity._logicInitData.HorseModelData.HorseEffect) ExpModelSystem.OnOffHorse(expEntity) ExpUISystem.OnOffHorse(expEntity) ExpCameraSystem.OnOffHorse(expEntity, expEntity.Entity._logicInitData.HorseModelData) EventSystem.Dispatch(EventID.Level_HorseState, expEntity.Entity, false) ExpEffectSystem.AfterChangeRideState(expEntity) end -- 上车失败 function ExpSystemManager.OnDriveFailed(driver) if driver == LogicUpdateManager._curEntity then ExpLevelManager.ShowTips(driver, "IDS_HasBeDriven") end end -- 上车 开始驾驶载具 function ExpSystemManager.OnDriveEntity(expEntity ,carEntity, interactIndex) --技能等面板相关 ExpUISystem.OnDriveEntity(expEntity, interactIndex) if expEntity.Entity == LogicUpdateManager._curEntity then -- 显示瞄准点 显示其他人的头等特效 ExpDriveSystem.OnDriveEntity(expEntity ,carEntity) --相机切换 local driveComp = carEntity.components.drive local isFreeCamera = driveComp.IsFreeCamera if not driveComp:GetDriveData() then isFreeCamera = true end if private.forceLookRenderEntity == nil then ExpCameraSystem.OnDriveEntity(expEntity, isFreeCamera) end --改变遮挡剔除优先级 ExpModelSystem.OnDriveEntity(expEntity ,carEntity) end ExpSoundSystem.OnDriveEntity(expEntity ,carEntity) end -- 下车 : driveEntity = 载具 function ExpSystemManager.OnOffDriveEntity(expEntity,carEntity) --技能等面板相关 ExpUISystem.OnOffDriveEntity(expEntity, carEntity) if expEntity.Entity == LogicUpdateManager._curEntity then --上车按钮改为下车 --相机切换 local driveComp = carEntity.components.drive local isFreeCamera = driveComp.IsFreeCamera if not driveComp:GetDriveData() then isFreeCamera = true end ExpCameraSystem.OnOffDriveEntity(expEntity, carEntity, isFreeCamera) -- 隐藏瞄准点 ExpDriveSystem.OnOffDriveEntity(expEntity, carEntity) --改变遮挡剔除优先级 ExpModelSystem.OnOffDriveEntity(expEntity ,carEntity) end end function ExpSystemManager.OnInteractStart(entity, interactIndex) if entity == LogicUpdateManager._curEntity then ExpUISystem.OnInteractStart(entity, interactIndex) end end function ExpSystemManager.OnInteractSucceed(entity, interactData) if entity == LogicUpdateManager._curEntity then --技能面板切换 ExpUISystem.OnInteractSucceed(entity) if interactData and not string_isNilOrEmpty(interactData.InteractSuccessSound) then CTL.Sound.PlayGameSound(interactData.InteractSuccessSound) end end end function ExpSystemManager.ChangeCameraOrthographic() CameraController.Instance:ChangeCameraOrthographic(10 ,0.5) end function ExpSystemManager.ShowBubbleDialogue(expEntity,dialogueID) ExpUISystem.ShowBubbleDialogue(expEntity,dialogueID) end function ExpSystemManager.StartConfrontation(expEntity, expAgainst, callback) AuxUtil.StartConfrontation(expEntity:GetRenderEntity(),expAgainst:GetRenderEntity(),callback) end function ExpSystemManager.PlayBuffEffect(expEntity, effect, showChance) if not ExpSystemManager.excludedBuffPsEffectDic[effect] then return ExpEffectSystem.OnPlayBuffEffect(expEntity,effect, showChance) end end function ExpSystemManager.AddQueueEffect(expEntity, effect) ExpEffectSystem.AddQueueEffect(expEntity, effect) end function ExpSystemManager.StopBuffEffect(expEntity, playID, breakEffect) return ExpEffectSystem.OnStopBuffEffect(expEntity,playID, breakEffect) end --如果配了断开时的动画UnslotAnims,则需要传一个随机数数组,这么做是为了防止视图调用逻辑导致单机校验不一致 function ExpSystemManager.RemoveParentEquipment(expEntity, unslotAnimsRandomIndex) expEntity:RemoveParentEquipment(unslotAnimsRandomIndex) end function ExpSystemManager.LookToEntity(expEntity,toEntity) if toEntity then expEntity:LookAtTarget(toEntity.ExpEntity:GetRenderEntity()) else expEntity:LookAtTarget(nil) end end function ExpSystemManager.SetOverrideTargetDirToTarget(expEntity, targetExpEntity) if targetExpEntity then expEntity:SetOverrideTargetDirToTarget(targetExpEntity:GetRenderEntity()) end end function ExpSystemManager.UpdateEntityHeadGuildShow(entity) ExpUISystem.UpdateEntityHeadGuildShow(entity) end function ExpSystemManager.ChangeEntityName(entity,name) ExpUISystem.ChangeEntityName(entity,name) end function ExpSystemManager.ChangeEntityGuildEscort(entity, quality) ExpUISystem.ChangeEntityGuildEscort(entity, quality) end function ExpSystemManager.ChangeEntityCountry(entity, ...) ExpUISystem.ChangeEntityCountry(entity, ...) end function ExpSystemManager.ChangeEntityTitle(entity, titleID) ExpUISystem.ChangeEntityTitle(entity, titleID) end function ExpSystemManager.TopEntityTitle(entity) ExpUISystem.TopEntityTitle(entity) end function ExpSystemManager.SetMaterialByType(target ,type, materialType, path, renderQueue) target.ExpEntity:SetMaterialByType(type, materialType, path, renderQueue) end function ExpSystemManager.ResetMaterial(target) target.ExpEntity:ResetMaterial() end function ExpSystemManager.SetKeepFallDown(expEntity ,bol) expEntity:SetKeepFallDown(bol) end function ExpSystemManager.SetCameraTarget(expEntity, removeEntity) if LevelManager.IsInLevelWatchBattle() then return end ExpCameraSystem.SetCameraTarget(expEntity, removeEntity) end --排除Buff的粒子特效,排除之后整场战斗将不再播放Buff的这个粒子特效 function ExpSystemManager.ExcludeBuffPsEffect(path) if path then ExpSystemManager.excludedBuffPsEffectDic[path] = true else logging.error(LTAG.ERROR, "HYW : path nil Error @ExpSystemManager.ExcludeBuffPsEffect") end end function ExpSystemManager.ChangeCameraTargetPattern() ExpCameraSystem.ChangeTargetPattern() end function ExpSystemManager.SwitchTargetCameraAim() ExpCameraSystem.SwitchTargetCameraAim() end function ExpSystemManager.GetEquipPartSlotInt(equipPart) return ExpSystemManager.GetSlotInt(equipPart.EquipSlotStr, equipPart.SlotType, equipPart.IsParent) end function ExpSystemManager.GetSlotInt(equipSlotStr, slotType, isParent) local slotInt = nil if isParent then if slotType == LuaConst.ESlotType.HUMAN_LIKE then slotInt = LuaConst.HumanEquipSlot[equipSlotStr] elseif slotType == LuaConst.ESlotType.BEAST then slotInt = LuaConst.BeastEquipSlot[equipSlotStr] end else slotInt = LuaConst.HumanEquipSlot[equipSlotStr] end return slotInt end function ExpSystemManager.ChangeHorse(expEntity, horseModelPath, horseShowEffect ,modelScale) if expEntity.Entity.components.buff:CheckHasBuffState(LuaConst.SpecialBuffs.InRiding) then -- 只有在上马的时候才换 ExpEffectSystem.BeforeChangeRideState(expEntity) expEntity:ChangeHorse(horseModelPath, horseShowEffect, modelScale) ExpCameraSystem.OnChangeHorse(expEntity, expEntity.Entity._logicInitData.HorseModelData) ExpEffectSystem.AfterChangeRideState(expEntity) else expEntity:ChangeHorseNotRiding() end end function ExpSystemManager.ChangePet(expEntity, petId, petStage, petName, justName) if justName then ExpUISystem.ChangePetName(expEntity, expEntity:GetPetName()) return end -- 模型要换(name会在换模型时自动卸载掉) expEntity:ChangePet(petId, petStage) if petId and petId > 0 then --创建名字板 ExpUISystem.CreatePetUIName(expEntity) end end function ExpSystemManager.PlayTimeline(path, pauseLevel, autoPassTime, callback, record, isStandaloneMode, adsorbType, adsorbParam) if LogicUpdateManager.IsInReconnectFastPlay() then return end if LevelManager.IsSyncLevel() and not isStandaloneMode then if not LevelPlayerManager.IsMainPlayerTeamLeader() then UIManager.OpenView(Const_UI_Lua.UIEnum.UICaptainSkipPanel) end end ExpLevelManager.PlayTimeline(path, pauseLevel, autoPassTime, callback, adsorbType, adsorbParam) end function ExpSystemManager.OnCmdAllTimelineFinish() ExpSystemManager.CloseTimelineWaitMask() end function ExpSystemManager.CloseTimelineWaitMask() UIManager.CloseView(Const_UI_Lua.UIEnum.UICaptainSkipPanel) end --[[ 播放PS特效 ]]-- -- Play Ps Effect Directly function ExpSystemManager.ShowPSEffect(entity, effect, needRecord) if LogicUpdateManager.IsInReconnectFastPlay() then if needRecord then entity.ExpEntity:Record_PlayPsEffect(effect, 0) end return end local playID = entity.ExpEntity:PlayPsEffect(effect) if needRecord then entity.ExpEntity:Record_PlayPsEffect(effect, playID) end return playID end --[[ 播放PS特效 ]]-- 小黑屋 function ExpSystemManager.ShowBlackRoomEffect(entity, effect,timeScale, duration, layer, callback) if LogicUpdateManager.IsInReconnectFastPlay() then return end local playID = 0 playID = entity.ExpEntity:PlayPsEffect(effect, timeScale, duration, layer, callback) if playID > 0 then return playID end end --播放PS特效 --必须传的参数:effectPath全路径 --duration:持续时间,对于loop的PsInstance有效,时间一过会丢到PsInstance的池子里 --parent是特效的父节点,可以传Entity,也可以传UI节点,不传则在场景里的PsRoot下 --屏幕特效可不传Entity,会自动挂在主相机上;layer不传则取Entity身上的layer,无Entity则取自己的layer --需要挂载在Entity的,挂点在特效上已经设置好 --callBack是PsRoot下所有Action全部播放的回调 --特效正常播完会回收到池子,如果挂在UI上在关闭界面时需要调用AuxUtil.StopDynamicObject回收 function ExpSystemManager.PlayPsEffect(effectPath, parent) if LogicUpdateManager.IsInReconnectFastPlay() then return end local isParentEntity = parent and type(parent) == 'table' --父节点是否为entity local layer = isParentEntity and parent.ExpEntity.components.model.Layer or 0--LogicUpdateManager._curEntity.ExpEntity.components.model.Layer local parntTf = isParentEntity and parent.ExpEntity.RenderEntity or parent return AuxUtil.PlayPsEffect(effectPath, parntTf, layer) end --播放胜利动画,停止所有的特效 function ExpSystemManager.StopAllPsCamera() AuxUtil.StopAllPsCamera() end function ExpSystemManager.SetCameraGrayState(isGray) ExpCameraSystem.SetGray(isGray) end -- 播放一条tips function ExpSystemManager.ShowDialogueWithName(entity, str) ExpUISystem.ShowDialogueWithName(entity, str) end -- 播放一条战报tips function ExpSystemManager.ShowBattleReport(entity, IdsStr, str, showType, showTime, justPlayerSelfShow) if not justPlayerSelfShow or entity == LogicUpdateManager._curEntity then ExpUISystem.ShowBattleReport(entity, IdsStr, str, showType, showTime) end end -- 播放跑马灯 function ExpSystemManager.ShowMarquee(string, param1, param2, param3, isTop) local content = string.FormatByIdsKey(string, param1, param2, param3) local msg = { Priority = 1, BreakPriority = 1, content = content, mapUIType = MDL.Broadcast.MapUIType.Battle, } if isTop then MDL.Broadcast.InsertBroadcastMsg_Top(msg) else MDL.Broadcast.InsertBroadcastMsg(msg) end end function ExpSystemManager.OnShowObject(expEntity, show, path) if show then expEntity:PlayObject(path) else expEntity:StopObject(path) end end function ExpSystemManager.GetExpEntityByRenderEntity(renderEntity) return private.renderHash2ExpEntityDic[renderEntity:GetHashCode()] end --获取相机目标:仅在非同步玩法使用 function ExpSystemManager.GetCameraTarget() return ExpCameraSystem.GetCameraTarget() end --主要用来让相机的角度变为追背 function ExpSystemManager.DelayReactiveCamera(delayTime) reactiveCameraTime = private.timer + delayTime end -- 显隐特殊光效 isShow :true 增加 ,false 删除 function ExpSystemManager.ShowOrHideLightEffect(expEntity, lightEffectID, isShow) ExpEffectSystem.ShowOrHideLightEffect(expEntity, lightEffectID, isShow) end function ExpSystemManager.OnChangedMagicWeapon(expEntity) ExpModelSystem.OnChangedMagicWeapon(expEntity) end function ExpSystemManager.OnVisualFieldChanged(expEntity, oldLv, oldGroup) ExpVisualFieldSystem.OnVisualFieldChanged(expEntity.Entity.components.visualField, oldLv, oldGroup) end function ExpSystemManager.OnVisiblityChanged(expEntity, oldLv, oldGroup) ExpVisualFieldSystem.OnVisiblityChanged(expEntity.Entity.components.visualField, oldLv, oldGroup) end function ExpSystemManager.OnConvertRenderVisual(renderEntity, isVisible) local expEntity = ExpSystemManager.GetExpEntityByRenderEntity(renderEntity) if isVisible then if expEntity and expEntity.dontShowVisualInst then --通过显示优先级的配置值决定是否强制不显示可视对象 --所有可视对象初始都是Dummy状态,并且目前这种显示规则在运行过程中不会变化,所以这里直接略过即可,不需要转回Dummy,因为它们从来没有进入过可视状态 else renderEntity:ConvertRenderVisual() --恢复角色的循环BUFF特效,因为切换为Dummy的时候特效全部清除掉了 ExpEffectSystem.ReplayBuffEffect(expEntity) if expEntity then ExpDriveSystem.OnConvertRenderVisual(expEntity) expEntity:CreateWeaponHalo() end end else if expEntity then expEntity:DisposeWeaponHalo() end renderEntity:ConvertRenderDummy() end ExpEffectSystem.OnConvertRenderVisual(expEntity, isVisible) ExpVisualFieldSystem.OnConvertRenderVisual(renderEntity, isVisible) end function ExpSystemManager.UnloadRenderEntity(renderEntity, needDissolve) if renderEntity then renderEntity:Dispose(needDissolve) end end function ExpSystemManager.SetExpInvisibleByCamp(entity) if LogicUpdateManager._curEntity then if entity:GetCampID() == LogicUpdateManager._curEntity:GetCampID() then ExpSystemManager.SetMaterialByType(entity, LuaConst.EMaterialType.TRANSPARENT) else entity.ExpEntity.RenderEntity:ConvertRenderDummy() if entity.ExpEntity.PetRenderEntity then entity.ExpEntity.PetRenderEntity:ConvertRenderDummy() end end end end function ExpSystemManager.OnBattlePropExistChange(expEntity, UIType, isVisible, initCD) ExpUISystem.SetVisibleBattlePropExtraUI(expEntity, UIType, isVisible, initCD) end function ExpSystemManager.HideBattlePropExistUI(entity, hideList) for _, battlePropID in ipairs(hideList) do local battlePropData = DataSheetManager.BattlePropData:GetDataByID(battlePropID) ExpUISystem.SetVisibleBattlePropExtraUI(entity.ExpEntity, battlePropData.ExtraUIType, false) end end -- entity:取消相机锁定 是被 entity驱动的 function ExpSystemManager.OnEscapeCameraLock(entity, isDefaultCurLockEntity) ExpCameraSystem.OnEscapeCameraLock(entity, isDefaultCurLockEntity) end -- 尝试恢复相机锁定(entity : 是取消相机索敌的始作俑者 ) function ExpSystemManager.TryRecoverMyCameraLock(entity, isPreparedTargetOnUpdateValid) ExpCameraSystem.OnRecoverCameraLock(entity, isPreparedTargetOnUpdateValid) end function ExpSystemManager.TryRecoverMyBeforeCameraLock() ExpCameraSystem.TryRecoverBeforeCameraLock() end function ExpSystemManager.SetCameraAddPreparedTargetOnUpdateValid(value, causer) ExpCameraSystem.SetAddPreparedTargetOnUpdateValid(value, causer) end --region 关卡强制的观看目标 function ExpSystemManager.SetForceLookRenderEntity(renderEntity) private.forceLookRenderEntity = renderEntity end --endregion return ExpSystemManager