public UserCmdParallelExecuteManagerSystem(IGameModule gameModule, IUserCmdExecuteSystemHandler handler, IGameStateProcessorFactory gameStateProcessorFactory, int threadCount) { _systems = new List <IUserCmdExecuteSystem>(); _taskInfos = new List <TaskInfo>(); _systems.Add(new UserCmdPreExecuteSystem(gameStateProcessorFactory)); _systems.AddRange(gameModule.UserCmdExecuteSystems); _systems.Add(new UserCmdPostExecuteSystem()); _handler = handler; int count = _systems.Count; _systemsPool = new List <IUserCmdExecuteSystem> [threadCount]; InitTask(threadCount, count); _mainThread = new WorkThread("Main", _systems); WorkThread[] slaveThreads = new WorkThread[threadCount]; for (var i = 0; i < threadCount; i++) { slaveThreads[i] = new WorkThread("Slave", _systemsPool[i]); } _taskDisparcher = new TaskDispatcher(threadCount, _mainThread, slaveThreads, _taskInfos); _mainThread.Name = "MainThread"; _mainThread.SetTaskDisparcher(_taskDisparcher); for (var i = 0; i < threadCount; i++) { slaveThreads[i].SetTaskDisparcher(_taskDisparcher); slaveThreads[i].Name = string.Format("SlaveThreads:{0}", i); } _taskDisparcher.Start(); }
public UserCmdExecuteManagerSystem(IGameModule gameModule, IUserCmdExecuteSystemHandler handler, IGameStateProcessorFactory gameStateProcessorFactory) { _systems = gameModule.UserCmdExecuteSystems; _handler = handler; _gameStateProcessorFactory = gameStateProcessorFactory; _stateProviderPool = gameStateProcessorFactory.GetProviderPool(); _statePool = gameStateProcessorFactory.GetStatePool(); Init(); }
public UserPrePredictionSystem(IGameModule gameModule, IUserPredictionInfoProvider handler, IPredictionInitManager predictionInitManager, IGameStateProcessorFactory gameStateProcessorFactory) { _logger.Info("start"); _predicatoinInfoProvider = handler; _predictionInitManager = predictionInitManager; _gameStateProcessorFactory = gameStateProcessorFactory; _stateProviderPool = gameStateProcessorFactory.GetProviderPool(); _statePool = gameStateProcessorFactory.GetStatePool(); _systems = gameModule.BeforeUserCmdExecuteSystems; Init(); }
public static void InitFiltedInput(PlayerEntity player, IGameStateProcessorFactory gameStateProcessorFactory) { var stateProviderPool = gameStateProcessorFactory.GetProviderPool() as StateProviderPool; var statePool = gameStateProcessorFactory.GetStatePool(); if (null != stateProviderPool) { stateProviderPool.AddStateProvider(player, statePool); } else { Logger.Error("state provider pool is null !!"); } var gameInputProcessor = new GameInputProcessor(new UserCommandMapper(), new StateProvider(new PlayerStateAdapter(player), statePool), new FilteredInput()); player.AddUserCmdFilter(gameInputProcessor); }
public UserCmdPreExecuteSystem(IGameStateProcessorFactory gameStateProcessorFactory ) { _gameStateProcessorFactory = gameStateProcessorFactory; _stateProviderPool = gameStateProcessorFactory.GetProviderPool(); }