Esempio n. 1
0
        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...");
        }
Esempio n. 2
0
 public static void AttachAudioComponents(Contexts context, PlayerEntity playerEntity)
 {
     GameAudioMedia.Dispose();
     playerEntity.AddPlayerAudio();
     GameModuleManagement.ForceAllocate(playerEntity.entityKey.Value.EntityId,
                                        (PlayerAudioController audioController) => { audioController.Initialize(playerEntity); });
 }
Esempio n. 3
0
        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;
        }
Esempio n. 4
0
        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();
        }
Esempio n. 6
0
        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
        }
Esempio n. 7
0
        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);
        }
Esempio n. 8
0
        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);
        }
Esempio n. 9
0
        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);
            }
        }
Esempio n. 10
0
//        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);
                }
            }
        }
Esempio n. 11
0
        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);
        }
Esempio n. 12
0
        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...");
        }
Esempio n. 13
0
 public static PlayerStatisticsControllerBase StatisticsController(this PlayerEntity player)
 {
     return(GameModuleManagement.Get <PlayerStatisticsControllerBase>(player.entityKey.Value.EntityId));
 }
Esempio n. 14
0
 public static void AttachStateInteract(PlayerEntity player)
 {
     GameModuleManagement.ForceAllocate(player.entityKey.Value.EntityId,
                                        (PlayerStateInteractController controller) => { controller.Initialize(player); });
 }
Esempio n. 15
0
 public static PlayerUserCmdController UserCmdController(this PlayerEntity playerEntity)
 {
     return(GameModuleManagement.Get <PlayerUserCmdController>(playerEntity.entityKey.Value.EntityId));
 }