예제 #1
0
        private void Start()
        {
            Load();
            Controller = new PTController();
#if DEBUG_SYNCHRONIZATION
            Disposable <List <PTTask> > tasks = ListPool <PTTask> .Instance.BorrowDisposable();

            foreach (var group in PTUtils.GetAllTimePairs())
            {
                var task = new SimpleTask(group, group);
                tasks.Value.Add(ParallelTasker.AddTask(group, group, task.OnInitialize, task.Execute, task.OnFinalize));
            }
            StartCoroutine(WaitAndClearTasks(tasks));
#endif
        }
예제 #2
0
        private void Initialize(Func <PTTimePair, T> create)
        {
            var factory = create ?? (pair => default(T));

            foreach (var group in PTUtils.GetAllTimePairs())
            {
                try
                {
                    this[group] = factory(group);
                }
                catch (Exception)
                {
                    PTLogger.Error($"Error while initializing {this} with {group.ToString()}");
                    throw;
                }
            }
        }