yyl
2025-05-23 0eea7395cb35402248d0707be44bbfedea75e5f6
Main/Config/ConfigBase.cs
@@ -1,12 +1,15 @@
using System.Collections.Generic;
using UnityEngine;
using Cysharp.Threading.Tasks;
using System.IO;
using System;
public class ConfigBase<U, T> where T : ConfigBase<U, T>, new()
{
    public static Dictionary<U, T> dic = new Dictionary<U, T>();
    protected static bool isInit = false;
    public static bool isInit = false;
    public static T Get(U id)
    {
@@ -49,6 +52,8 @@
    public static void Init(string[] lines)
    {
        dic.Clear();
        Dictionary<string, string> rawDatas = new Dictionary<string, string>();
        for (int i = 3; i < lines.Length; i++)
@@ -64,7 +69,19 @@
            T config = new T();
            U key = config.LoadKey(strKey);
            config.LoadConfig(line);
            #if UNITY_EDITOR
            try
            {
            #endif
            dic.Add(key, config);
            #if UNITY_EDITOR
            }
            catch (ArgumentException exception)
            {
                Debug.LogError(typeof(T).Name  + " 重复的key " + key + " " + exception.Message);
            }
            #endif
        }
        isInit = true;