示例#1
0
        internal static void OnSubmitted(Task task)
        {
            WindowChange[] array = Resources.FindObjectsOfTypeAll(typeof(WindowChange)) as WindowChange[];
            if (array.Length == 0)
            {
                return;
            }
            WindowChange windowChange = array[0];

            windowChange.assetList          = task.assetList;
            windowChange.submitResultCode   = task.resultCode;
            windowChange.submitErrorMessage = null;
            if ((task.resultCode & 2) != 0)
            {
                string    empty    = string.Empty;
                Message[] messages = task.messages;
                for (int i = 0; i < messages.Length; i++)
                {
                    Message message = messages[i];
                    if (message.severity == Message.Severity.Error)
                    {
                        WindowChange expr_77 = windowChange;
                        expr_77.submitErrorMessage = expr_77.submitErrorMessage + empty + message.message;
                    }
                }
            }
            if ((task.resultCode & 3) != 0)
            {
                WindowPending.UpdateAllWindows();
            }
            windowChange.RefreshList();
        }
示例#2
0
        void OnErrorGUI()
        {
            GUILayout.Label("Submit failed", EditorStyles.boldLabel);

            string msg = "";

            if (!string.IsNullOrEmpty(submitErrorMessage))
            {
                msg = submitErrorMessage + "\n";
            }

            msg += "See console for details. You can get more details by increasing log level in EditorSettings.";

            GUILayout.Label(msg);

            GUILayout.FlexibleSpace();

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();

            if (GUILayout.Button("Close"))
            {
                ResetAndClose();

                // The error message may be telling that the plugin is opening a window
                // to handle conflicts. After that has been handled and we close this window
                // we want to update our state.
                WindowPending.UpdateAllWindows();
            }
            GUILayout.EndHorizontal();
        }
 public void OnDisable()
 {
     if (!cancelled)
     {
         WindowPending.UpdateAllWindows();
     }
 }
示例#4
0
 public void OnDisable()
 {
     if (this.cancelled)
     {
         return;
     }
     WindowPending.UpdateAllWindows();
 }
        void OnGUI()
        {
            GUILayout.Label("Revert Files", EditorStyles.boldLabel);
            GUILayout.FlexibleSpace();

            // I would use GUIUtility.GetLastRect() here after the box but that seems to have wierd side effects.
            Rect r1 = new Rect(6, 40, position.width - 12, position.height - 82);

            GUILayout.BeginArea(r1);
            GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
            GUILayout.EndArea();
            revertList.OnGUI(new Rect(r1.x + 2, r1.y + 2, r1.width - 4, r1.height - 4), true);

            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal();

            GUILayout.FlexibleSpace();

            if (GUILayout.Button("Cancel"))
            {
                Close();
            }

            if (assetList.Count > 0 && GUILayout.Button("Revert"))
            {
                string openScenes = "";
                foreach (Asset a in assetList)
                {
                    Scene openScene = SceneManager.GetSceneByPath(a.path);
                    if ((openScene.IsValid()) && (openScene.isLoaded))
                    {
                        openScenes += openScene.path + "\n";
                    }
                }

                if (openScenes.Length > 0)
                {
                    bool continueRevert = EditorUtility.DisplayDialog("Revert open scene(s)?",
                                                                      "You are about to revert your currently open scene(s):\n\n" +
                                                                      openScenes + "\nContinuing will remove all unsaved changes.",
                                                                      "Continue", "Cancel");
                    if (!continueRevert)
                    {
                        Close();
                        return;
                    }
                }

                Provider.Revert(assetList, RevertMode.Normal).Wait();
                WindowPending.UpdateAllWindows();
                AssetDatabase.Refresh();
                InspectorWindow.RefreshInspectors();
                Close();
            }

            GUILayout.EndHorizontal();
            GUILayout.Space(12);
        }
