public ClientMainFeature(string name, IGameModule topLevelGameModule, SyncLastestManager netSyncManager, PlaybackManager playbackManager, PredictionManager userPredictionManager, AbstractPredictionProvider predicatoinProvider, ISimulationTimer simulationTimer, IVehicleCmdExecuteSystemHandler vehicleCmdExecuteSystemHandler, IVehicleExecutionSelector vehicleExecutionSelector, ICommonSessionObjects commonSessionObjects) : base(name) { topLevelGameModule.Init(); Add(new ModuleInitSystem(topLevelGameModule, commonSessionObjects.AssetManager)); Add(new EntityCreateSystem(topLevelGameModule)); Add(new SyncLatestSystem(netSyncManager)); if (!SharedConfig.IsOffline) { Add(new PlaybackInitSystem(playbackManager)); } Add(new PlaybackExcuteSystem(topLevelGameModule)); //添加游戏状态更新处理 Add(new GameStateUpdateSystem(topLevelGameModule)); // 需要在playback之后,因为要根据车的位置更新人的位置 // 要在predicte之前,因为要根据车的位置,更像摄像机位置 Add(new PhysicsInitSystem(topLevelGameModule)); Add(new PhysicsUpdateSystem(topLevelGameModule)); Add(new VehicleCmdExecuteManagerSystem(vehicleExecutionSelector, topLevelGameModule, vehicleCmdExecuteSystemHandler, simulationTimer, false, SharedConfig.ServerAuthorative)); Add(new PhysicsPostUpdateSystem(topLevelGameModule)); Add(new PredictionCompareSystem(userPredictionManager)); Add(new UserPredictionSystem(topLevelGameModule, predicatoinProvider, userPredictionManager)); Add(new ResourceLoadSystem(topLevelGameModule, commonSessionObjects.AssetManager)); Add(new GamePlaySystem(topLevelGameModule)); Add(new RenderSystem(topLevelGameModule)); Add(new UiSystem(topLevelGameModule).WithExecFrameStep(EEcecuteStep.UIFrameStep)); Add(new UiHfrSystem(topLevelGameModule)); Add(new CommonLifeTimeSystem(commonSessionObjects.GameContexts)); Add(new CommoTickImmutabblitySystem(commonSessionObjects.GameContexts)); Add(new EntityCleanUpSystem(topLevelGameModule)); Add(new CommonDestroySystem(commonSessionObjects)); }
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; SyncLastestManager netSyncManager = sessionObjects.NetSyncManager; PlaybackManager playbackManager = sessionObjects.PlaybackManager; var predictionManager = sessionObjects.UserPredictionManager; var predicatoinProvider = sessionObjects.UserPredictionProvider; ISimulationTimer simulationTimer = sessionObjects.SimulationTimer; var systems = new Feature("LoginSuccState"); systems.Add(new DriveTimeSystem(_contexts)); systems.Add(new PrepareSnapshotPairSystem(_contexts)); systems.Add(new ClientUserCmdFeature("UserCmd", _contexts)); systems.Add(new ClientProfileFeature("Profile", _contexts)); if (SharedConfig.IsReplay) { systems.Add(new UserCmdReplaySystem(_contexts)); systems.Add(new PrepareSnapshotPairSystem(_contexts)); } systems.Add(new ClientMainFeature( "LoginSuccSystems", _gameModule, netSyncManager, playbackManager, predictionManager, predicatoinProvider, 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 SyncLatestSystem(SyncLastestManager netSyncManager) { _logger.Info("start"); _netSyncManager = netSyncManager; }