Example #1
0
        public static async ETTask LoadAsync(this ConfigComponent self)
        {
            self.AllConfig.Clear();
            List <Type> types = Game.EventSystem.GetTypes(typeof(ConfigAttribute));

            Dictionary <string, byte[]> configBytes = new Dictionary <string, byte[]>();

            self.ConfigLoader.GetAllConfigBytes(configBytes);

            using (ListComponent <Task> listTasks = ListComponent <Task> .Create())
            {
                foreach (Type type in types)
                {
                    Task task = Task.Run(() => self.LoadOneInThread(type, configBytes));
                    listTasks.Add(task);
                }

                await Task.WhenAll(listTasks.ToArray());
            }
        }