示例#6
0
        internal static void OnSubmitted(Task task)
        {
            var winsChange = Resources.FindObjectsOfTypeAll(typeof(WindowChange)) as WindowChange[];

            if (winsChange.Length == 0)
            {
                return; // user closed submit window before submit finished. Just ignore the status callback.
            }
            var win = winsChange[0];

            win.assetList          = task.assetList;
            win.submitResultCode   = task.resultCode;
            win.submitErrorMessage = null;

            if ((task.resultCode & (int)SubmitResult.Error) != 0)
            {
                string delim = "";
                foreach (Message msg in task.messages)
                {
                    if (msg.severity == Message.Severity.Error)
                    {
                        win.submitErrorMessage += delim + msg.message;
                    }
                }
            }

            if ((task.resultCode & ((int)SubmitResult.OK | (int)SubmitResult.Error)) != 0)
            {
                WindowPending.UpdateAllWindows();
                bool isNewChangeSet = win.changeSet == null;
                if (isNewChangeSet)
                {
                    // When change list becomes empty we open it to make "delete empty changessets" button visible
                    Task flushTask = Provider.Status(""); // Make a dummy task and wait for it since that will guarantee up to date lists
                    flushTask.Wait();
                    WindowPending.ExpandLatestChangeSet();
                }
            }

            if ((task.resultCode & (int)SubmitResult.OK) != 0)
            {
                win.ResetAndClose();
            }
            else
            {
                WindowResolve.Open(win.assetList);
                win.ResetAndClose();
            }
        }
示例#7
0
 internal static void OnAdded(Task task)
 {
     WindowChange[] changeArray = UnityEngine.Resources.FindObjectsOfTypeAll(typeof(WindowChange)) as WindowChange[];
     if (changeArray.Length != 0)
     {
         WindowChange change = changeArray[0];
         change.taskSubmit         = null;
         change.submitResultCode   = 0x100;
         change.submitErrorMessage = null;
         change.taskAdd            = null;
         change.taskStatus         = Provider.Status(change.assetList, false);
         change.assetList          = null;
         WindowPending.UpdateAllWindows();
     }
 }
示例#8
0
 internal static void OnAdded(Task task)
 {
     WindowChange[] array = Resources.FindObjectsOfTypeAll(typeof(WindowChange)) as WindowChange[];
     if (array.Length != 0)
     {
         WindowChange windowChange = array[0];
         windowChange.taskSubmit         = null;
         windowChange.submitResultCode   = 256;
         windowChange.submitErrorMessage = null;
         windowChange.taskAdd            = null;
         windowChange.taskStatus         = Provider.Status(windowChange.assetList, false);
         windowChange.assetList          = null;
         WindowPending.UpdateAllWindows();
     }
 }
