UnityEditor.ASServerAdminWindow.ActionBox C# (CSharp) Method

ActionBox() private method

private ActionBox ( ) : void
return void
        private void ActionBox()
        {
            bool enabled = GUI.enabled;
            switch (this.currAction)
            {
                case Action.Main:
                    if (!this.isConnected)
                    {
                        GUI.enabled = false;
                    }
                    if (this.WordWrappedLabelButton("Want to create a new project?", "Create"))
                    {
                        this.nProjectName = "";
                        this.nTemplateProjectName = "";
                        this.currAction = Action.CreateProject;
                    }
                    if (this.WordWrappedLabelButton("Want to create a new user?", "New User"))
                    {
                        this.nPassword1 = this.nPassword2 = string.Empty;
                        this.nFullName = this.nUserName = this.nEmail = string.Empty;
                        this.currAction = Action.CreateUser;
                    }
                    GUI.enabled = (this.isConnected && this.userSelected) && enabled;
                    if (this.WordWrappedLabelButton("Need to change user password?", "Set Password"))
                    {
                        this.nPassword1 = this.nPassword2 = string.Empty;
                        this.currAction = Action.SetPassword;
                    }
                    if (this.WordWrappedLabelButton("Need to change user information?", "Edit"))
                    {
                        this.nFullName = this.users[this.lv2.row].fullName;
                        this.nEmail = this.users[this.lv2.row].email;
                        this.currAction = Action.ModifyUser;
                    }
                    GUI.enabled = (this.isConnected && this.projectSelected) && enabled;
                    if (this.WordWrappedLabelButton("Duplicate selected project", "Copy Project"))
                    {
                        this.nProjectName = "";
                        this.nTemplateProjectName = this.databases[this.lv.row].name;
                        this.currAction = Action.CreateProject;
                    }
                    if ((this.WordWrappedLabelButton("Delete selected project", "Delete Project") && EditorUtility.DisplayDialog("Delete project", "Are you sure you want to delete project " + this.databases[this.lv.row].name + "? This operation cannot be undone!", "Delete", "Cancel")) && (AssetServer.AdminDeleteDB(this.databases[this.lv.row].name) != 0))
                    {
                        this.DoRefreshDatabases();
                        GUIUtility.ExitGUI();
                    }
                    GUI.enabled = (this.isConnected && this.userSelected) && enabled;
                    if ((this.WordWrappedLabelButton("Delete selected user", "Delete User") && EditorUtility.DisplayDialog("Delete user", "Are you sure you want to delete user " + this.users[this.lv2.row].userName + "? This operation cannot be undone!", "Delete", "Cancel")) && (AssetServer.AdminDeleteUser(this.users[this.lv2.row].userName) != 0))
                    {
                        if (this.lv.row > -1)
                        {
                            this.DoGetUsers();
                        }
                        GUIUtility.ExitGUI();
                    }
                    GUI.enabled = enabled;
                    break;

                case Action.CreateUser:
                    this.nFullName = EditorGUILayout.TextField("Full Name:", this.nFullName, new GUILayoutOption[0]);
                    this.nEmail = EditorGUILayout.TextField("Email Address:", this.nEmail, new GUILayoutOption[0]);
                    GUILayout.Space(5f);
                    this.nUserName = EditorGUILayout.TextField("User Name:", this.nUserName, new GUILayoutOption[0]);
                    GUILayout.Space(5f);
                    this.nPassword1 = EditorGUILayout.PasswordField("Password:", this.nPassword1, new GUILayoutOption[0]);
                    this.nPassword2 = EditorGUILayout.PasswordField("Repeat Password:", this.nPassword2, new GUILayoutOption[0]);
                    GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                    GUILayout.FlexibleSpace();
                    GUI.enabled = this.CanPerformCurrentAction() && enabled;
                    if (GUILayout.Button("Create User", constants.smallButton, new GUILayoutOption[0]))
                    {
                        this.PerformCurrentAction();
                    }
                    GUI.enabled = enabled;
                    if (GUILayout.Button("Cancel", constants.smallButton, new GUILayoutOption[0]))
                    {
                        this.currAction = Action.Main;
                    }
                    GUILayout.EndHorizontal();
                    break;

                case Action.SetPassword:
                    GUILayout.Label("Setting password for user: " + this.users[this.lv2.row].userName, constants.title, new GUILayoutOption[0]);
                    GUILayout.Space(5f);
                    this.nPassword1 = EditorGUILayout.PasswordField("Password:", this.nPassword1, new GUILayoutOption[0]);
                    this.nPassword2 = EditorGUILayout.PasswordField("Repeat Password:", this.nPassword2, new GUILayoutOption[0]);
                    GUILayout.Space(5f);
                    GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                    GUILayout.FlexibleSpace();
                    GUI.enabled = this.CanPerformCurrentAction() && enabled;
                    if (GUILayout.Button("Change Password", constants.smallButton, new GUILayoutOption[0]))
                    {
                        this.PerformCurrentAction();
                    }
                    GUI.enabled = enabled;
                    if (GUILayout.Button("Cancel", constants.smallButton, new GUILayoutOption[0]))
                    {
                        this.currAction = Action.Main;
                    }
                    GUILayout.EndHorizontal();
                    break;

                case Action.CreateProject:
                    this.nProjectName = EditorGUILayout.TextField("Project Name:", this.nProjectName, new GUILayoutOption[0]);
                    GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                    GUILayout.FlexibleSpace();
                    GUI.enabled = this.CanPerformCurrentAction() && enabled;
                    if (GUILayout.Button((this.nTemplateProjectName != "") ? ("Copy " + this.nTemplateProjectName) : "Create Project", constants.smallButton, new GUILayoutOption[0]))
                    {
                        this.PerformCurrentAction();
                    }
                    GUI.enabled = enabled;
                    if (GUILayout.Button("Cancel", constants.smallButton, new GUILayoutOption[0]))
                    {
                        this.currAction = Action.Main;
                    }
                    GUILayout.EndHorizontal();
                    break;

                case Action.ModifyUser:
                    this.nFullName = EditorGUILayout.TextField("Full Name:", this.nFullName, new GUILayoutOption[0]);
                    this.nEmail = EditorGUILayout.TextField("Email Address:", this.nEmail, new GUILayoutOption[0]);
                    GUILayout.Space(5f);
                    GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                    GUILayout.FlexibleSpace();
                    GUI.enabled = this.CanPerformCurrentAction() && enabled;
                    if (GUILayout.Button("Change", constants.smallButton, new GUILayoutOption[0]))
                    {
                        this.PerformCurrentAction();
                    }
                    GUI.enabled = enabled;
                    if (GUILayout.Button("Cancel", constants.smallButton, new GUILayoutOption[0]))
                    {
                        this.currAction = Action.Main;
                    }
                    GUILayout.EndHorizontal();
                    break;
            }
        }