public void Dispose() { #if UNITYSOURCEMODIFIED && !UNITYEDITOR UnityProfiler.EnableProfiler(false); #endif state = RoomState.Disposing; isDisposed = true; DisposePlayerConnections(); if (sendSnapshotManager != null) { sendSnapshotManager.Dispose(); } GameModuleManagement.Dispose(); try { ResetContexts(true); sessionStateMachine.ShutDown(); } catch (Exception e) { logger.ErrorFormat("Reset Contexts Error {0}", e); } DestoryObjectUnderDefaultGoBattleServer(); ContextsWrapper.CoRoutineManager.StartCoRoutine(UnloadScene()); ContextsWrapper.Dispose(); logger.InfoFormat("Server Room is Disposing..."); }
public static void AttachAudioComponents(Contexts context, PlayerEntity playerEntity) { GameAudioMedia.Dispose(); playerEntity.AddPlayerAudio(); GameModuleManagement.ForceAllocate(playerEntity.entityKey.Value.EntityId, (PlayerAudioController audioController) => { audioController.Initialize(playerEntity); }); }
public void ExecuteUserCmd(IUserCmdOwner owner, IUserCmd cmd) { var weaponController = GameModuleManagement.Get <PlayerWeaponController>(owner.OwnerEntityKey.EntityId); cmd.IsAutoFire = weaponController.HeldWeaponAgent.RunTimeComponent.NeedAutoBurstShoot; cmd.IsAutoReload = weaponController.HeldWeaponAgent.RunTimeComponent.NeedAutoReload; }
public void ExecuteUserCmd(IUserCmdOwner owner, IUserCmd cmd) { var audioController = GameModuleManagement.Get <PlayerAudioController>(owner.OwnerEntityKey.EntityId).Value; if (audioController != null) { audioController.Update(); } }
public void ExecuteUserCmd(IUserCmdOwner owner, IUserCmd cmd) { if (!cmd.IsInterrupt) { return; } var controller = GameModuleManagement.Get <PlayerWeaponController>(owner.OwnerEntityKey.EntityId); controller.Interrupt(); }
public void ExecuteUserCmd(IPlayerUserCmdGetter getter, IUserCmd cmd) { var weaponController = GameModuleManagement.Get <PlayerWeaponController>(getter.OwnerEntityKey.EntityId); cmd.IsAutoFire = weaponController.HeldWeaponAgent.RunTimeComponent.NeedAutoBurstShoot; cmd.IsAutoReload = weaponController.HeldWeaponAgent.RunTimeComponent.NeedAutoReload; weaponController.InternalUpdate(); #if UNITY_EDITOR if (cmd.IsYDown) { } #endif }
private static void AttachStatistics(PlayerEntity player) { PlayerStatisticsControllerBase controller; if (SharedConfig.IsServer) { controller = new ServerPlayerStatisticsController(); } else { controller = new ClientPlayerStatisticsController(); } controller.Initialize(player); GameModuleManagement.ForceCache(player.entityKey.Value.EntityId, controller); }
private static void AttachUserCmd(PlayerEntity playerEntity) { PlayerUserCmdController controller; if (SharedConfig.IsServer) { controller = new ServerPlayerUserCmdController(); } else { controller = new PlayerUserCmdController(); } controller.Initialize(playerEntity); GameModuleManagement.ForceCache(playerEntity.entityKey.Value.EntityId, controller); }
public void ExecuteUserCmd(IUserCmdOwner owner, IUserCmd cmd) { var controller = GameModuleManagement.Get <PlayerWeaponController>(owner.OwnerEntityKey.EntityId); var weaponId = controller.HeldWeaponAgent.ConfigId; if (weaponId < 1) { return; } var weaponLogic = _weaponLogicManager.GetWeaponLogic(weaponId); if (null != weaponLogic) { weaponLogic.Update(controller, cmd); } }
// public WeaponClientUpdateComponent ClientUpdateComponent // { // get // { // if (Entity == null) return WeaponClientUpdateComponent.Empty; // if (!entityCache.hasWeaponClientUpdate) // entityCache.AddWeaponClientUpdate(); // return entityCache.weaponClientUpdate; // } // } public void InterruptPullBolt() { if (RunTimeComponent.IsPullingBolt) { if (GlobalConst.EnableWeaponLog) { DebugUtil.MyLog("Do Interrupt :" + ConfigId); } RunTimeComponent.IsPullingBolt = false; RunTimeComponent.PullBoltInterrupt = true; var audioController = GameModuleManagement.Get <PlayerAudioController>(Owner.EntityId).Value; if (audioController != null) { audioController.StopPullBoltAudio(ConfigId); } } }
private static void AttachAudio(Contexts context, PlayerEntity playerEntity) { GameAudioMedia.Dispose(); playerEntity.AddPlayerAudio(); PlayerAudioControllerBase controller; if (SharedConfig.IsServer) { controller = new ServerPlayerAudioController(); } else { controller = new ClientPlayerAudioController(); } controller.Initialize(playerEntity, context.session.commonSession.RoomInfo.MapId); GameModuleManagement.ForceCache(playerEntity.entityKey.Value.EntityId, controller); }
public void Dispose() { #if UNITY_SOURCE_MODIFIED && !UNITY_EDITOR UnityProfiler.EnableProfiler(false); #endif _state = RoomState.Disposing; DisposePlayerConnections(); if (_bin2DManager != null) { _bin2DManager.Dispose(); } if (_sendSnapshotManager != null) { _sendSnapshotManager.Dispose(); } _contexts.session.commonSession.Dispose(); _contexts.session.serverSessionObjects.Dispose(); GameModuleManagement.Dispose(); try { ResetContexts(true); _sessionStateMachine.ShutDown(); _contexts.Reset(); } catch (Exception e) { _logger.ErrorFormat("Reset Contexts Error {0}", e); } _contexts = null; DestoryObjectUnderDefaultGoBattleServer(); _coRoutineManager.StartCoRoutine(UnloadScene()); _logger.InfoFormat("Server Room is Disposing..."); }
public static PlayerStatisticsControllerBase StatisticsController(this PlayerEntity player) { return(GameModuleManagement.Get <PlayerStatisticsControllerBase>(player.entityKey.Value.EntityId)); }
public static void AttachStateInteract(PlayerEntity player) { GameModuleManagement.ForceAllocate(player.entityKey.Value.EntityId, (PlayerStateInteractController controller) => { controller.Initialize(player); }); }
public static PlayerUserCmdController UserCmdController(this PlayerEntity playerEntity) { return(GameModuleManagement.Get <PlayerUserCmdController>(playerEntity.entityKey.Value.EntityId)); }