コード例 #1
0
        public async UniTask <GlobalStateMap> SaveGlobalStateAsync()
        {
            SaveAllServicesToState <IStatefulService <GlobalStateMap>, GlobalStateMap>(GlobalState);
            await GlobalStateSlotManager.SaveAsync(Configuration.DefaultGlobalSlotId, GlobalState);

            return(GlobalState);
        }
コード例 #2
0
        private async UniTask <GlobalStateMap> LoadGlobalStateAsync()
        {
            var stateData = await GlobalStateSlotManager.LoadOrDefaultAsync(Configuration.DefaultGlobalSlotId);

            await LoadAllServicesFromStateAsync <IStatefulService <GlobalStateMap>, GlobalStateMap>(stateData);

            return(stateData);
        }
コード例 #3
0
        public StateManager(StateConfiguration config, EngineConfiguration engineConfig, InputManager inputManager)
        {
            this.config       = config;
            this.inputManager = inputManager;

            var allowUserRollback = config.StateRollbackMode == StateRollbackMode.Full || (config.StateRollbackMode == StateRollbackMode.Debug && Debug.isDebugBuild);
            var rollbackCapacity  = allowUserRollback ? Mathf.Max(1, config.StateRollbackSteps) : 1; // One step is reserved for game save operations.

            rollbackStateStack = new StateRollbackStack(rollbackCapacity);

            var savesFolderPath = PathUtils.Combine(engineConfig.GeneratedDataPath, config.SaveFolderName);

            GameStateSlotManager   = new GameStateSlotManager(savesFolderPath, config.SaveSlotMask, config.QuickSaveSlotMask, config.SaveSlotLimit, config.QuickSaveSlotLimit, config.BinarySaveFiles);
            GlobalStateSlotManager = new GlobalStateSlotManager(savesFolderPath, config.DefaultGlobalSlotId, config.BinarySaveFiles);
            SettingsSlotManager    = new SettingsSlotManager(engineConfig.GeneratedDataPath, config.DefaultSettingsSlotId, false);
        }