void OnGUI() { titleContent = new GUIContent("Tapsell", "Tapsell Unity SDK Update"); GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); GUILayout.Label(TapsellEditor.tapsellLogo); GUILayout.Label("Version: " + TapsellSettings.getPluginVersion()); GUILayout.EndVertical(); GUILayout.BeginVertical(); GUILayout.Label("A new version of the Tapsell Unity SDK is available"); EditorGUILayout.Space(); GUILayout.Label("Current version: " + TapsellSettings.getPluginVersion()); GUILayout.Label("Latest version: " + TapsellSettings.getLatestPluginVersion()); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); GUILayout.Label("You can download the latest version from the Tapsell answers page.", EditorStyles.wordWrappedMiniLabel, GUILayout.MaxWidth(380)); EditorGUILayout.Space(); GUILayout.BeginHorizontal(); if (GUILayout.Button(new GUIContent("Download & Docs (FA)", "Open the SDK docs webpage (Farsi)"), GUILayout.MaxWidth(150))) { Application.OpenURL("https://answers.tapsell.ir/?page_id=746"); } if (GUILayout.Button(new GUIContent("Download & Docs (EN)", "Open the SDK docs webpage (English)"), GUILayout.MaxWidth(150))) { Application.OpenURL("https://answers.tapsell.ir/?page_id=968&lang=en"); } if (GUILayout.Button(new GUIContent("Close", "Skip this version."), GUILayout.MaxWidth(60))) { EditorPrefs.SetString("ga_skip_version" + "-" + Application.dataPath, "New Version"); Close(); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); }
static IEnumerator CheckTapsellUpdate(WWW wwwUpdate) { yield return(wwwUpdate); JSONNode node = JSONNode.Parse(wwwUpdate.text); string latestVersion = null; if (node != null) { string pluginVersion = node ["pluginVersion"].Value; //string androidSDKVersion = node ["androidSDKVersion"].Value; //string iosSDKVersion = node ["iosSDKVersion"].Value; //Debug.Log ("Plugin version: "+pluginVersion); TapsellSettings.setLatestPluginVersion(pluginVersion); latestVersion = pluginVersion; } else { latestVersion = TapsellSettings.getLatestPluginVersion(); } if (latestVersion != null) { bool newVersionAvailable = false; bool versionsAreEqual = true; string currentVersion = TapsellSettings.getPluginVersion(); string[] pluginVersions = currentVersion.Split(new string[] { "." }, System.StringSplitOptions.None); string[] latestVersions = latestVersion.Split(new string[] { "." }, System.StringSplitOptions.None); for (int i = 0; i < pluginVersions.Length && i < latestVersions.Length; i++) { try { int newV = int.Parse(latestVersions[i]); int curV = int.Parse(pluginVersions[i]); if (newV > curV) { newVersionAvailable = true; } if (newV != curV) { versionsAreEqual = false; } } catch { versionsAreEqual = false; } } if (versionsAreEqual && currentVersion.Length < latestVersion.Length) { newVersionAvailable = true; } if (newVersionAvailable) { TapsellUpdateWindow window = (TapsellUpdateWindow)EditorWindow.GetWindow(typeof(TapsellUpdateWindow)); window.ShowPopup(); } } }