Пример #1
0
            public static void ShowAutoSavePopup(Action saveFunction, float timeOut)
            {
                AutoSavePopup window =
                    (AutoSavePopup)EditorWindow.GetWindow(
                        typeof(AutoSavePopup),
                        true,
                        "Auto Save Popup");

                Vector2 size = new Vector2(200, 80);

                UpdateMainPos();

                Vector2 pos =
                    new Vector2(
                        (mainPos.x + mainPos.width) - 210,
                        (mainPos.y + mainPos.height) - 90);

                window.minSize  = size;
                window.maxSize  = size;
                window.position = new Rect(pos, size);

                window.Setup(saveFunction, timeOut);
            }
Пример #2
0
 /// <summary>
 /// Checks when it's time to AutoSave and make backups.
 /// </summary>
 static void OnUpdate()
 {
     if ((DateTime.Now - LastSaveTime).TotalMinutes >= SaveMinutes)
     {
         int sc = EditorSceneManager.sceneCount;
         for (int i = 0; i < sc; i++)
         {
             // Show popup or save scenes only if there is at least one dirty.
             if (EditorSceneManager.GetSceneAt(i).isDirty)
             {
                 if (ShowPopup)
                 {
                     AutoSavePopup.ShowAutoSavePopup(SaveScenes, PopupTimeout);
                 }
                 else
                 {
                     SaveScenes();
                 }
                 break;
             }
         }
         LastSaveTime = DateTime.Now;
     }
 }