yyl
2025-06-23 4fde46699701b1a8b74b4dab516624852b24a86d
Main/Config/ConfigBase.cs
@@ -32,7 +32,20 @@
        ConfigManager.Instance.LoadConfigByType(typeof(T));
    }
    public List<T> GetValues()
    public static List<U> GetKeys()
    {
        if (!isInit)
        {
            Debug.LogError(typeof(U).Name + " 没有初始化 GetKeys");
            return null; // 或者抛出异常,视情况而定
        }
        List<U> result = new List<U>();
        result.AddRange(dic.Keys);
        return result;
    }
    public static List<T> GetValues()
    {
        if (!isInit)
        {
@@ -72,6 +85,7 @@
            T config = new T();
            U key = config.LoadKey(strKey);
            config.LoadConfig(line);
            config.OnConfigParseCompleted();
            #if UNITY_EDITOR
            try
            {
@@ -84,7 +98,11 @@
                Debug.LogError(typeof(T).Name  + " 重复的key " + key + " " + exception.Message);
            }
            #endif
        }
        foreach (var cfg in dic.Values)
        {
            cfg.AllConfigLoadFinish();
        }
        isInit = true;
@@ -95,10 +113,20 @@
        return default(U);
    }
    protected virtual void AllConfigLoadFinish()
    {
    }
    public virtual void LoadConfig(string line)
    {
        
    }
    protected virtual void OnConfigParseCompleted()
    {
    }
    
    protected int ParseInt(string str)
    {