Ejemplo n.º 1
0
 /// <summary>
 /// Main update cycle, independent from OnGUI, used mostly to make the updater run in background when it's doing something
 /// </summary>
 void Update()
 {
     if (updater != null)
     {
         if (section == MultiWindowSection.Updater)
         {
             updater.Update();
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Static update function that is passed to the editor on load and is responsible for handling the updater states
        /// </summary>
        static void Update()
        {
            updater.Update();

            switch (updater.GetState())
            {
            case UpdaterState.Fetching:
                break;

            // If the updater found an update a popup window is created to inform the user that an update is available
            case UpdaterState.Ready:
                if (window == null)
                {
                    Debug.Log("Toony standard: new update found");
                    int windowWidth  = 500;
                    int windowHeight = 320;
                    window              = EditorWindow.CreateInstance <TSAutoUpdatePopup>();
                    window.updater      = updater;
                    window.update       = Update;
                    window.minSize      = new Vector2(windowWidth, windowHeight);
                    window.maxSize      = new Vector2(windowWidth, windowHeight);
                    window.titleContent = new GUIContent("Toony Standard Updater");
                    window.ShowUtility();
                }

                break;

            case UpdaterState.UpToDate:
                Debug.Log("Toony standard: shader is up to date");
                EditorApplication.update -= Update;
                break;

            case UpdaterState.Error:
                Debug.Log("Toony standard: error on getting update information");
                EditorApplication.update -= Update;
                break;

            case UpdaterState.Downloaded:
                window.Close();
                EditorApplication.update -= Update;
                break;
            }
        }