Exemple #1
0
        public virtual async UniTask ResetStateAsync(string[] exclude, params Func <UniTask>[] tasks)
        {
            var serviceTypes = Engine.GetAllServices <IEngineService>().Select(s => s.GetType());
            var excludeTypes = serviceTypes.Where(t => exclude.Contains(t.Name) || t.GetInterfaces().Any(i => exclude.Contains(i.Name))).ToArray();

            await ResetStateAsync(excludeTypes, tasks);
        }
Exemple #2
0
 private async Task LoadAllServicesFromStateAsync <TService, TState> (TState state)
     where TService : class, IStatefulService <TState>
     where TState : StateMap, new()
 {
     foreach (var service in Engine.GetAllServices <TService>())
     {
         await service.LoadServiceStateAsync(state);
     }
 }
 private void SaveAllServicesToState <TService, TState> (TState state)
     where TService : class, IStatefulService <TState>
     where TState : StateMap, new()
 {
     foreach (var service in Engine.GetAllServices <TService>())
     {
         service.SaveServiceState(state);
     }
 }