public ClientMainFeature(string name, IGameModule topLevelGameModule, ISyncLatestManager syncLatestManager, IPlaybackManager playbackManager, IPredictionInitManager userPredictionInitManager, IUserPredictionInfoProvider predicatoinInfoProvider, ISimulationTimer simulationTimer, IVehicleCmdExecuteSystemHandler vehicleCmdExecuteSystemHandler, IVehicleExecutionSelector vehicleExecutionSelector, ICommonSessionObjects commonSessionObjects) : base(name) { topLevelGameModule.Init(); Add(new ModuleInitSystem(topLevelGameModule, commonSessionObjects.AssetManager)); Add(new EntityCreateSystem(topLevelGameModule).WithExecFrameStep(EEcecuteStep.NormalFrameStep)); Add(new SyncLatestSystem(syncLatestManager).WithExecFrameStep(EEcecuteStep.NormalFrameStep)); if (!SharedConfig.IsOffline) { Add(new PlaybackInitSystem(playbackManager).WithExecFrameStep(EEcecuteStep.NormalFrameStep)); } Add(new PlaybackSystem(topLevelGameModule).WithExecFrameStep(EEcecuteStep.NormalFrameStep)); //添加游戏状态更新处理 Add(new GameStateUpdateSystem(topLevelGameModule).WithExecFrameStep(EEcecuteStep.NormalFrameStep)); // 需要在playback之后,因为要根据车的位置更新人的位置 // 要在predicte之前,因为要根据车的位置,更像摄像机位置 Add(new PhysicsInitSystem(topLevelGameModule).WithExecFrameStep(EEcecuteStep.CmdFrameStep)); Add(new PhysicsUpdateSystem(topLevelGameModule).WithExecFrameStep(EEcecuteStep.CmdFrameStep)); Add(new VehicleCmdExecuteManagerSystem(vehicleExecutionSelector, topLevelGameModule, vehicleCmdExecuteSystemHandler, simulationTimer, false, SharedConfig.ServerAuthorative).WithExecFrameStep(EEcecuteStep.CmdFrameStep)); Add(new UserPrePredictionSystem(topLevelGameModule, predicatoinInfoProvider, userPredictionInitManager).WithExecFrameStep(EEcecuteStep.NormalFrameStep)); //每帧执行的cmd要放在回滚之前,不然会导致多执行帧 Add(new PhysicsPostUpdateSystem(topLevelGameModule).WithExecFrameStep(EEcecuteStep.CmdFrameStep)); Add(new PredictionInitSystem(userPredictionInitManager).WithExecFrameStep(EEcecuteStep.CmdFrameStep)); Add(new UserPredictionSystem(topLevelGameModule, predicatoinInfoProvider, userPredictionInitManager).WithExecFrameStep(EEcecuteStep.CmdFrameStep)); Add(new ResourceLoadSystem(topLevelGameModule, commonSessionObjects.AssetManager).WithExecFrameStep(EEcecuteStep.NormalFrameStep)); Add(new GamePlaySystem(topLevelGameModule).WithExecFrameStep(EEcecuteStep.CmdFrameStep)); Add(new RenderSystem(topLevelGameModule).WithExecFrameStep(EEcecuteStep.NormalFrameStep)); Add(new UiSystem(topLevelGameModule).WithExecFrameStep(EEcecuteStep.UIFrameStep)); Add(new UiHfrSystem(topLevelGameModule).WithExecFrameStep(EEcecuteStep.NormalFrameStep)); Add(new CommonLifeTimeSystem(commonSessionObjects.GameContexts).WithExecFrameStep(EEcecuteStep.NormalFrameStep)); Add(new CommoTickImmutabblitySystem(commonSessionObjects.GameContexts).WithExecFrameStep(EEcecuteStep.NormalFrameStep)); Add(new EntityCleanUpSystem(topLevelGameModule).WithExecFrameStep(EEcecuteStep.NormalFrameStep)); Add(new CommonDestroySystem(commonSessionObjects).WithExecFrameStep(EEcecuteStep.NormalFrameStep)); }
public override Systems CreateUpdateSystems(IContexts contexts) { if (Camera.main == null) { throw new Exception("Camera.main is null"); } Contexts _contexts = (Contexts)contexts; _gameModule = GameModuleFactory.CreateCompositeGameModule(_contexts); var sessionObjects = _contexts.session.clientSessionObjects; ISyncLatestManager syncLatestManager = sessionObjects.SyncLatestManager; IPlaybackManager playbackManager = sessionObjects.PlaybackManager; IPredictionInitManager predictionInitManager = sessionObjects.UserPredictionInitManager; IUserPredictionInfoProvider predicatoinInfoProvider = sessionObjects.UserPredictionInfoProvider; ISimulationTimer simulationTimer = sessionObjects.SimulationTimer; var systems = new Feature("LoginSuccState"); systems.Add(new InputCollectSystem(_contexts).WithExecFrameStep(EEcecuteStep.NormalFrameStep)); systems.Add(new MouseLockSystem(_contexts)); systems.Add(new DriveTimeSystem(_contexts).WithExecFrameStep(EEcecuteStep.NormalFrameStep)); systems.Add(new ClientFreeCmdGenerateSystem(_contexts).WithExecFrameStep(EEcecuteStep.NormalFrameStep)); systems.Add(new UserCmdCollectSystem(_contexts).WithExecFrameStep(EEcecuteStep.NormalFrameStep)); // systems.Add(new ClientCameraPreUpdateSystem(_contexts.vehicle, _contexts.freeMove,_contexts.player, motors).WithExecFrameStep(EEcecuteStep.NormalFrameStep)); systems.Add(new PlayerInterceptCmdSystem(_contexts).WithExecFrameStep(EEcecuteStep.NormalFrameStep)); systems.Add(new UserCmdMergeSystem(_contexts).WithExecFrameStep(EEcecuteStep.CmdFrameStep)); //Test systems.Add(new TerrainTestSystem(_contexts)); ////// systems.Add(new AutoTerrainNavigatorSystem(_contexts)); systems.Add(new MinRendererSetSystem(_contexts)); systems.Add(new WoodConflictSystem(_contexts)); systems.Add(new ClientMainFeature( "LoginSuccSystems", _gameModule, syncLatestManager, playbackManager, predictionInitManager, predicatoinInfoProvider, simulationTimer, sessionObjects.VehicleCmdExecuteSystemHandler, new ClientVehicleExecutionSelector(_contexts), _contexts.session.commonSession)); /*车辆命令走老流程*/ systems.Add(new UserCmdSendSystem(_contexts).WithExecFrameStep(EEcecuteStep.CmdFrameStep)); /*用户的命令*/ systems.Add(new UserCmdUpdateSystem(_contexts).WithExecFrameStep(EEcecuteStep.CmdFrameStep)); return(systems); }
public UserPrePredictionSystem(IGameModule gameModule, IUserPredictionInfoProvider handler, IPredictionInitManager predictionInitManager) { _logger.Info("start"); _predicatoinInfoProvider = handler; _predictionInitManager = predictionInitManager; //_gameStateProcessorFactory = gameStateProcessorFactory; //_stateProviderPool = gameStateProcessorFactory.GetProviderPool(); //_playerStateMap = gameStateProcessorFactory.GetStatePool(); _systems = gameModule.BeforeUserCmdExecuteSystems; Init(); }
public UserPredictionSystem(IGameModule gameModule, IPredictionExecuteInfoProvider handler, IPredictionInitManager predictionInitManager, IGameStateProcessorFactory gameStateProcessorFactory) { _logger.Info("start"); _predicatoinInfoProvider = handler; _predictionInitManager = predictionInitManager; _systems = gameModule.UserCmdExecuteSystems; _gameStateProcessorFactory = gameStateProcessorFactory; _stateProviderPool = gameStateProcessorFactory.GetProviderPool(); _statePool = gameStateProcessorFactory.GetStatePool(); Init(); }
public PredictionInitSystem(IPredictionInitManager predictionInitManager) { _predictionInitManager = predictionInitManager; }