private static GLDDownloadConfig LoadDownLoadConfig() { string path = DownloadConfigPath(); string json = File.ReadAllText(path); GLDDownloadConfig config = JsonUtility.FromJson <GLDDownloadConfig>(json); return(config); }
public static void DownloadConfig <T>() where T : CsvDataParser, new() { m_parser = new T(); GLDDownloadConfig downloadConfig = LoadDownLoadConfig(); EditorCoroutineRunner.StartEditorCoroutine(DownloadGoogleSheet(downloadConfig)); }
private static IEnumerator DownloadGoogleSheet(GLDDownloadConfig config) { if (config != null && config.downLoadList.Count > 0) { for (int i = 0; i < config.downLoadList.Count; i++) { GLDDownloadData data = config.downLoadList[i]; if (data != null) { yield return(DownloadGoogleSheet(data)); } } } m_parser = null; AssetDatabase.Refresh(); }
public static void CreateTemplateDownloadConfig() { GLDDownloadConfig config = new GLDDownloadConfig(); GLDDownloadData data = new GLDDownloadData(); data.name = "template"; data.jsonPath = Path.Combine(Application.dataPath, "template.json"); data.csPath = Path.Combine(Application.dataPath, "template.cs"); data.url = "tempalte url"; config.downLoadList.Add(data); try { string path = DownloadConfigPath(); string json = JsonUtility.ToJson(config, true); File.WriteAllText(path, json); } catch (Exception e) { Debug.LogError(e); } }