UnityEditor.ASServerAdminWindow.DoGUI C# (CSharp) Method

DoGUI() public method

public DoGUI ( ) : bool
return bool
        public bool DoGUI()
        {
            bool enabled = GUI.enabled;
            if (constants == null)
            {
                constants = new ASMainWindow.Constants();
                constants.toggleSize = constants.toggle.CalcSize(new GUIContent("X"));
            }
            if (this.resetKeyboardControl)
            {
                this.resetKeyboardControl = false;
                GUIUtility.keyboardControl = 0;
            }
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.BeginVertical(constants.groupBox, new GUILayoutOption[0]);
            GUILayout.Box("Server Connection", constants.title, new GUILayoutOption[0]);
            GUILayout.BeginVertical(constants.contentBox, new GUILayoutOption[0]);
            Event current = Event.current;
            if (((current.type == EventType.KeyDown) && (current.keyCode == KeyCode.Return)) && this.CanPerformCurrentAction())
            {
                this.PerformCurrentAction();
            }
            if (((current.type == EventType.KeyDown) && (current.keyCode == KeyCode.Escape)) && (this.currAction != Action.Main))
            {
                this.currAction = Action.Main;
                current.Use();
            }
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            this.server = EditorGUILayout.TextField("Server Address:", this.server, new GUILayoutOption[0]);
            this.ServersPopup();
            GUILayout.EndHorizontal();
            this.user = EditorGUILayout.TextField("User Name:", this.user, new GUILayoutOption[0]);
            this.password = EditorGUILayout.PasswordField("Password:", this.password, new GUILayoutOption[0]);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            GUI.enabled = this.CanPerformCurrentAction() && enabled;
            if (GUILayout.Button("Connect", constants.smallButton, new GUILayoutOption[0]))
            {
                this.PerformCurrentAction();
            }
            GUI.enabled = enabled;
            GUILayout.EndHorizontal();
            if (AssetServer.GetAssetServerError() != string.Empty)
            {
                GUILayout.Label(AssetServer.GetAssetServerError(), constants.errorLabel, new GUILayoutOption[0]);
            }
            GUILayout.EndVertical();
            GUILayout.EndVertical();
            GUILayout.BeginVertical(constants.groupBox, new GUILayoutOption[0]);
            GUILayout.Box("Admin Actions", constants.title, new GUILayoutOption[0]);
            GUILayout.BeginVertical(constants.contentBox, new GUILayoutOption[0]);
            this.ActionBox();
            GUILayout.EndVertical();
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.BeginVertical(constants.groupBox, new GUILayoutOption[0]);
            GUILayout.Box("Project", constants.title, new GUILayoutOption[0]);
            IEnumerator enumerator = ListViewGUILayout.ListView(this.lv, constants.background, new GUILayoutOption[0]).GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    ListViewElement element = (ListViewElement) enumerator.Current;
                    if ((element.row == this.lv.row) && (Event.current.type == EventType.Repaint))
                    {
                        constants.entrySelected.Draw(element.position, false, false, false, false);
                    }
                    GUILayout.Label(this.databases[element.row].name, new GUILayoutOption[0]);
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
            if (this.lv.selectionChanged)
            {
                if (this.lv.row > -1)
                {
                    this.projectSelected = true;
                }
                this.currAction = Action.Main;
                this.DoGetUsers();
            }
            GUILayout.EndVertical();
            GUILayout.BeginVertical(constants.groupBox, new GUILayoutOption[0]);
            SplitterGUILayout.BeginHorizontalSplit(this.lvSplit, new GUILayoutOption[0]);
            GUILayout.Box("", constants.columnHeader, new GUILayoutOption[0]);
            GUILayout.Box("User", constants.columnHeader, new GUILayoutOption[0]);
            GUILayout.Box("Full Name", constants.columnHeader, new GUILayoutOption[0]);
            GUILayout.Box("Email", constants.columnHeader, new GUILayoutOption[0]);
            SplitterGUILayout.EndHorizontalSplit();
            int left = EditorStyles.label.margin.left;
            IEnumerator enumerator2 = ListViewGUILayout.ListView(this.lv2, constants.background, new GUILayoutOption[0]).GetEnumerator();
            try
            {
                while (enumerator2.MoveNext())
                {
                    ListViewElement element2 = (ListViewElement) enumerator2.Current;
                    if ((element2.row == this.lv2.row) && (Event.current.type == EventType.Repaint))
                    {
                        constants.entrySelected.Draw(element2.position, false, false, false, false);
                    }
                    bool flag2 = this.users[element2.row].enabled != 0;
                    bool flag3 = GUI.Toggle(new Rect(element2.position.x + 2f, element2.position.y - 1f, constants.toggleSize.x, constants.toggleSize.y), flag2, "");
                    GUILayout.Space(constants.toggleSize.x);
                    if ((flag2 != flag3) && AssetServer.AdminSetUserEnabled(this.databases[this.lv.row].dbName, this.users[element2.row].userName, this.users[element2.row].fullName, this.users[element2.row].email, !flag3 ? 0 : 1))
                    {
                        this.users[element2.row].enabled = !flag3 ? 0 : 1;
                    }
                    GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width((float) (this.lvSplit.realSizes[1] - left)) };
                    GUILayout.Label(this.users[element2.row].userName, options);
                    GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.Width((float) (this.lvSplit.realSizes[2] - left)) };
                    GUILayout.Label(this.users[element2.row].fullName, optionArray2);
                    GUILayout.Label(this.users[element2.row].email, new GUILayoutOption[0]);
                }
            }
            finally
            {
                IDisposable disposable2 = enumerator2 as IDisposable;
                if (disposable2 != null)
                {
                    disposable2.Dispose();
                }
            }
            if (this.lv2.selectionChanged)
            {
                if (this.lv2.row > -1)
                {
                    this.userSelected = true;
                }
                if (this.currAction == Action.SetPassword)
                {
                    this.currAction = Action.Main;
                }
            }
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            GUILayout.Space(10f);
            if (!this.splittersOk && (Event.current.type == EventType.Repaint))
            {
                this.splittersOk = true;
                this.parentWin.Repaint();
            }
            return true;
        }