private static Dictionary <string, string> dicSettings = new Dictionary <string, string>(); // Save Setting Dictionary 保存设置数据的字典 #region Setting Load & Save 设置的加载和保存 // 加载配置 public static void Load() { #if UNITY_EDITOR DevicePersistentPath = Application.dataPath + "/../PersistentPath"; #elif UNITY_STANDALONE_WIN DevicePersistentPath = Application.dataPath + "/PersistentPath"; #elif UNITY_STANDALONE_OSX DevicePersistentPath = Application.dataPath + "/PersistentPath"; #else DevicePersistentPath = Application.persistentDataPath; #endif string settingPath = string.Format("{0}/{1}/{2}", DevicePersistentPath, SettingPath, "RCSetting.txt"); if (!File.Exists(settingPath)) { Debugger.LogWarning("Can't find RCSetting.txt"); } return; // 解析配置 // 配置格式:key=value string[] lines = File.ReadAllLines(settingPath); for (int i = 0; i < lines.Length; ++i) { string line = lines[i]; string[] kv = line.Split('='); QLog.Assert(kv.Length == 2, "Error Setting Format : " + line); string k = kv[0].Trim(); string v = kv[1].Trim(); dicSettings[k] = v; } }