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();
        }
Exemple #2
0
        static IEnumerator CheckTapsellUpdate(WWW wwwUpdate)
        {
            yield return(wwwUpdate);

            JSONNode node = JSONNode.Parse(wwwUpdate.text);
            string   laTapsellTestV3Version = 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.setLaTapsellTestV3PluginVersion(pluginVersion);
                laTapsellTestV3Version = pluginVersion;
            }
            else
            {
                laTapsellTestV3Version = TapsellSettings.getLaTapsellTestV3PluginVersion();
            }

            if (laTapsellTestV3Version != null)
            {
                bool     newVersionAvailable     = false;
                bool     versionsAreEqual        = true;
                string   currentVersion          = TapsellSettings.getPluginVersion();
                string[] pluginVersions          = currentVersion.Split(new string[] { "." }, System.StringSplitOptions.None);
                string[] laTapsellTestV3Versions = laTapsellTestV3Version.Split(new string[] { "." }, System.StringSplitOptions.None);
                for (int i = 0; i < pluginVersions.Length && i < laTapsellTestV3Versions.Length; i++)
                {
                    try {
                        int newV = int.Parse(laTapsellTestV3Versions[i]);
                        int curV = int.Parse(pluginVersions[i]);

                        if (newV > curV)
                        {
                            newVersionAvailable = true;
                        }
                        if (newV != curV)
                        {
                            versionsAreEqual = false;
                        }
                    } catch {
                        versionsAreEqual = false;
                    }
                }
                if (versionsAreEqual && currentVersion.Length < laTapsellTestV3Version.Length)
                {
                    newVersionAvailable = true;
                }

                if (newVersionAvailable)
                {
                    TapsellUpdateWindow window = (TapsellUpdateWindow)EditorWindow.GetWindow(typeof(TapsellUpdateWindow));
                    window.ShowPopup();
                }
            }
        }