| | |
| | | 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)
|
| | | {
|
| | |
| | |
|
| | | public static void Init(string[] lines)
|
| | | {
|
| | | dic.Clear();
|
| | | |
| | | Dictionary<string, string> rawDatas = new Dictionary<string, string>();
|
| | |
|
| | | for (int i = 3; i < lines.Length; i++)
|
| | |
| | | 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;
|