示例#1
0
    static void CheckVersion()
    {
        EditorApplication.update -= CheckVersion;

        string localVersion = NoesisVersion.GetCached();
        string version      = NoesisVersion.Get();

        if (localVersion != version && version != "0.0.0")
        {
            if (NoesisVersion.RestartNeeded())
            {
                Debug.LogWarning("Please restart Unity to reload NoesisGUI native plugin!");
                return;
            }

            var window = (NoesisUpdater)ScriptableObject.CreateInstance(typeof(NoesisUpdater));
            window.titleContent  = new GUIContent("NoesisGUI");
            window.position      = new Rect(Screen.currentResolution.width / 2 - 250, Screen.currentResolution.height / 2 - 22, 500, 55);
            window.minSize       = new Vector2(500, 55);
            window.maxSize       = new Vector2(500, 55);
            window.localVersion_ = localVersion;
            window.version_      = version;

            if (localVersion != "")
            {
                window.label_ = "Upgrading NoesisGUI " + localVersion + " -> " + version;
            }
            else
            {
                window.label_ = "Installing NoesisGUI " + version;
            }

            window.ShowUtility();
        }
    }
示例#2
0
    void OnEnable()
    {
        minSize = new Vector2(Width, Height);
        maxSize = new Vector2(Width, Height);

        _banner   = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets/Editor/NoesisGUI/banner.png", typeof(Texture2D));
        _bannerbg = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets/Editor/NoesisGUI/banner_bg.png", typeof(Texture2D));
        _version  = NoesisVersion.GetCached();

        _bannerStyle = new GUIStyle();
        _bannerStyle.normal.background = _bannerbg;
    }
    void OnEnable()
    {
        position = new Rect((Screen.currentResolution.width - Width) / 2, (Screen.currentResolution.height - Height) / 2, Width, Height);
        minSize  = new Vector2(Width, Height);
        maxSize  = new Vector2(Width, Height);

        _version = NoesisVersion.GetCached();

        _buttonStyle             = new GUIStyle();
        _buttonStyle.fixedWidth  = 48;
        _buttonStyle.fixedHeight = 48;

        _bannerStyle = new GUIStyle();
    }
示例#4
0
    static void CheckVersion()
    {
        EditorApplication.update -= CheckVersion;

        if (UnityEditorInternal.InternalEditorUtility.inBatchMode || EditorApplication.isPlayingOrWillChangePlaymode)
        {
            return;
        }

        string localVersion = NoesisVersion.GetCached();
        string version      = NoesisVersion.Get();

        if (localVersion != version && version != "0.0.0")
        {
            var window = (NoesisUpdater)ScriptableObject.CreateInstance(typeof(NoesisUpdater));
#if UNITY_4_6 || UNITY_5_0
            window.title = "NoesisGUI";
#else
            window.titleContent = new GUIContent("NoesisGUI");
#endif
            window.position      = new Rect(Screen.currentResolution.width / 2 - 250, Screen.currentResolution.height / 2 - 22, 500, 55);
            window.minSize       = new Vector2(500, 55);
            window.maxSize       = new Vector2(500, 55);
            window.localVersion_ = localVersion;
            window.version_      = version;

            if (localVersion != "")
            {
                window.label_ = "Upgrading NoesisGUI " + localVersion + " -> " + version;
            }
            else
            {
                window.label_ = "Installing NoesisGUI " + version;
            }

            window.ShowUtility();
        }
    }
示例#5
0
    private static void CheckVersion()
    {
        EditorApplication.update -= CheckVersion;

        if (!UnityEditorInternal.InternalEditorUtility.inBatchMode)
        {
            string localVersion = NoesisVersion.GetCached();
            string version      = NoesisVersion.Get();

            // Remove the file that indicates Noesis package is being installed
            AssetDatabase.DeleteAsset("Assets/NoesisGUI/Plugins/Editor/installing");

            // Detect if /Library is being recreated
            string noesisFile             = Path.Combine(Application.dataPath, "../Library/noesis");
            bool   libraryFolderRecreated = !File.Exists(noesisFile);
            if (libraryFolderRecreated)
            {
                File.Create(noesisFile).Dispose();
            }

            if (localVersion != version && version != "0.0.0")
            {
                if (NoesisVersion.RestartNeeded())
                {
                    Debug.LogWarning("Please restart Unity to reload NoesisGUI native plugin! " +
                                     "If error persists remove 'Assets/NoesisGUI/Plugins' and reimport again.");
                    return;
                }

                string title;

                if (localVersion != "")
                {
                    title = "Upgrading NoesisGUI " + localVersion + " -> " + version;
                }
                else
                {
                    title = "Installing NoesisGUI " + version;
                }

                EditorUtility.DisplayProgressBar(title, "", 0.0f);
                GoogleAnalyticsHelper.LogEvent("Install", version, 0);

                EditorUtility.DisplayProgressBar(title, "Upgrading project", 0.10f);
                Upgrade(localVersion);

                EditorUtility.DisplayProgressBar(title, "Updating version", 0.20f);
                NoesisVersion.SetCached(version);

                EditorUtility.DisplayProgressBar(title, "Creating default settings", 0.35f);
                NoesisSettings.Get();

                EditorUtility.DisplayProgressBar(title, "Extracting documentation...", 0.40f);
                ExtractTar("NoesisGUI/Doc.tar", "/../NoesisDoc", "/../NoesisDoc");

                EditorUtility.DisplayProgressBar(title, "Extracting blend samples...", 0.55f);
                ExtractTar("NoesisGUI/Samples/Samples-blend.tar", "/..", "/../Blend");

                NoesisPostprocessor.ImportAllAssets((progress, asset) =>
                {
                    EditorUtility.DisplayProgressBar(title, asset, 0.60f + progress * 0.40f);
                });

                EditorApplication.update += ShowWelcomeWindow;
                EditorUtility.ClearProgressBar();

                Debug.Log("NoesisGUI v" + version + " successfully installed");
            }
            else if (libraryFolderRecreated)
            {
                NoesisPostprocessor.ImportAllAssets();
            }
        }
    }