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 VehicleCmdExecuteManagerSystem(IVehicleExecutionSelector vehicleSelector, IGameModule gameModule, IVehicleCmdExecuteSystemHandler handler, ISimulationTimer simulationTimer, bool isServer, bool serverAuthorative) { _systems = gameModule.VehicleCmdExecuteSystems; _handler = handler; _simulationTimer = simulationTimer; _vehicleSelector = vehicleSelector; _isServer = isServer; _serverAuthorative = serverAuthorative; _profiler = CustomProfilerFactory.CreateProfiler(this); Init(); }
public ServerMainFeature( string name, IGameModule topLevelGameModule, IUserCmdExecuteSystemHandler userCmdExecuteSystemHandler, IVehicleCmdExecuteSystemHandler vehicleCmdExecuteSystemHandler, ISimulationTimer simluationTimer, IVehicleExecutionSelector vehicleExecutionSelector, ICommonSessionObjects sessionObjects, IRoom room) : base(name) { topLevelGameModule.Init(); Add(new ModuleInitSystem(topLevelGameModule, sessionObjects.LoadRequestManager)); Add(new EntityCreateSystem(topLevelGameModule)); Add(new GameStateUpdateSystem(topLevelGameModule)); Add(new PhysicsInitSystem(topLevelGameModule)); Add(new PhysicsUpdateSystem(topLevelGameModule)); Add(new VehicleCmdExecuteManagerSystem(vehicleExecutionSelector, topLevelGameModule, vehicleCmdExecuteSystemHandler, simluationTimer, true, SharedConfig.ServerAuthorative)); Add(new PhysicsPostUpdateSystem(topLevelGameModule)); #if (true) // Add(new UserCmdExecuteManagerSystem(topLevelGameModule, // userCmdExecuteSystemHandler, // sessionObjects.GameStateProcessorFactory)); Add(new UserCmdUpdateMsgExecuteManagerSystem(topLevelGameModule, userCmdExecuteSystemHandler, new SyncUpdateLatestMsgHandler())); #else Add(new UserCmdParallelExecuteManagerSystem(topLevelGameModule, userCmdExecuteSystemHandler, sessionObjects.GameStateProcessorFactory, 4)); #endif Add(new LoadRequestManagerSystem(sessionObjects)); Add(new ResourceLoadSystem(topLevelGameModule, sessionObjects.LoadRequestManager)); Add(new GamePlaySystem(topLevelGameModule)); Add(new CommonLifeTimeSystem(sessionObjects.GameContexts)); Add(new EntityCleanUpSystem(topLevelGameModule)); Add(new CommonDestroySystem(sessionObjects)); Add(new FreeGameRuleSystem(room)); Add(new SendSnapshotSystem(room)); Add(new CompensationSnapshotSystem(room)); }