示例#9
0
        private void OnGUI()
        {
            GUILayout.Label("Revert Files", EditorStyles.boldLabel, new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            Rect screenRect = new Rect(6f, 40f, this.position.width - 12f, this.position.height - 82f);

            GUILayout.BeginArea(screenRect);
            GUILayout.Box(string.Empty, new GUILayoutOption[2]
            {
                GUILayout.ExpandWidth(true),
                GUILayout.ExpandHeight(true)
            });
            GUILayout.EndArea();
            this.revertList.OnGUI(new Rect(screenRect.x + 2f, screenRect.y + 2f, screenRect.width - 4f, screenRect.height - 4f), true);
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Cancel"))
            {
                this.Close();
            }
            if (this.assetList.Count > 0 && GUILayout.Button("Revert"))
            {
                string str = string.Empty;
                using (List <Asset> .Enumerator enumerator = this.assetList.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Scene sceneByPath = SceneManager.GetSceneByPath(enumerator.Current.path);
                        if (sceneByPath.IsValid() && sceneByPath.isLoaded)
                        {
                            str = str + sceneByPath.path + "\n";
                        }
                    }
                }
                if (str.Length > 0 && !EditorUtility.DisplayDialog("Revert open scene(s)?", "You are about to revert your currently open scene(s):\n\n" + str + "\nContinuing will remove all unsaved changes.", "Continue", "Cancel"))
                {
                    this.Close();
                    return;
                }
                Provider.Revert(this.assetList, RevertMode.Normal).Wait();
                WindowPending.UpdateAllWindows();
                AssetDatabase.Refresh();
                this.Close();
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(12f);
        }
示例#10
0
        internal static void OnAdded(Task task)
        {
            WindowChange[] objectsOfTypeAll = Resources.FindObjectsOfTypeAll(typeof(WindowChange)) as WindowChange[];
            if (objectsOfTypeAll.Length == 0)
            {
                return;
            }
            WindowChange windowChange = objectsOfTypeAll[0];

            windowChange.taskSubmit         = (Task)null;
            windowChange.submitResultCode   = 256;
            windowChange.submitErrorMessage = (string)null;
            windowChange.taskAdd            = (Task)null;
            windowChange.taskStatus         = Provider.Status(windowChange.assetList, false);
            windowChange.assetList          = (AssetList)null;
            WindowPending.UpdateAllWindows();
        }
示例#11
0
        internal static void OnSubmitted(Task task)
        {
            WindowChange[] array = Resources.FindObjectsOfTypeAll(typeof(WindowChange)) as WindowChange[];
            if (array.Length == 0)
            {
                return;
            }
            WindowChange windowChange = array[0];

            windowChange.assetList          = task.assetList;
            windowChange.submitResultCode   = task.resultCode;
            windowChange.submitErrorMessage = null;
            if ((task.resultCode & 2) != 0)
            {
                string    empty    = string.Empty;
                Message[] messages = task.messages;
                for (int i = 0; i < messages.Length; i++)
                {
                    Message message = messages[i];
                    if (message.severity == Message.Severity.Error)
                    {
                        WindowChange expr_77 = windowChange;
                        expr_77.submitErrorMessage = expr_77.submitErrorMessage + empty + message.message;
                    }
                }
            }
            if ((task.resultCode & 3) != 0)
            {
                WindowPending.UpdateAllWindows();
                bool flag = windowChange.changeSet == null;
                if (flag)
                {
                    Task task2 = Provider.Status(string.Empty);
                    task2.Wait();
                    WindowPending.ExpandLatestChangeSet();
                }
            }
            if ((task.resultCode & 1) != 0)
            {
                windowChange.ResetAndClose();
            }
            else
            {
                windowChange.RefreshList();
            }
        }
示例#12
0
        private void OnGUI()
        {
            GUILayout.Label("Revert Files", EditorStyles.boldLabel, new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            Rect screenRect = new Rect(6f, 40f, base.position.width - 12f, base.position.height - 82f);

            GUILayout.BeginArea(screenRect);
            GUILayout.Box(string.Empty, new GUILayoutOption[]
            {
                GUILayout.ExpandWidth(true),
                GUILayout.ExpandHeight(true)
            });
            GUILayout.EndArea();
            this.revertList.OnGUI(new Rect(screenRect.x + 2f, screenRect.y + 2f, screenRect.width - 4f, screenRect.height - 4f), true);
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Cancel", new GUILayoutOption[0]))
            {
                base.Close();
            }
            if (this.assetList.Count > 0 && GUILayout.Button("Revert", new GUILayoutOption[0]))
            {
                foreach (Asset current in this.assetList)
                {
                    if (current.path == EditorApplication.currentScene)
                    {
                        if (!EditorUtility.DisplayDialog("Revert open scene?", "You are about to revert your currently open scene:\n\n" + EditorApplication.currentScene + "\n\nContinuing will remove all unsaved changes.", "Continue", "Cancel"))
                        {
                            base.Close();
                            return;
                        }
                        break;
                    }
                }
                Provider.Revert(this.assetList, RevertMode.Normal).Wait();
                WindowPending.UpdateAllWindows();
                AssetDatabase.Refresh();
                base.Close();
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(12f);
        }
示例#13
0
        internal static void OnSubmitted(Task task)
        {
            WindowChange[] objectsOfTypeAll = Resources.FindObjectsOfTypeAll(typeof(WindowChange)) as WindowChange[];
            if (objectsOfTypeAll.Length == 0)
            {
                return;
            }
            WindowChange windowChange1 = objectsOfTypeAll[0];

            windowChange1.assetList          = task.assetList;
            windowChange1.submitResultCode   = task.resultCode;
            windowChange1.submitErrorMessage = (string)null;
            if ((task.resultCode & 2) != 0)
            {
                string empty = string.Empty;
                foreach (Message message in task.messages)
                {
                    if (message.severity == Message.Severity.Error)
                    {
                        WindowChange windowChange2 = windowChange1;
                        string       str           = windowChange2.submitErrorMessage + empty + message.message;
                        windowChange2.submitErrorMessage = str;
                    }
                }
            }
            if ((task.resultCode & 3) != 0)
            {
                WindowPending.UpdateAllWindows();
                if (windowChange1.changeSet == null)
                {
                    Provider.Status(string.Empty).Wait();
                    WindowPending.ExpandLatestChangeSet();
                }
            }
            if ((task.resultCode & 1) != 0)
            {
                windowChange1.ResetAndClose();
            }
            else
            {
                windowChange1.RefreshList();
            }
        }
示例#14
0
        internal static void OnAdded(Task task)
        {
            var winsChange = Resources.FindObjectsOfTypeAll(typeof(WindowChange)) as WindowChange[];

            if (winsChange.Length == 0)
            {
                return; // user closed submit window before submit finished. Just ignore the status callback.
            }
            var win = winsChange[0];

            win.taskSubmit         = null;
            win.submitResultCode   = kSubmitNotStartedResultCode;
            win.submitErrorMessage = null;
            win.taskAdd            = null;

            // Refetch status
            win.taskStatus = Provider.Status(win.assetList, false);
            win.assetList  = null;
            WindowPending.UpdateAllWindows(); // reflect newly added assets in pending window
        }
示例#15
0
        private void OnErrorGUI()
        {
            GUILayout.Label("Submit failed", EditorStyles.boldLabel, new GUILayoutOption[0]);
            string str = string.Empty;

            if (!string.IsNullOrEmpty(this.submitErrorMessage))
            {
                str = this.submitErrorMessage + "\n";
            }
            GUILayout.Label(str + "See console for details. You can get more details by increasing log level in EditorSettings.");
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Close"))
            {
                this.ResetAndClose();
                WindowPending.UpdateAllWindows();
            }
            GUILayout.EndHorizontal();
        }
示例#16
0
 internal static void OnSubmitted(Task task)
 {
     WindowChange[] changeArray = UnityEngine.Resources.FindObjectsOfTypeAll(typeof(WindowChange)) as WindowChange[];
     if (changeArray.Length != 0)
     {
         WindowChange change = changeArray[0];
         change.assetList          = task.assetList;
         change.submitResultCode   = task.resultCode;
         change.submitErrorMessage = null;
         if ((task.resultCode & 2) != 0)
         {
             string str = "";
             foreach (Message message in task.messages)
             {
                 if (message.severity == Message.Severity.Error)
                 {
                     change.submitErrorMessage = change.submitErrorMessage + str + message.message;
                 }
             }
         }
         if ((task.resultCode & 3) != 0)
         {
             WindowPending.UpdateAllWindows();
             if (change.changeSet == null)
             {
                 Provider.Status("").Wait();
                 WindowPending.ExpandLatestChangeSet();
             }
         }
         if ((task.resultCode & 1) != 0)
         {
             change.ResetAndClose();
         }
         else
         {
             change.RefreshList();
         }
     }
 }
示例#17
0
        private void OnErrorGUI()
        {
            GUILayout.Label("Submit failed", EditorStyles.boldLabel, new GUILayoutOption[0]);
            string text = string.Empty;

            if (!string.IsNullOrEmpty(this.submitErrorMessage))
            {
                text = this.submitErrorMessage + "\n";
            }
            text += "See console for details. You can get more details by increasing log level in EditorSettings.";
            GUILayout.Label(text, new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Close", new GUILayoutOption[0]))
            {
                this.taskSubmit         = null;
                this.submitResultCode   = 256;
                this.submitErrorMessage = null;
                base.Close();
                WindowPending.UpdateAllWindows();
            }
            GUILayout.EndHorizontal();
        }
示例#18
0
 public static void OnStatusUpdated()
 {
     WindowPending.UpdateAllWindows();
 }