void OnGUI() { release = EditorGUILayout.TextField("正式版本号", release); beta = EditorGUILayout.TextField("Beta版本号", beta); if (GUILayout.Button("保存")) { string path = EditorUtility.SaveFilePanel("保存地方", Application.dataPath, "version", "dat"); VersionData data = new VersionData(); data.beta = beta; data.relase = release; FileUtilTool.WriteFile(path, LitJson.JsonMapper.ToJson(data)); } }
void OnLoadVersionList(WWW www) { bool b = string.IsNullOrEmpty(www.error); byte[] data = www.bytes; if (b) { Debug.Log("version.dat --> " + www.text); VersionData vesion_data = null; try { vesion_data = JsonMapper.ToObject <VersionData>(www.text); } catch (System.Exception e) { Debug.LogError(e.ToString()); UIMessageBoxHelper.Show("CDN版本号配置错误,请联系官方", () => { ReStart(); }); } Version cdn_release = new Version(vesion_data.relase); Version cdn_beta = new Version(vesion_data.beta); if (currentResVersion > cdn_beta)//最高版本,程序版本 { newVersion = currentResVersion; } else if (currentResVersion > cdn_release) //beta 先行版本 { newVersion = cdn_beta; } else // 外网版本 { newVersion = cdn_release; } } SuperBoBo.EventManager.Instance.FireEvent(UpdateEvent.Updater_DownloadVersionListDone, null); }