internal static string GetDirPath(System.Type t) { var attr = ConfigLoader.GetConfigAttribute(t); string path = string.Format("{0}/{1}", UTIL_DIR, attr.filename); if (!System.IO.Directory.Exists(path)) { System.IO.Directory.CreateDirectory(path); } return(path); }
internal static List <TypeAndAttr> GetTypeList() { List <TypeAndAttr> list = new List <TypeAndAttr>(); var domain = System.AppDomain.CurrentDomain; foreach (var asm in domain.GetAssemblies()) { var types = asm.GetTypes(); foreach (var type in types) { var customAttr = ConfigLoader.GetConfigAttribute(type); if (customAttr == null) { continue; } list.Add(new TypeAndAttr(type, customAttr)); } } return(list); }
public static void SaveDataToStreamingAssets(object obj) { System.Type type = obj.GetType(); var customAttr = ConfigLoader.GetConfigAttribute(type); if (customAttr == null) { return; } string path = ConfigLoader.GetConfigDataPath(customAttr); if (System.IO.File.Exists(path)) { bool res = EditorUtility.DisplayDialog("Overwrite?", "File is already exist.Overwrite?", "ok", "cancel"); if (!res) { return; } } string json = JsonUtility.ToJson(obj); System.IO.File.WriteAllText(path, json); }