using System.Collections.Generic;
using BM;
using UnityEngine;

namespace ET
{
    public class ConfigLoader: IConfigLoader
    {
        public void GetAllConfigBytes(Dictionary<string, byte[]> output)
        {
            for (int i = 0; i < AllCategoryConfig.configNames.Length; i++)
            {
                string configName = AllCategoryConfig.configNames[i];
                byte[] data = GetOneConfigBytes(configName);
                output.Add(configName, data);
            }
        }

        public byte[] GetOneConfigBytes(string configName)
        {
            TextAsset asset = AssetComponent.Load<TextAsset>("Assets/Bundles/Config/" + configName + ".bytes");
            byte[] data = asset.bytes;
            AssetComponent.UnLoadByPath("Assets/Bundles/Config/" + configName + "/.bytes");
            return data;
        }
    }
}