private static string GetDefaultPath(EEditorPath type) { string path = string.Empty; switch (type) { case EEditorPath.LocalTableProtoClassPath: path = Application.dataPath + "/Scripts/Proto/Table/"; break; case EEditorPath.LocalServerProtoClassPath: path = Application.dataPath + "/Scripts/Proto/Server/"; break; case EEditorPath.LocalServerProtoFunctionPath: path = Application.dataPath + "/Scripts/Proto/ServerGen/"; break; case EEditorPath.ClientLoadRootPath: path = System.Text.RegularExpressions.Regex.Replace(Application.dataPath, "Client/(\\w+)/" + URL.LocalProjectName + "/Assets", "Data/$1/Normal/"); break; case EEditorPath.LocalResourcesLoadPath: path = System.Text.RegularExpressions.Regex.Replace(Application.dataPath, "Client/(\\w+)/" + URL.LocalProjectName + "/Assets", "Data/$1/Normal/android/"); break; case EEditorPath.LocalTableProtoPath: path = System.Text.RegularExpressions.Regex.Replace(Application.dataPath, "Client/(\\w+)/" + URL.LocalProjectName + "/Assets", "Data/$1/Normal/proto-table/"); break; case EEditorPath.LocalServerProtoPath: path = System.Text.RegularExpressions.Regex.Replace(Application.dataPath, "Client/(\\w+)/" + URL.LocalProjectName + "/Assets", "Data/$1/Normal/proto-server/"); break; case EEditorPath.LocalServerProtoXMLPath: path = System.Text.RegularExpressions.Regex.Replace(Application.dataPath, "Client/(\\w+)/" + URL.LocalProjectName + "/Assets", "Data/$1/Normal/proto-server-xml/"); break; case EEditorPath.LocalTablePath: path = System.Text.RegularExpressions.Regex.Replace(Application.dataPath, "Client/(\\w+)/" + URL.LocalProjectName + "/Assets", "Data/$1/Normal/table/"); break; case EEditorPath.LocalTableBytesPath: path = System.Text.RegularExpressions.Regex.Replace(Application.dataPath, "Client/(\\w+)/" + URL.LocalProjectName + "/Assets", "Data/$1/Normal/android/table/"); break; case EEditorPath.LuaPath: path = URL.LocalProjectPath+ "/luaRes/"; break; } return path; }
private static void AddPath(EEditorPath type) { string path = PlayerPrefs.GetString(GetKeyPath(type)); if (string.IsNullOrEmpty(path)) { path = GetDefaultPath(type); } pathDic[type] = path; PlayerPrefs.SetString(GetKeyPath(type), path); }
public CSEditorPath(EEditorPath _type, string desc) { this.type = _type; this.desc = desc; this.defaultValue = GetPath(_type); txt = PlayerPrefs.GetString(Key); if (string.IsNullOrEmpty(txt)) { txt = this.defaultValue; } }
public static string GetPath(EEditorPath type) { if (pathDic.Count == 0) { InitPath(); } string path = string.Empty; if (pathDic.TryGetValue(type, out path)) { } return path; }
public static void SavePath(EEditorPath type, string path) { if (pathDic.ContainsKey(type)) { pathDic[type] = path; } else { pathDic.Add(type, path); } PlayerPrefs.SetString(CSEditorPath.GetKeyPath(type), path); }
public static string GetKeyPath(EEditorPath _type) { return AppLocationName + keySpit + _type.ToString(); }
/// <summary> /// 得到保存的路径 /// </summary> /// <param name="_type"></param> /// <returns></returns> public static string Get(EEditorPath _type) { InitPath(); return pathDic[_type]; //return PlayerPrefs.GetString(GetKeyPath(_type)); }