////////////////////////////////////////////////////////////////////////// static public void UpdateCheckVersion() { if (wwwVersionCheck.isDone) { EditorApplication.update -= UpdateCheckVersion; // Call Found Latest Version #if UNITY_2018_3_OR_NEWER string resultText = wwwVersionCheck.downloadHandler.text; #else string resultText = wwwVersionCheck.text; #endif if (!string.IsNullOrEmpty(resultText) && resultText.StartsWith("VERSION")) { int index = resultText.IndexOf("\n", 0); string latestVersionString = resultText.Substring(8, index - 8); string latestVersionRaw = latestVersionString; // Remove any dots except the first one int firstDot = latestVersionString.IndexOf('.'); int lastDot = latestVersionString.LastIndexOf('.'); while (lastDot > firstDot) { latestVersionString = latestVersionString.Remove(lastDot, 1); lastDot = latestVersionString.LastIndexOf('.'); } //Debug.Log("[Accessibility] Version check returned: Latest Version: " + latestVersionRaw + " Your Version: " + UAP_AccessibilityManager.PluginVersion); float latestVersion = UAP_AccessibilityManager.PluginVersionAsFloat; if (float.TryParse(latestVersionString, out latestVersion)) { // Check whether this version is supposed to be skipped if (!automaticCheck || ignoreVersion.CompareTo(latestVersionRaw) != 0) { // The window isn't open yet if (automaticCheck) { UAP_UpdateWindow.Init(); } FoundLatestVersion(latestVersion, latestVersionRaw, resultText); } } } else { if (!automaticCheck) { UAP_UpdateWindow.NoInternet(); } //Debug.LogError("[Accessibility] Could not check for updates, because the online version check URL could not be reached."); } ignoreVersion = ""; automaticCheck = false; VersionCheckRunning = false; wwwVersionCheck = null; } }
////////////////////////////////////////////////////////////////////////// static public void Init() { // Get existing open window or if none, make a new one: UAP_UpdateWindow window = (UAP_UpdateWindow)EditorWindow.GetWindow(typeof(UAP_UpdateWindow)); window.titleContent.text = "UAP Update"; window.position = new Rect(50 + 0, 50 + 0, 400, 285); window.Show(); }
static public void FoundLatestVersion(float latestVersion, string latestVersionAsString, string fullChangeLog) { // Display a window with result UAP_UpdateWindow.VersionCheckComplete((latestVersion > UAP_AccessibilityManager.PluginVersionAsFloat), latestVersionAsString, fullChangeLog); /* * if (latestVersion > UAP_AccessibilityManager.PluginVersionAsFloat) * { * // TODO: Offer download link to the store * // TODO: Give the option to be reminded again in a day, or skip this version * Debug.Log("You might want to update your plugin"); * } * else * Debug.Log("UAP is up to date"); */ }
static public void CheckForUpdate() { if (VersionCheckRunning) { return; } VersionCheckRunning = true; wwwVersionCheck = new WWW(versionURL); UAP_UpdateWindow.StartVersionCheck(); if (!automaticCheck) { UAP_UpdateWindow.Init(); } EditorApplication.update += UpdateCheckVersion; }
static public void CheckForUpdate() { if (VersionCheckRunning) { return; } VersionCheckRunning = true; #if UNITY_2018_3_OR_NEWER wwwVersionCheck = new UnityWebRequest(versionURL); wwwVersionCheck.downloadHandler = new DownloadHandlerBuffer(); wwwVersionCheck.SendWebRequest(); #else wwwVersionCheck = new WWW(versionURL); #endif UAP_UpdateWindow.StartVersionCheck(); if (!automaticCheck) { UAP_UpdateWindow.Init(); } EditorApplication.update += UpdateCheckVersion; }