private static void Update() { if (!versionChecked) { if (EditorPrefs.HasKey(lastCheckKey)) { string lastCheckTicksString = EditorPrefs.GetString(lastCheckKey); var lastCheckDateTime = new DateTime(Convert.ToInt64(lastCheckTicksString)); if (lastCheckDateTime.AddHours(checkUpdateHours) >= DateTime.UtcNow) { versionChecked = true; return; } } versionResource = (versionResource ?? new WWW(remoteURL + remoteVersionFile)); if (!versionResource.isDone) { return; } versionReceived = (ValidURL(versionResource) ? versionResource.text : ""); versionResource = null; versionChecked = true; EditorPrefs.SetString(lastCheckKey, DateTime.UtcNow.Ticks.ToString()); if (UpdateRequired()) { changelogResource = new WWW(remoteURL + remoteChangelogFile); promptWindow = GetWindow <VRTK_UpdatePrompt>(true); promptWindow.minSize = new Vector2(640, 480); promptWindow.titleContent = new GUIContent("VRTK Update"); } } if (changelogResource != null) { if (!changelogResource.isDone) { return; } changelogReceived = (ValidURL(changelogResource) ? ParseChangelog(changelogResource.text) : ""); changelogResource = null; if (changelogReceived != "") { promptWindow.Repaint(); } } EditorApplication.update -= Update; }
private static void ShowWindow() { if (promptWindow != null) { promptWindow.ShowUtility(); promptWindow.Repaint(); return; } promptWindow = GetWindow <VRTK_UpdatePrompt>(true); promptWindow.titleContent = new GUIContent("VRTK Update"); }
private static void Update() { if (!versionChecked) { versionResource = versionResource ?? new WWW(remoteURL + remoteVersionFile); if (!versionResource.isDone) { return; } versionReceived = ValidURL(versionResource) ? versionResource.text : ""; versionResource = null; versionChecked = true; if (UpdateRequired()) { changelogResource = new WWW(remoteURL + remoteChangelogFile); promptWindow = GetWindow <VRTK_UpdatePrompt>(true); promptWindow.minSize = new Vector2(640, 480); promptWindow.titleContent = new GUIContent("VRTK Update"); } } if (changelogResource != null) { if (!changelogResource.isDone) { return; } changelogReceived = ValidURL(changelogResource) ? ParseChangelog(changelogResource.text) : ""; changelogResource = null; if (changelogReceived != "") { promptWindow.Repaint(); } } EditorApplication.update -= Update; }