Esempio n. 1
0
    private static void DownloadFinished()
    {
        FuseSDKPrefs.DownloadType dlType = (FuseSDKPrefs.DownloadType)EditorPrefs.GetInt(AUTODOWNLOAD_KEY, 1);

        bool importNow = true;

        if (dlType == FuseSDKPrefs.DownloadType.AutoDownloadAndPromptForImport)
        {
            importNow = EditorUtility.DisplayDialog("Fuse SDK Update", "Do you want to import the new SDK now?", "Yes", "No");
        }

        if (_DoNotImport || !importNow || dlType == FuseSDKPrefs.DownloadType.AutoDownloadOnly)
        {
            _DoNotImport = false;

            string path = System.IO.Path.GetFullPath(Application.dataPath + "/.." + SAVED_PACKAGE_NAME);
            try
            {
                System.IO.File.Copy(Application.temporaryCachePath + TEMP_PACKAGE_NAME, path, true);
                Debug.Log("Fuse SDK: New SDK package saved to " + path);
            }
            catch
            {
                Debug.LogError("Fuse SDK: Error while copying package to " + path);
            }
        }
        else
        {
            try
            {
                Debug.Log("Fuse SDK: Download finished. Importing Package...");
                var icon = System.IO.File.ReadAllBytes(Application.dataPath + FuseSDKEditor.ICON_PATH);
                AssetDatabase.ImportPackage(Application.temporaryCachePath + TEMP_PACKAGE_NAME, false);
                System.IO.File.WriteAllBytes(Application.dataPath + FuseSDKEditor.ICON_PATH, icon);
                Debug.Log("Fuse SDK: Import finished. Update successful");

                if (Application.platform == RuntimePlatform.Android)
                {
                    FuseSDKEditor.UpdateAndroidManifest();
                }
            }
            catch
            {
                Debug.LogError("Fuse SDK: Error while importing package.");
            }
        }

        try
        {
            System.IO.File.Delete(Application.temporaryCachePath + TEMP_PACKAGE_NAME);
        }
        catch
        {
            Debug.LogError("Fuse SDK: Error while deleting temp file " + Application.temporaryCachePath + TEMP_PACKAGE_NAME);
        }
    }
Esempio n. 2
0
    private static void Update()
    {
        //Wait 1 frame before checking for update to make sure Unity loaded
        if (--_delay < 0)
        {
            FuseSDKEditor.CheckForAnnouncements();

            if (EditorPrefs.GetInt(AUTOUPDATE_KEY, 4) >= 0)
            {
                CheckForUpdates();
            }
        }
    }