Esempio n. 1
0
        public static void Load(this ConfigComponent self)
        {
            self.AllConfig.Clear();
            HashSet <Type> types = Game.EventSystem.GetTypes(typeof(ConfigAttribute));

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

            ConfigComponent.GetAllConfigBytes(types, configBytes);

            foreach (Type type in types)
            {
                self.LoadOneInThread(type, configBytes);
            }
        }
Esempio n. 2
0
        public static async ETTask LoadAsync(this ConfigComponent self)
        {
            self.AllConfig.Clear();
            HashSet <Type> types = Game.EventSystem.GetTypes(typeof(ConfigAttribute));

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

            ConfigComponent.GetAllConfigBytes(types, configBytes);

            List <Task> listTasks = new List <Task>();

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

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