UnityEditor.ASCommitWindow.DoGUI C# (CSharp) Method

DoGUI() private method

private DoGUI ( ) : bool
return bool
        internal bool DoGUI()
        {
            bool enabled = GUI.enabled;
            if (constants == null)
            {
                constants = new Constants();
            }
            if (this.resetKeyboardControl)
            {
                this.resetKeyboardControl = false;
                GUIUtility.keyboardControl = 0;
            }
            bool flag2 = this.parentWin.position.width <= 432f;
            if (Event.current.type == EventType.Layout)
            {
                this.wasHidingButtons = flag2;
            }
            else if (flag2 != this.wasHidingButtons)
            {
                GUIUtility.ExitGUI();
            }
            SplitterGUILayout.BeginHorizontalSplit(this.horSplit, new GUILayoutOption[0]);
            GUILayout.BeginVertical(constants.box, new GUILayoutOption[0]);
            GUILayout.Label(this.totalChanges, constants.title, new GUILayoutOption[0]);
            if (this.ParentViewGUI(this.pv1state, this.pv2state, ref this.pv1hasSelection))
            {
                GUILayout.EndVertical();
                SplitterGUILayout.BeginVerticalSplit(this.vertSplit, new GUILayoutOption[0]);
                GUILayout.BeginVertical(constants.box, new GUILayoutOption[0]);
                GUILayout.Label("Changeset", constants.title, new GUILayoutOption[0]);
                if (!this.ParentViewGUI(this.pv2state, this.pv1state, ref this.pv2hasSelection))
                {
                    return true;
                }
                GUILayout.EndVertical();
                GUILayout.BeginVertical(new GUILayoutOption[0]);
                GUILayout.Label("Commit Message", constants.title, new GUILayoutOption[0]);
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                if (this.commitMessageList.Length > 0)
                {
                    GUIContent content = new GUIContent("Recent");
                    Rect position = GUILayoutUtility.GetRect(content, constants.dropDown, null);
                    if (GUI.Button(position, content, constants.dropDown))
                    {
                        GUIUtility.hotControl = 0;
                        string[] strArray = new string[this.commitMessageList.Length];
                        for (int i = 0; i < strArray.Length; i++)
                        {
                            strArray[i] = (this.commitMessageList[i].Length <= 200) ? this.commitMessageList[i] : (this.commitMessageList[i].Substring(0, 200) + " ... ");
                        }
                        EditorUtility.DisplayCustomMenu(position, strArray, null, new EditorUtility.SelectMenuItemFunction(this.MenuClick), null);
                        Event.current.Use();
                    }
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal(constants.box, new GUILayoutOption[0]);
                this.scrollPos = EditorGUILayout.BeginVerticalScrollView(this.scrollPos, new GUILayoutOption[0]);
                this.description = EditorGUILayout.TextArea(this.description, constants.wwText, new GUILayoutOption[0]);
                EditorGUILayout.EndScrollView();
                GUILayout.EndHorizontal();
                GUILayout.EndVertical();
                SplitterGUILayout.EndVerticalSplit();
                SplitterGUILayout.EndHorizontalSplit();
                if (!flag2)
                {
                    GUILayout.Label("Please drag files you want to commit to Changeset and fill in commit description", new GUILayoutOption[0]);
                }
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                if (!this.pv1hasSelection && !this.pv2hasSelection)
                {
                    GUI.enabled = false;
                }
                if (!flag2 && GUILayout.Button("Compare", constants.button, new GUILayoutOption[0]))
                {
                    this.DoShowMyDiff(false);
                    GUIUtility.ExitGUI();
                }
                bool flag4 = GUI.enabled;
                if (!this.somethingDiscardableSelected)
                {
                    GUI.enabled = false;
                }
                if (GUILayout.Button(!flag2 ? "Discard Selected Changes" : "Discard", constants.button, new GUILayoutOption[0]))
                {
                    this.DoMyRevert(false);
                    GUIUtility.ExitGUI();
                }
                GUI.enabled = flag4;
                GUILayout.FlexibleSpace();
                GUI.enabled = this.pv1hasSelection && enabled;
                if (GUILayout.Button(!flag2 ? ">>>" : ">", constants.button, new GUILayoutOption[0]))
                {
                    this.DoTransferAll(this.pv1state, this.pv2state, this.pv1state.selectedFolder, this.pv1state.selectedFile);
                }
                GUI.enabled = this.pv2hasSelection && enabled;
                if (GUILayout.Button(!flag2 ? "<<<" : "<", constants.button, new GUILayoutOption[0]))
                {
                    this.DoTransferAll(this.pv2state, this.pv1state, this.pv2state.selectedFolder, this.pv2state.selectedFile);
                }
                GUI.enabled = (this.pv1state.lv.totalRows != 0) && enabled;
                if (GUILayout.Button("Add All", constants.button, new GUILayoutOption[0]))
                {
                    int num2 = 0;
                    while (num2 < this.pv1state.selectedItems.Length)
                    {
                        this.pv1state.selectedItems[num2++] = true;
                    }
                    this.DoTransferAll(this.pv1state, this.pv2state, this.pv1state.selectedFolder, this.pv1state.selectedFile);
                }
                GUI.enabled = (this.pv2state.lv.totalRows != 0) && enabled;
                if (GUILayout.Button("Remove All", constants.button, new GUILayoutOption[0]))
                {
                    int num3 = 0;
                    while (num3 < this.pv2state.selectedItems.Length)
                    {
                        this.pv2state.selectedItems[num3++] = true;
                    }
                    this.DoTransferAll(this.pv2state, this.pv1state, this.pv2state.selectedFolder, this.pv2state.selectedFile);
                }
                GUI.enabled = enabled;
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.FlexibleSpace();
                if (!this.CanCommit())
                {
                    GUI.enabled = false;
                }
                GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinWidth(100f) };
                if (GUILayout.Button("Commit", constants.bigButton, options))
                {
                    this.DoCommit();
                }
                GUI.enabled = enabled;
                if (((Event.current.type == EventType.KeyDown) && (Event.current.keyCode == KeyCode.KeypadEnter)) && ((Application.platform == RuntimePlatform.OSXEditor) && this.CanCommit()))
                {
                    this.DoCommit();
                }
                GUILayout.EndHorizontal();
                if (AssetServer.GetAssetServerError() != string.Empty)
                {
                    GUILayout.Space(10f);
                    GUILayout.Label(AssetServer.GetAssetServerError(), constants.errorLabel, new GUILayoutOption[0]);
                    GUILayout.Space(10f);
                }
                GUILayout.Space(10f);
                if (this.lastRevertSelectionChanged == 0)
                {
                    this.lastRevertSelectionChanged = -1;
                    if (ShowDiscardWarning())
                    {
                        this.DoMyRevert(true);
                    }
                }
                if (this.lastRevertSelectionChanged > 0)
                {
                    if (Event.current.type == EventType.Repaint)
                    {
                        this.lastRevertSelectionChanged--;
                    }
                    this.parentWin.Repaint();
                }
                if (this.showReinitedWarning == 0)
                {
                    EditorUtility.DisplayDialog("Commits updated", "Commits had to be updated to reflect latest changes", "OK", "");
                    this.showReinitedWarning = -1;
                }
                if (this.showReinitedWarning > 0)
                {
                    if (Event.current.type == EventType.Repaint)
                    {
                        this.showReinitedWarning--;
                    }
                    this.parentWin.Repaint();
                }
            }
            return true;
        }