Beispiel #1
0
        private async Task <SettingsStateMap> LoadSettingsAsync()
        {
            var settingsData = await SettingsSlotManager.LoadOrDefaultAsync(config.DefaultSettingsSlotId);

            await LoadAllServicesFromStateAsync <IStatefulService <SettingsStateMap>, SettingsStateMap>(settingsData);

            return(settingsData);
        }
Beispiel #2
0
        private async UniTask PerformPostEngineInitializationTasks()
        {
            await LoadSettingsAsync();

            if (!Engine.Initializing)
            {
                return;
            }
            await LoadGlobalAsync();

            if (!Engine.Initializing)
            {
                return;
            }

            if (Configuration.EnableStateRollback)
            {
                InitializeRollback();
            }

            async UniTask LoadSettingsAsync()
            {
                SettingsState = await SettingsSlotManager.LoadOrDefaultAsync(Configuration.DefaultSettingsSlotId);
                await LoadAllServicesFromStateAsync <IStatefulService <SettingsStateMap>, SettingsStateMap>(SettingsState);
            }

            async UniTask LoadGlobalAsync()
            {
                GlobalState = await GlobalSlotManager.LoadOrDefaultAsync(Configuration.DefaultGlobalSlotId);
                await LoadAllServicesFromStateAsync <IStatefulService <GlobalStateMap>, GlobalStateMap>(GlobalState);
            }

            void InitializeRollback()
            {
                scriptPlayer.AddPreExecutionTask(HandleCommandPreExecution);

                rollbackInput = Engine.GetService <IInputManager>().GetRollback();
                if (rollbackInput != null)
                {
                    rollbackInput.OnStart += HandleRollbackInputStart;
                }
            }
        }