Esempio n. 1
0
        private static void UpdateSDK(Boolean silentMode)
        {
            string lastVersion = GameSparksRestApi.GetLastVersion();

            if (lastVersion != null)
            {
                Debug.Log("Latest version available: " + lastVersion);

                if (GameSparksRestApi.CompareCurrentWithLastVersion(GameSparks.Core.GS.Version, lastVersion))
                {
                    if (EditorUtility.DisplayDialog("GameSparks SDK", "There is a new SDK available.\nUpdate to the latest version now.", "OK"))
                    {
                        Debug.Log("Updating GameSparks SDK from " + GameSparks.Core.GS.Version + " to " + lastVersion + " version");

                        if (GameSparksRestApi.UpdateSDK(lastVersion))
                        {
                            Debug.Log("Updated GameSparks SDK!");

                            Application.OpenURL("https://docs2.gamesparks.com/sdk-center/unity.html?utm_source=Unity%20SDK&utm_campaign=Unity%20Asset%20Store&utm_medium=Unity%20Editor");
                        }
                    }
                }
                else
                {
                    if (!silentMode)
                    {
                        EditorUtility.DisplayDialog("GameSparks SDK", "The SDK is already up to date.", "OK");
                    }
                }
            }
            else
            {
                if (!silentMode)
                {
                    EditorUtility.DisplayDialog("GameSparks SDK", "Error occured during getting last version!", "OK");
                }
            }
        }
        private static void UpdateSDK(Boolean silentMode)
        {
            string lastVersion = GameSparksRestApi.GetLastVersion();

            if (lastVersion != null)
            {
                Debug.Log("Latest version available: " + lastVersion);

                if (GameSparksRestApi.CompareCurrentWithLastVersion(GameSparks.Core.GS.Version, lastVersion))
                {
                    if (EditorUtility.DisplayDialog("GameSparks SDK", "There is a new available SDK.\nWould you like to update it?", "Yes", "No"))
                    {
                        Debug.Log("Updating GameSparks SDK from " + GameSparks.Core.GS.Version + " to " + lastVersion + " version");

                        if (GameSparksRestApi.UpdateSDK(lastVersion))
                        {
                            Debug.Log("Updated GameSparks SDK!");
                        }
                    }
                }
                else
                {
                    if (!silentMode)
                    {
                        EditorUtility.DisplayDialog("GameSparks SDK", "Sorry, there is any new available SDK.", "OK");
                    }
                }
            }
            else
            {
                if (!silentMode)
                {
                    EditorUtility.DisplayDialog("GameSparks SDK", "Error occured during getting last version!", "OK");
                }
            }
        }