コード例 #1
0
        public override void OnGUI()
        {
            if (Nexus.Self == null || Nexus.Self.SelectedTab.Window.GetType() != constraint)
            {
                Close();
                return;
            }

            if (lastWindowWidth != Nexus.Self.position.width)
            {
                positionWindow = true;
            }

            if (positionWindow)
            {
                positionWindow  = false;
                lastWindowWidth = Nexus.Self.position.width;
                PositionWindow();
            }

            GUI.DrawTexture(new Rect(0, 0, position.width, position.height), Swat.MakeTextureFromColor(Color.gray));

            scrollBar        = new GUIStyle();
            scrollBar.margin = new RectOffset(25, 20, 0, 0);

            toggleGroup        = new GUIStyle();
            toggleGroup.margin = new RectOffset(12, 0, 0, 0);

            divider = new GUIStyle(GUI.skin.box);
            divider.normal.background = Swat.MakeTextureFromColor(Swat.ActionButtonTextColor);
            divider.margin            = new RectOffset(25, 0, 10, 20);

            requiredTestsStyle = new GUIStyle(GUI.skin.label);
            requiredTestsStyle.normal.textColor = Swat.ActionButtonTextColor;

            additionalTestsStyle = new GUIStyle(GUI.skin.label);
            additionalTestsStyle.normal.textColor = Swat.ActionButtonTextColor;

            testsToggle = new GUIStyle(GUI.skin.label);
            testsToggle.normal.textColor = Swat.ActionButtonTextColor;
            testsToggle.fixedWidth       = 50;
            testsToggle.fixedHeight      = 25;

            fo                  = new GUIStyle(EditorStyles.foldout);
            fo.margin           = new RectOffset(-10, 0, 5, 5);
            fo.normal.textColor = fo.hover.textColor = fo.active.textColor = Swat.ActionButtonTextColor;

            header                  = new GUIStyle(GUI.skin.label);
            header.fontSize         = 15;
            header.normal.textColor = Color.white;
            header.fontStyle        = FontStyle.Bold;
            header.alignment        = TextAnchor.MiddleCenter;

            buttons                   = new GUIStyle(GUI.skin.button);
            buttons.fixedHeight       = buttonHeight;
            buttons.fixedWidth        = buttonWidth;
            buttons.normal.textColor  = Swat.ActionButtonTextColor;
            buttons.normal.background = Swat.MakeTextureFromColor((Color) new Color32(80, 80, 80, 255));

            EditorGUILayout.BeginVertical();
            GUILayout.Space(15);
            EditorGUILayout.LabelField("Please Confirm", header);
            GUILayout.Box(string.Empty, divider, new GUILayoutOption[] { GUILayout.Height(1), GUILayout.Width(position.width - 50) });

            scrollY = EditorGUILayout.BeginScrollView(scrollY, scrollBar);
            string testListFoldout = string.Empty;

            for (int x = 0; x < requestedTests.Count; x++)
            {
                if (!requestedTestNames.Contains(requestedTests[x].Value.Name))
                {
                    requestedTestNames.Add(requestedTests[x].Value.Name);
                }
            }
            if (!isSubsetRun)
            {
                string plurals = requestedTestNames.Count > 1 ? "these tests" : "this test";
                Nexus.Self.Foldout(true, string.Format(" You requested {0}", plurals), true, fo);
                for (int x = 0; x < requestedTestNames.Count; x++)
                {
                    EditorGUILayout.LabelField(string.Format("    {0}", requestedTestNames[x]), requiredTestsStyle);
                    GUILayout.Space(2);
                }
                plurals         = additionalTests.Count > 1 ? "these tests" : "this test";
                testListFoldout = string.Format(" Which {0} dependent on {1}", additionalTests.Count > 1 ? "are" : "is", plurals);
            }
            else
            {
                testListFoldout = " Select subset of tests to run";
                additionalTests = requestedTests;
            }

            requiredTestsStyle.padding = new RectOffset(0, 0, 0, 0);
            Nexus.Self.Foldout(true, testListFoldout, true, fo);
            for (int x = 0; x < additionalTests.Count; x++)
            {
                EditorGUILayout.BeginHorizontal(toggleGroup);
                if (!additionalTestNames.Contains(additionalTests[x].Value.Name))
                {
                    additionalTestNames.Add(additionalTests[x].Value.Name);
                    additionalTestsToggleList.Add(AutomationMaster.EntireUnitySessionCompletedTests.Contains(additionalTests[x].Value.Name) ? false : isTestSubset ? false : true);
                }

                testsToggle.padding  = additionalTestsToggleList[x] ? new RectOffset(0, 0, -6, 0) : new RectOffset(2, 0, -2, 0);
                testsToggle.fontSize = additionalTestsToggleList[x] ? 25 : 18;
                if (GUILayout.Button(additionalTestsToggleList[x] ? Swat.TOGGLE_ON : Swat.TOGGLE_OFF, testsToggle, new GUILayoutOption[] { GUILayout.Width(40) }))
                {
                    additionalTestsToggleList[x] = !additionalTestsToggleList[x];
                }

                GUILayout.Space(-30);
                if (GUILayout.Button(string.Format("  {0}", additionalTests[x].Value.Name), additionalTestsStyle))
                {
                    additionalTestsToggleList[x] = !additionalTestsToggleList[x];                     //Toggle accompanying checkbox.
                }
                EditorGUILayout.EndHorizontal();
                GUILayout.Space(-10);
            }

            EditorGUILayout.EndScrollView();

            GUILayout.Box(string.Empty, divider, new GUILayoutOption[] { GUILayout.Height(1), GUILayout.Width(position.width - 50) });

            AutomationMaster.DisregardDependencies = false;             //Reset.

            float    margin      = (position.width - (buttonWidth * 3)) / 2;
            GUIStyle buttonGroup = new GUIStyle();

            buttonGroup.margin = new RectOffset((int)margin, (int)margin, 0, 10);

            EditorGUILayout.BeginHorizontal(buttonGroup);
            if (GUILayout.Button("Accept", buttons))
            {
                Nexus.Overseer.ignoreDependentTestsForRun = false;
                List <string> listToRun = new List <string>();
                for (int x = 0; x < additionalTestNames.Count; x++)
                {
                    if (additionalTestsToggleList[x])
                    {
                        listToRun.Add(additionalTestNames[x]);
                    }
                }
                string newTestList = "*";
                if (isSubsetRun)
                {
                    newTestList += string.Join(",", listToRun.ToArray());
                }
                else
                {
                    newTestList += string.Format("{0},{1}", string.Join(",", requestedTestNames.ToArray()), string.Join(",", listToRun.ToArray()));
                }
                Nexus.Overseer.Master_Editor_Override = new KeyValuePair <string, string>(newTestList, testType);

                bool ready = true;
                if (isSubsetRun)
                {
                    //If this is a subset run, we will not have calculated dependencies beforehand. Do that now, and open a new alert. Doing so will discard this pop automatically, as all we need is the test data from it.
                    List <KeyValuePair <string, MethodInfo> > selected = requestedTests.FindAll(x => listToRun.Contains(x.Value.Name));
                    List <KeyValuePair <string, MethodInfo> > methodsToRunAfterMappingDependencies = Nexus.AutoMaster.GatherAllTestsThatNeedToBeRunToSatisfyAllDependenciesForPartialTestRun(selected);
                    List <KeyValuePair <string, MethodInfo> > dependencies = methodsToRunAfterMappingDependencies.GetUniqueObjectsBetween(selected);

                    if (dependencies.Count > 0)
                    {
                        RunTestsAlert.Pop(selected, dependencies, testName, testType, true);
                        ready = false;
                    }
                }

                if (ready)
                {
                    Nexus.Self.Tests.LaunchTests(newTestList, testType);
                    IsVisible = false;
                    AutomationMaster.DisregardDependencies = true;                     //Ignore dependencies.
                    Close();
                }
            }
            if (!isSubsetRun)
            {
                if (GUILayout.Button("Disregard", buttons))
                {
                    string newTestList = string.Empty;

                    if (requestedTestNames.Count > 1)
                    {
                        newTestList = string.Join(",", requestedTestNames.ToArray());
                        Nexus.Overseer.Master_Editor_Override  = new KeyValuePair <string, string>(newTestList, testType);
                        AutomationMaster.DisregardDependencies = true;                         //Ignore dependencies.
                    }
                    AutomationMaster.DisregardDependencies = Nexus.Overseer.ignoreDependentTestsForRun = true;
                    Nexus.Self.Tests.LaunchTests(string.IsNullOrEmpty(newTestList) ? testName : newTestList, string.IsNullOrEmpty(newTestList) ? testType : "test");
                    IsVisible = false;
                    Close();
                }
            }
            if (GUILayout.Button("Cancel", buttons))
            {
                Nexus.Overseer.Master_Editor_Override = new KeyValuePair <string, string>();
                IsVisible = false;
                Close();
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.EndVertical();
        }
コード例 #2
0
ファイル: Favorites.cs プロジェクト: tuanminh3395/trilleon
        public override void Render()
        {
            GUIStyle add = new GUIStyle(GUI.skin.button);

            add.margin            = new RectOffset(20, 0, -10, 0);
            add.fixedWidth        = 50;
            add.fixedHeight       = 30;
            add.normal.textColor  = Swat.TabButtonTextColor;
            add.normal.background = Swat.TabButtonBackgroundTexture;

            GUIStyle addNew = new GUIStyle(GUI.skin.button);

            addNew.margin           = new RectOffset(20, 0, 0, 0);
            addNew.fixedWidth       = 75;
            addNew.fixedHeight      = 25;
            addNew.fontSize         = 14;
            addNew.normal.textColor = Swat.ActionButtonTextColor;

            if (makeNew)
            {
                addNew.normal.background = Swat.MakeTextureFromColor(Color.black);
            }
            else
            {
                addNew.normal.background = Swat.ActionButtonTexture;
            }

            GUIStyle deleteItem = new GUIStyle(GUI.skin.button);

            deleteItem.margin            = new RectOffset(20, 0, -2, 0);
            deleteItem.fontSize          = 16;
            deleteItem.normal.textColor  = Color.red;
            deleteItem.normal.background = Swat.TabButtonBackgroundTexture;

            GUIStyle launchGroup = new GUIStyle(GUI.skin.button);

            launchGroup.margin            = new RectOffset(-10, 2, -5, 0);
            launchGroup.fixedWidth        = 25;
            launchGroup.fixedHeight       = 25;
            launchGroup.normal.textColor  = Swat.TabButtonTextColor;
            launchGroup.normal.background = Swat.TabButtonBackgroundTexture;

            GUIStyle favoriteHeader = new GUIStyle(GUI.skin.label);

            favoriteHeader.padding     = new RectOffset(10, 0, 0, 0);
            favoriteHeader.fontStyle   = FontStyle.Bold;
            favoriteHeader.alignment   = TextAnchor.LowerLeft;
            favoriteHeader.fontSize    = 15;
            favoriteHeader.fixedHeight = 15f;

            GUIStyle nameField = new GUIStyle(GUI.skin.textField);

            nameField.margin = new RectOffset(20, 0, 5, 5);

            GUIStyle typeHeader = new GUIStyle(GUI.skin.label);

            typeHeader.padding  = new RectOffset(20, 0, 0, 0);
            typeHeader.fontSize = 12;

            GUIStyle catFoldOut = new GUIStyle(EditorStyles.foldout);

            catFoldOut.margin    = new RectOffset(20, 0, 0, 0);
            catFoldOut.fontStyle = FontStyle.Italic;
            catFoldOut.fontSize  = 11;

            GUIStyle catTest = new GUIStyle(GUI.skin.label);

            catTest.padding  = new RectOffset(30, 0, 0, 0);
            catTest.fontSize = 12;

            GUILayout.Space(25);
            GUIStyle cs = new GUIStyle(EditorStyles.label);

            cs.padding   = new RectOffset(25, 15, 2, 2);
            cs.wordWrap  = true;
            cs.fontStyle = FontStyle.Italic;
            Nexus.Self.Button(makeNew ? "Cancel" : "Add New", "Add new Favorite test run.",
                              new Nexus.SwatDelegate(delegate() {
                makeNew       = !makeNew;
                isEdit        = false;
                buildingAdded = new List <KeyValuePair <string, string> >();
            }), addNew);
            GUILayout.Space(30);

            if (makeNew)
            {
                EditorGUILayout.BeginHorizontal();
                Nexus.Self.Button("Add", "Add To List.",
                                  new Nexus.SwatDelegate(delegate() {
                    if (!buildingAdded.FindAll(x => x.Key == _categories[SelectedCatIndex]).Any())
                    {
                        buildingAdded.Add(new KeyValuePair <string, string>(string.Format("{0}{1}", _categories[SelectedCatIndex], classIndicator), string.Empty));
                    }
                }), add);
                GUILayout.Space(-20);
                SelectedCatIndex = Nexus.Self.DropDown(SelectedCatIndex, _categories, 20, width: 280);
                EditorGUILayout.EndHorizontal();
                GUILayout.Space(10);
                EditorGUILayout.BeginHorizontal();
                Nexus.Self.Button("Add", "Add To List.",
                                  new Nexus.SwatDelegate(delegate() {
                    if (!buildingAdded.FindAll(x => x.Value == _requestedMethods[SelectedTestIndex]).Any())
                    {
                        buildingAdded.Add(new KeyValuePair <string, string>(GetTestsClassName(_requestedMethods[SelectedTestIndex]), _requestedMethods[SelectedTestIndex]));
                    }
                }), add);
                GUILayout.Space(-20);
                SelectedTestIndex = Nexus.Self.DropDown(SelectedTestIndex, _requestedMethods, 20, width: 280);
                EditorGUILayout.EndHorizontal();

                GUILayout.Space(15);
                for (int b = 0; b < buildingAdded.Count; b++)
                {
                    //If the next item is a test under this class, then don't render the classname as a header. We only want to render class names as a header in the saved, non-editable display.
                    if (b + 1 < buildingAdded.Count ? buildingAdded[b].Value.Length == 0 && buildingAdded[b + 1].Value.Length > 0 && buildingAdded[b].Key.Replace("*", string.Empty) == buildingAdded[b + 1].Key : false)
                    {
                        continue;
                    }
                    EditorGUILayout.BeginHorizontal();
                    bool deleted = false;
                    Nexus.Self.Button("X", "Remove this item.",
                                      new Nexus.SwatDelegate(delegate() {
                        //Check if the previous item is a class name and matches this test's class name. If so, then check if the next item does not share the same category name.
                        //If both are true, then remove the previous item, as it is just a category header that no longer has any tests under it. Leave it if there are other tests after this one that require that category header.
                        if ((b - 1 >= 0 ? buildingAdded[b - 1].Value.Length == 0 && buildingAdded[b].Key == buildingAdded[b - 1].Key.Replace("*", string.Empty) : false) && (b + 1 < buildingAdded.Count ? buildingAdded[b + 1].Key != buildingAdded[b].Key : true))
                        {
                            buildingAdded.RemoveAt(b - 1);
                            b--;
                        }
                        buildingAdded.RemoveAt(b);
                        b--;
                        deleted = true;
                    }), deleteItem, new GUILayoutOption[] { GUILayout.Width(20) });
                    if (deleted)
                    {
                        EditorGUILayout.EndHorizontal();
                        continue;
                    }
                    GUILayout.Space(-10);
                    EditorGUILayout.LabelField(string.Format("{0}{1}", buildingAdded[b].Value.Length > 0 ? string.Format("({0}) ", buildingAdded[b].Key) : buildingAdded[b].Key, buildingAdded[b].Value.Length > 0 ? buildingAdded[b].Value : string.Empty), typeHeader);
                    EditorGUILayout.EndHorizontal();
                    GUILayout.Space(2);
                }
                GUILayout.Space(15);

                EditorGUILayout.LabelField("Name:", typeHeader);
                newName = EditorGUILayout.TextField(newName, nameField, new GUILayoutOption[] { GUILayout.Width(150) });
                Nexus.Self.Button("Save", "Save Favorite.",
                                  new Nexus.SwatDelegate(delegate() {
                    if (newName.Trim().Length == 0)
                    {
                        SimpleAlert.Pop("A name is required to save this Favorites list.", null);
                    }
                    else if (buildingAdded.Count == 0)
                    {
                        SimpleAlert.Pop("At least one category or test needs to be added to this Favorites list to save.", null);
                    }
                    else if (FavoritesList.FindAll(c => c.Key == newName.Trim()).Any() && (isEdit ? FavoritesList[EditId].Key != newName.Trim() : true))
                    {
                        SimpleAlert.Pop("There is already a Favorite with this name. Please choose a unique name.", null);
                    }
                    else
                    {
                        saveCurrent = true;
                        makeNew     = false;
                        SaveNew();
                    }
                }), addNew);
                GUILayout.Space(20);
                EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
                GUILayout.Space(20);
            }

            int foldoutIndex = 0;

            for (int f = 0; f < FavoritesList.Count; f++)
            {
                if (isEdit && EditId == f)
                {
                    continue;
                }

                EditorGUILayout.BeginHorizontal(new GUILayoutOption[] { GUILayout.Width(300) });
                launchGroup.fontSize = 16;
                EditorGUILayout.LabelField(FavoritesList[f].Key, favoriteHeader);
                Nexus.Self.Button("▶", "Launch this Favorite.",
                                  new Nexus.SwatDelegate(delegate() {
                    //This is a Favorite list, and not a true Category. Gather requested tests/classes.
                    List <KeyValuePair <bool, string> > favoriteList = FavoritesList[f].Value;
                    string commandClasses = string.Empty;
                    string commandTests   = string.Empty;
                    for (int x = 0; x < favoriteList.Count; x++)
                    {
                        //Is the next item in the list a test? If so, this category is only meant to define the tests that follow, so ignore it.
                        if (favoriteList[x].Key && x + 1 < favoriteList.Count ? !favoriteList[x + 1].Key : false)
                        {
                            continue;
                        }

                        if (favoriteList[x].Key)
                        {
                            //All Tests In This Class
                            string category = string.Empty;
                            if (favoriteList[x].Value.Contains("("))
                            {
                                category = favoriteList[x].Value.Replace("*", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Split('(')[1].Trim(')');
                            }
                            else
                            {
                                category = favoriteList[x].Value.Replace("*", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty);
                            }
                            commandClasses += string.Format("{0},", category);
                        }
                        else
                        {
                            //Just This Test
                            commandTests += string.Format("{0},", favoriteList[x].Value);
                        }
                    }
                    string command = string.Format("&&{0}%{1}", commandClasses.Trim(','), commandTests.Trim(','));;
                    Nexus.Self.Tests.LaunchTests(command, "mix");
                }), launchGroup);
                launchGroup.fontSize = 22;
                Nexus.Self.Button("✎", "Edit this Favorite.",
                                  new Nexus.SwatDelegate(delegate() {
                    makeNew       = true;
                    isEdit        = true;
                    newName       = FavoritesList[f].Key;
                    EditId        = f;
                    buildingAdded = new List <KeyValuePair <string, string> >();
                    for (int l = 0; l < FavoritesList[f].Value.Count; l++)
                    {
                        KeyValuePair <string, string> newItem = new KeyValuePair <string, string>();
                        if (FavoritesList[f].Value[l].Key)
                        {
                            newItem = new KeyValuePair <string, string>(string.Format("{0}{1}", FavoritesList[f].Value[l].Value, classIndicator), string.Empty);
                        }
                        else
                        {
                            newItem = new KeyValuePair <string, string>(GetTestsClassName(FavoritesList[f].Value[l].Value), FavoritesList[f].Value[l].Value);
                        }

                        //Avoid possible duplicates
                        if (l + 1 == FavoritesList[f].Value.Count || (!buildingAdded.FindAll(b => b.Key == newItem.Key).Any() && !buildingAdded.FindAll(b => b.Value == newItem.Value).Any()))
                        {
                            buildingAdded.Add(newItem);
                        }
                    }
                }), launchGroup);
                launchGroup.fontSize = 16;
                Nexus.Self.Button("X", "Delete this Favorite.",
                                  new Nexus.SwatDelegate(delegate() {
                    keyToDelete = FavoritesList[f].Key;
                    SimpleAlert.Pop("Are you sure you want to delete this Favorites list?", new EditorDelegate(DeleteFavorite));
                }), launchGroup);
                EditorGUILayout.EndHorizontal();
                GUILayout.Space(10);

                for (int z = 0; z < FavoritesList[f].Value.Count; z++)
                {
                    if ((z + 1 == FavoritesList[f].Value.Count && FavoritesList[f].Value[z].Key) || (z + 1 < FavoritesList[f].Value.Count && FavoritesList[f].Value[z + 1].Key && FavoritesList[f].Value[z].Key))
                    {
                        EditorGUILayout.LabelField(FavoritesList[f].Value[z].Value, typeHeader);
                        GUILayout.Space(10);
                    }
                    else if (FavoritesList[f].Value[z].Key)
                    {
                        Nexus.Self.Foldout(true, new GUIContent(FavoritesList[f].Value[z].Value), true, catFoldOut);
                        GUILayout.Space(4);

                        for (int o = z + 1; o < FavoritesList[f].Value.Count; o++)
                        {
                            if (FavoritesList[f].Value[o].Key)
                            {
                                break;
                            }
                            EditorGUILayout.LabelField(FavoritesList[f].Value[o].Value, catTest);
                        }
                        GUILayout.Space(10);
                    }
                }

                foldoutIndex++;
                GUILayout.Space(20);
            }
        }
コード例 #3
0
        public override void OnGUI()
        {
            if (Nexus.Self == null)
            {
                Close();
                return;
            }

            if (lastWindowWidth != Nexus.Self.position.width)
            {
                _positionWindow = true;
            }

            if (_positionWindow)
            {
                _positionWindow = false;
                lastWindowWidth = Nexus.Self.position.width;
                PositionWindow();
            }

            GUI.DrawTexture(new Rect(0, 0, position.width, position.height), Swat.MakeTextureFromColor(Color.gray));

            divider = new GUIStyle(GUI.skin.box);
            divider.normal.background = Swat.MakeTextureFromColor(Color.white);
            divider.margin            = new RectOffset(25, 0, 10, 20);

            header                  = new GUIStyle(GUI.skin.label);
            header.fontSize         = 15;
            header.normal.textColor = Color.white;
            header.fontStyle        = FontStyle.Bold;
            header.alignment        = TextAnchor.MiddleCenter;
            header.fixedHeight      = 40;
            header.padding          = new RectOffset(0, 0, 5, 0);

            buttons                   = new GUIStyle(GUI.skin.button);
            buttons.fixedHeight       = buttonHeight;
            buttons.fixedWidth        = buttonWidth;
            buttons.normal.background = Swat.MakeTextureFromColor((Color) new Color32(80, 80, 80, 255));
            buttons.normal.textColor  = Color.white;

            messageLabel                  = new GUIStyle(GUI.skin.label);
            messageLabel.fontSize         = 12;
            messageLabel.padding          = new RectOffset(32, 0, 0, 0);
            messageLabel.normal.textColor = Color.white;
            messageLabel.wordWrap         = true;

            EditorGUILayout.LabelField("Please Confirm", header);
            GUILayout.Space(20);

            GUILayout.Box(string.Empty, divider, new GUILayoutOption[] { GUILayout.Height(1), GUILayout.Width(position.width - 50) });
            EditorGUILayout.LabelField(Message, messageLabel, new GUILayoutOption[] { GUILayout.Width(position.width - 50) });
            GUILayout.Space(10);
            GUILayout.Box(string.Empty, divider, new GUILayoutOption[] { GUILayout.Height(1), GUILayout.Width(position.width - 50) });
            buttons.margin = new RectOffset((int)System.Math.Round((position.width / 2) - buttons.fixedWidth), 0, 0, 0);             //Position just left of center.

            //Only show Confirm button if no action but closing of the alert is expected.
            if (OnConfirm != null)
            {
                EditorGUILayout.BeginHorizontal();
                Nexus.Self.Button("Cancel", "Deny alert criteria.",
                                  new Nexus.SwatDelegate(delegate() {
                    //Close and do nothing.
                    IsVisible = false;
                    Close();
                }), buttons);

                buttons                   = new GUIStyle(GUI.skin.button);
                buttons.fixedHeight       = buttonHeight;
                buttons.fixedWidth        = buttonWidth;
                buttons.margin            = new RectOffset(5, 0, 0, 0);
                buttons.normal.background = Swat.MakeTextureFromColor((Color) new Color32(80, 80, 80, 255));
                buttons.normal.textColor  = Color.white;
            }
            else
            {
                buttons.margin = new RectOffset((int)System.Math.Round((position.width / 2) - (buttons.fixedWidth / 2)), 0, 0, 0);                 //Position exact center.
            }

            Nexus.Self.Button("Confirm", "Accept alert criteria.",
                              new Nexus.SwatDelegate(delegate() {
                //Invoke provided delegate and close this confirmation popup.
                if (OnConfirm != null)
                {
                    OnConfirm();
                }
                IsVisible = false;
                Close();
            }), buttons);

            if (OnConfirm != null)
            {
                EditorGUILayout.EndHorizontal();
            }

            GUILayout.Space(10);
        }
コード例 #4
0
        public override void Render()
        {
            green = (Color) new Color32(210, 255, 215, 255);

            horizontal             = new GUIStyle();
            horizontal.fixedHeight = 20;
            horizontal.fixedWidth  = 375;

            button           = new GUIStyle(GUI.skin.button);
            button.fontSize  = 16;
            button.fontStyle = FontStyle.Bold;

            buttonChoices             = new GUIStyle(GUI.skin.button);
            buttonChoices.fixedHeight = 22;
            buttonChoices.fixedWidth  = 100;

            error = new GUIStyle(GUI.skin.label);
            error.normal.textColor = Color.red;

            inputField            = new GUIStyle(GUI.skin.textField);
            inputField.fixedWidth = 275;

            label           = new GUIStyle(GUI.skin.label);
            label.fontStyle = FontStyle.Bold;

            savedStyle = new GUIStyle(GUI.skin.label);
            savedStyle.normal.textColor = EditorGUIUtility.isProSkin ? green : (Color) new Color32(0, 140, 20, 255);

            sectionHeader                  = new GUIStyle(GUI.skin.label);
            sectionHeader.fontSize         = 22;
            sectionHeader.normal.textColor = Color.gray;
            sectionHeader.fixedHeight      = 50;

            inputToggle = new GUIStyle();
            Texture2D defaultBackground = inputToggle.normal.background;

            warning                  = new GUIStyle(GUI.skin.label);
            warning.wordWrap         = true;
            warning.margin           = new RectOffset(20, 20, 0, 0);
            warning.normal.textColor = new Color32(255, 125, 0, 255);


            if (showWarningForEditsToCriticalKeys)
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Warning: Editing critical settings values may result in undesired behavior!", warning);
            }

            EditorGUI.indentLevel++;

            if (saved)
            {
                if (DateTime.UtcNow.Subtract(saveTime).TotalSeconds > 10)
                {
                    //Only show message for 10 seconds.
                    saved = false;
                    Nexus.Self.Repaint();
                }
                else
                {
                    EditorGUILayout.LabelField("Changes saved!", savedStyle);
                }
            }
            else
            {
                EditorGUILayout.Space();
            }

            EditorGUILayout.Space();

            int critsAny = 0;

            if (settings == null || settings.Count == 0)
            {
                GetConfig();
            }

            for (int i = 0; i < settings.Count; i++)
            {
                if (string.IsNullOrEmpty(settings[i].Key))
                {
                    List <string[]> match = editableFields.FindAll(x => x[1] == settings[i].Value);
                    if (!match.Any())
                    {
                        editableFields.Add(new string[] { string.Empty, settings[i].Value });
                        hiddenFields.Add(new string[] { string.Empty, settingsSaved[i].Value });
                    }

                    if (i != 0)
                    {
                        GUILayout.Space(15);
                    }

                    customKeys = !settings[i].Value.Contains("REQUIRED");

                    EditorGUILayout.LabelField(customKeys ? "Custom Settings" : "Trilleon Settings", sectionHeader);
                    GUILayout.Space(20);
                }
                else
                {
                    button.normal.textColor = Color.red;

                    if (customKeys)
                    {
                        inputField.fixedWidth = 225;
                        EditorGUILayout.BeginHorizontal(horizontal);
                        GUILayout.Space(20);
                        EditorGUILayout.BeginVertical();
                        GUILayout.Space(12);
                        if (GUILayout.Button(xIcon, button, new GUILayoutOption[] { GUILayout.Width(20), GUILayout.Height(20) }))
                        {
                            changesMade = true;
                            settings.RemoveAt(i);
                            editableFields.RemoveAt(i);
                            criticalFields.RemoveAt(i);
                            continue;
                        }
                        EditorGUILayout.EndVertical();
                        GUILayout.Space(-25);
                    }
                    else
                    {
                        inputField.fixedWidth = 275;
                    }

                    //Use string array for mutability of these key value pairs.
                    string keyCasing = settings[i].Key.ToLower().Replace('_', ' ');
                    keyCasing = new CultureInfo("en-US", false).TextInfo.ToTitleCase(keyCasing);

                    List <string[]> match        = editableFields.FindAll(x => x[0] == keyCasing);
                    List <string[]> lastMatchVal = hiddenFields.FindAll(x => x[0] == keyCasing);

                    if (!match.Any())
                    {
                        string[] keyValPair = new string[2];
                        keyValPair[0] = keyCasing;
                        keyValPair[1] = settings[i].Value;
                        editableFields.Add(keyValPair);
                        match.Add(editableFields[editableFields.Count - 1]);

                        //Is this a new pending setting that has not yet been saved? If so, skip this.
                        if (settingsSaved.Count > i)
                        {
                            hiddenFields.Add(new string[] { keyCasing, settingsSaved[i].Value });
                            lastMatchVal.Add(hiddenFields[hiddenFields.Count - 1]);
                        }
                    }

                    string[] thisEntry         = match.First();
                    string[] lastMatchValEntry = lastMatchVal.Any() ? lastMatchVal.First() : new string[] { string.Empty, string.Empty };
                    bool     isBool            = false;
                    bool     boolValue         = false;
                    switch (thisEntry[1].ToLower())
                    {
                    case "false":
                        isBool = true;
                        break;

                    case "true":
                        boolValue = true;
                        isBool    = true;
                        break;
                    }

                    //Add label and instantiate field as equal to the entry in our editableFields list.
                    if (customKeys)
                    {
                        EditorGUILayout.BeginVertical();
                    }
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Space(18);
                    if (GUILayout.Button(string.Format("{0}: ", keyCasing), label))
                    {
                        if (isBool)
                        {
                            thisEntry[1] = (!bool.Parse(thisEntry[1])).ToString();
                            int index = -1;
                            editableFields.Find(x => {
                                index++;
                                return(x[0] == thisEntry[0]);
                            });
                            editableFields.RemoveAt(index);
                            editableFields = editableFields.AddAt(index, thisEntry);
                            boolValue      = !boolValue;
                        }
                    }
                    EditorGUILayout.EndHorizontal();

                    if (lastMatchValEntry[1] != thisEntry[1] || !settingsSaved.FindAll(ss => ss.Key == settings[i].Key).Any())
                    {
                        if (criticalFields[i])
                        {
                            inputToggle.normal.background = Swat.MakeTextureFromColor((Color) new Color32(200, 0, 0, 50));
                            critsAny++;
                        }
                        else
                        {
                            inputToggle.normal.background = Swat.MakeTextureFromColor((Color) new Color32(0, 200, 0, 50));
                            changesMade = true;
                        }
                    }
                    else
                    {
                        inputToggle.normal.background = defaultBackground;
                    }

                    if (isBool)
                    {
                        EditorGUILayout.BeginVertical(inputToggle);
                        thisEntry[1] = EditorGUILayout.Toggle(boolValue, GUILayout.MinWidth(127), GUILayout.MaxWidth(252)).ToString();
                        EditorGUILayout.EndVertical();
                    }
                    else
                    {
                        EditorGUILayout.BeginVertical(inputToggle);
                        thisEntry[1] = EditorGUILayout.TextField(thisEntry[1], inputField, GUILayout.MinWidth(125), GUILayout.MaxWidth(250));
                        EditorGUILayout.EndVertical();
                    }

                    if (customKeys)
                    {
                        EditorGUILayout.EndVertical();
                        EditorGUILayout.EndHorizontal();
                        GUILayout.Space(20);
                    }

                    GUILayout.Space(20);
                }
            }

            if (critsAny > 0)
            {
                showWarningForEditsToCriticalKeys = true;
            }
            else
            {
                showWarningForEditsToCriticalKeys = false;
            }

            EditorGUILayout.Space();
            EditorGUILayout.BeginHorizontal(horizontal);

            EditorGUILayout.BeginHorizontal();
            GUILayout.Space(20);
            EditorGUILayout.BeginVertical();
            GUILayout.Space(30);
            button.normal.textColor = Swat.TextGreen;
            inputField.fixedWidth   = 225;

            if (GUILayout.Button("+", button, new GUILayoutOption[] { GUILayout.Width(20), GUILayout.Height(20) }))
            {
                if (!string.IsNullOrEmpty(newEntryKey))
                {
                    if (!newEntryKey.Contains(" "))
                    {
                        settings.Add(new KeyValuePair <string, string>(newEntryKey, newEntryValue));
                        criticalFields.Add(false);
                        newEntryKey   = string.Empty;
                        newEntryValue = string.Empty;
                        showError     = false;
                        Nexus.Self.Repaint();
                    }
                    else
                    {
                        showError = true;
                    }
                }
                else
                {
                    showError = true;
                }
            }
            EditorGUILayout.EndVertical();
            GUILayout.Space(-30);
            EditorGUILayout.BeginVertical();
            EditorGUILayout.LabelField("Key: ", label);
            newEntryKey = EditorGUILayout.TextField(newEntryKey, inputField, new GUILayoutOption[] { GUILayout.MaxWidth(250) });
            EditorGUILayout.LabelField("Val: ", label);
            newEntryValue = EditorGUILayout.TextField(newEntryValue, inputField, new GUILayoutOption[] { GUILayout.MaxWidth(250) });
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(25);
            if (showError)
            {
                EditorGUILayout.LabelField("A key cannot contain spaces. Use underscores in place of spaces.", error);
            }
            GUILayout.Space(40);
            EditorGUILayout.BeginHorizontal();
            GUILayout.Space(65);
            if (changesMade)
            {
                buttonChoices.normal.background = Swat.MakeTextureFromColor((Color) new Color32(0, 255, 0, 50));
            }
            if (GUILayout.Button("Save Changes", buttonChoices, GUILayout.Width(100)))
            {
                SaveSettings();
            }
            GUILayout.Space(20);
            if (GUILayout.Button("Revert Changes", buttonChoices, GUILayout.Width(100)))
            {
                changesMade    = false;
                editableFields = new List <string[]>();
                hiddenFields   = new List <string[]>();
                criticalFields = new List <bool>();
                saved          = false;
                Set();
                GetConfig();
            }
            EditorGUILayout.EndHorizontal();
            GUILayout.Space(30);

            EditorGUI.indentLevel--;
        }
コード例 #5
0
        public override void Render()
        {
            description                  = new GUIStyle(GUI.skin.label);
            description.fontSize         = 12;
            description.wordWrap         = true;
            description.margin           = new RectOffset(10, 10, 0, 0);
            description.normal.textColor = Swat.WindowDefaultTextColor;

            dropDownLabel                  = new GUIStyle(GUI.skin.label);
            dropDownLabel.fontSize         = 12;
            dropDownLabel.padding          = new RectOffset(10, 0, -5, 0);
            dropDownLabel.normal.textColor = Swat.WindowDefaultTextColor;

            editorName                  = new GUIStyle(GUI.skin.label);
            editorName.fontSize         = 16;
            editorName.fixedHeight      = 20;
            editorName.fontStyle        = FontStyle.Bold;
            editorName.padding          = new RectOffset(8, 0, 0, 0);
            editorName.normal.textColor = Swat.WindowDefaultTextColor;

            open                   = new GUIStyle(GUI.skin.button);
            open.fontSize          = 14;
            open.fixedHeight       = 32;
            open.fixedWidth        = 100;
            open.margin            = new RectOffset(10, 10, 0, 0);
            open.normal.textColor  = Swat.WindowDefaultTextColor;
            open.normal.background = open.active.background = open.focused.background = Swat.ToggleButtonBackgroundSelectedTexture;

            GUILayout.Space(25);

            EditorGUILayout.LabelField("Assistant", editorName);
            GUILayout.Space(4);
            EditorGUILayout.LabelField("This window watches inspected elements in the hierarchy window and displays automation-relevant details on this object. With the presented information," +
                                       "you may choose actions to perform on the object and generate code stubs for interacting with that object.", description);
            GUILayout.Space(4);
            if (GUILayout.Button("Open", open))
            {
                Nexus.Self.SelectTab(Nexus.Self.Generator);
                Nexus.Self.Generator.SelectedSubTab = GeneratorSubTab.Assistant;
            }
            GUILayout.Space(18);

            EditorGUILayout.LabelField("Buddy Details", editorName);
            GUILayout.Space(4);
            EditorGUILayout.LabelField("This window allows customization of Buddy System data for editor-based test runs.", description);
            GUILayout.Space(4);
            if (GUILayout.Button("Open", open))
            {
                Nexus.Self.SelectTab(Nexus.Self.BuddyData);
            }
            GUILayout.Space(18);

            EditorGUILayout.LabelField("Command Console", editorName);
            GUILayout.Space(4);
            EditorGUILayout.LabelField("This window displays all of the console/cheat commands registered in the code. From here, the aliases, arguments, and details of each command are displayed." +
                                       "Commands can be launched with optional arguments from this window.", description);
            GUILayout.Space(4);
            if (GUILayout.Button("Open", open))
            {
                Nexus.Self.SelectTab(Nexus.Self.CommandConsoleView);
            }
            GUILayout.Space(18);

            EditorGUILayout.LabelField("Dependency Architecture", editorName);
            GUILayout.Space(4);
            EditorGUILayout.LabelField(@"This window displays the Dependency Class and Dependency Test attribute usage within the all existing tests.", description);
            GUILayout.Space(4);
            if (GUILayout.Button("Open", open))
            {
                Nexus.Self.SelectTab(Nexus.Self.Architect);
            }
            GUILayout.Space(18);

            EditorGUILayout.LabelField("Dependency Web", editorName);
            GUILayout.Space(4);
            EditorGUILayout.LabelField(@"This window displays Dependency Web usage throughout existing tests, helping to visualize the relationships between tests in a graphical web format." +
                                       "Because of the way this window is rendered, docking options are limited to Floating and DockNextToGameWindow only when opening.", description);
            GUILayout.Space(4);
            if (GUILayout.Button("Open", open))
            {
                //Web must be viewed in a large screen move. Dock next to Game, or allow float.
                Swat.ShowWindow <DependencyVisualizer>(typeof(DependencyVisualizer), "Web", dock == DockNextTo.Float ? dock : DockNextTo.GameView);
            }
            GUILayout.Space(18);

            EditorGUILayout.LabelField("Recorder", editorName);
            GUILayout.Space(4);
            EditorGUILayout.LabelField(@"This window allows you to begin recording automation-relevant actions that you take in the Unity Editor. When you stop recording, all actions are converted into code that can" +
                                       "be pasted directly into a test method, and played back as a new test.", description);
            GUILayout.Space(4);
            if (GUILayout.Button("Open", open))
            {
                Nexus.Self.SelectTab(Nexus.Self.Generator);
                Nexus.Self.Generator.SelectedSubTab = GeneratorSubTab.Recorder;
            }
            GUILayout.Space(18);

            EditorGUILayout.LabelField("Settings", editorName);
            GUILayout.Space(4);
            EditorGUILayout.LabelField(@"All Trilleon settings keys are displayed here so that their values can easily be updated, and new custom keys can be added on the fly.", description);
            GUILayout.Space(4);
            if (GUILayout.Button("Open", open))
            {
                Nexus.Self.SelectTab(Nexus.Self.Settings);
            }

            GUILayout.Space(40);
            EditorGUILayout.LabelField("Customize Your Nexus", editorName);

            GUILayout.Space(18);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Default Test View", dropDownLabel, new GUILayoutOption[] { GUILayout.Width(125) });
            defaultTestView = (DefaultTestView)Nexus.Self.DropDown(defaultTestView, 0, 25, 140);
            EditorGUILayout.EndHorizontal();
            GUILayout.Space(25);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Dock Next To:", dropDownLabel, new GUILayoutOption[] { GUILayout.Width(125) });
            dock = (DockNextTo)Nexus.Self.DropDown(dock, 0, 25, 140);
            EditorGUILayout.EndHorizontal();
            GUILayout.Space(25);

            if (dock != lastPassDock)
            {
                UpdateDockPreference();
                lastPassDock = dock;
            }
            if (defaultTestView != lastPassDefaultTestView)
            {
                SaveDefaultTestView();
                lastPassDefaultTestView = defaultTestView;
            }

            EditorGUILayout.LabelField("Simply select the arrows below change the order in which tabs render at the top of the Nexus window. Changes are made and saved instantly.", description);
            GUILayout.Space(20);

            GUIStyle windowName = new GUIStyle();

            windowName.fontSize    = 15;
            windowName.fixedHeight = 30;
            windowName.alignment   = TextAnchor.MiddleLeft;

            GUIStyle upDownArrowButtons = new GUIStyle(GUI.skin.button);

            upDownArrowButtons.fixedHeight       = 15;
            upDownArrowButtons.fixedWidth        = 25;
            upDownArrowButtons.normal.background = Swat.TabButtonBackgroundTexture;
            upDownArrowButtons.normal.textColor  = Color.blue;

            for (int x = 0; x < TabPreferences.Count; x++)
            {
                stepWrapper             = new GUIStyle();
                stepWrapper.fixedHeight = 30;
                if (recentlyReorderedIndex == x)
                {
                    if ((int)currentAlphaStep - 1 < 0)
                    {
                        currentAlphaStep       = 60;
                        recentlyReorderedIndex = -1;
                    }
                    else
                    {
                        currentAlphaStep -= (byte)1;
                        stepWrapper.normal.background = Swat.MakeTextureFromColor((Color) new Color32(0, 200, 0, currentAlphaStep));
                        Nexus.Self.Repaint();
                    }
                }

                EditorGUILayout.BeginHorizontal(stepWrapper, new GUILayoutOption[] { GUILayout.MaxWidth(200) });
                GUILayout.Space(15);
                upDownArrowButtons.fontSize = 15;

                EditorGUILayout.BeginVertical();
                if (x == 0)
                {
                    upDownArrowButtons.normal.textColor = Color.grey;
                }
                else
                {
                    upDownArrowButtons.normal.textColor = Color.blue;
                }
                if (GUILayout.Button(Swat.MOVEUP, upDownArrowButtons))
                {
                    if (x != 0)
                    {
                        recentlyReorderedIndex = ReOrderAction(x, true);
                    }
                }
                GUILayout.Space(-3f);
                upDownArrowButtons.fontSize = 11;
                if (x == TabPreferences.Count - 1)
                {
                    upDownArrowButtons.normal.textColor = Color.grey;
                }
                else
                {
                    upDownArrowButtons.normal.textColor = Color.blue;
                }
                if (GUILayout.Button(Swat.MOVEDOWN, upDownArrowButtons))
                {
                    if (x != TabPreferences.Count - 1)
                    {
                        recentlyReorderedIndex = ReOrderAction(x, false);
                    }
                }
                else
                {
                    upDownArrowButtons.normal.textColor = Color.blue;
                }
                EditorGUILayout.EndVertical();

                GUILayout.Space(10);
                EditorGUILayout.LabelField(string.Format("{0}   {1}", TabPreferences[x].Value, TabPreferences[x].Key), windowName, new GUILayoutOption[] { GUILayout.Width(175) });
                EditorGUILayout.EndHorizontal();
            }

            GUILayout.Space(20);
        }
コード例 #6
0
        public override void Render()
        {
            if (_showFileDeletedMessage)
            {
                if (DateTime.Now.Subtract(_fileDeletedTime).TotalSeconds > 2)
                {
                    _showFileDeletedMessage = false;
                }
            }

            GUIStyle back = new GUIStyle(GUI.skin.button);

            back.fontSize = 20;
            back.margin   = new RectOffset(25, 0, 10, 20);

            if (ReDrawAutomationReports)
            {
                ReDrawAutomationReports = false;

                if (!Directory.Exists(Path.GetDirectoryName(FileBroker.REPORTS_DIRECTORY)))
                {
                    Directory.CreateDirectory(Path.GetDirectoryName(FileBroker.REPORTS_DIRECTORY));
                }

                //Grab any report files.
                List <string> all = Directory.GetFiles(FileBroker.REPORTS_DIRECTORY, "report.html", SearchOption.AllDirectories).ToList();
                automationReports = new List <FileInfo>();

                for (int x = 0; x < all.Count; x++)
                {
                    automationReports.Add(new FileInfo(all[x]));
                }

                //Grab meta files for reports.
                all      = Directory.GetFiles(FileBroker.REPORTS_DIRECTORY, "report.meta", SearchOption.AllDirectories).ToList();
                metaData = new List <KeyValuePair <string, List <KeyValuePair <string, string> > > >();
                for (int m = 0; m < all.Count; m++)
                {
                    FileInfo info      = new FileInfo(all[m]);
                    string[] metaLines = FileBroker.ReadUnboundFile(info.FullName);
                    List <KeyValuePair <string, string> > values = new List <KeyValuePair <string, string> >();

                    for (int ml = 0; ml < metaLines.Length; ml++)
                    {
                        string[] keyVals = metaLines[ml].Split(':');
                        values.Add(new KeyValuePair <string, string>(keyVals[0], keyVals[1]));
                    }

                    metaData.Add(new KeyValuePair <string, List <KeyValuePair <string, string> > >(all[m].Split(new string[] { string.Format("{0}{1}", GameMaster.GAME_NAME, FileBroker.FILE_PATH_SPLIT) }, StringSplitOptions.None)[1].Replace(string.Format("{0}report.meta", FileBroker.FILE_PATH_SPLIT), ".html"), values));
                }

                automationReports.Reverse();
            }

            if (!automationReports.Any())
            {
                GUIStyle noResults = new GUIStyle(GUI.skin.label);
                noResults.padding          = new RectOffset(10, 0, 0, 0);
                noResults.fontSize         = 14;
                noResults.normal.textColor = Color.blue;
                GUILayout.Space(20);
                EditorGUILayout.LabelField("No test reports currently exist.", noResults);
                return;
            }

            Color32  boxGreen  = new Color32(20, 175, 0, 255);
            GUIStyle fileLabel = new GUIStyle(GUI.skin.label);

            fileLabel.normal.textColor = boxGreen;
            fileLabel.padding          = new RectOffset(32, 0, 0, 1);

            GUIStyle fileNameButton = new GUIStyle(GUI.skin.button);

            fileNameButton.margin            = new RectOffset(35, 0, 0, 0);
            fileNameButton.normal.background = fileNameButton.active.background = fileNameButton.focused.background = Swat.TabButtonBackgroundTexture;
            fileNameButton.normal.textColor  = Swat.WindowDefaultTextColor;

            GUIStyle deleteFileButton = new GUIStyle(GUI.skin.button);

            deleteFileButton.normal.textColor  = Color.red;
            deleteFileButton.fontSize          = 14;
            deleteFileButton.margin            = new RectOffset(1, 0, 0, 5);
            deleteFileButton.normal.background = deleteFileButton.active.background = deleteFileButton.focused.background = Swat.TabButtonBackgroundTexture;
            deleteFileButton.normal.textColor  = Color.red;

            GUIStyle divider = new GUIStyle(GUI.skin.box);

            divider.normal.background = Swat.MakeTextureFromColor(boxGreen);
            divider.margin            = new RectOffset(35, 10, 10, 10);

            GUIStyle deleteAllButton = new GUIStyle(GUI.skin.button);

            deleteAllButton.fontSize          = 12;
            deleteAllButton.normal.textColor  = Color.red;
            deleteAllButton.fontStyle         = FontStyle.Bold;
            deleteAllButton.fixedHeight       = 38;
            deleteAllButton.margin            = new RectOffset(0, 25, 5, 0);
            deleteAllButton.normal.background = deleteAllButton.active.background = deleteAllButton.focused.background = Swat.TabButtonBackgroundTexture;
            deleteAllButton.normal.textColor  = Color.red;

            GUILayout.Space(20);

            GUIStyle padding = new GUIStyle();

            padding.margin = new RectOffset(25, 0, 0, 0);
            GUILayout.BeginHorizontal(padding);
            EditorGUILayout.Space();
            if (_showFileDeletedMessage)
            {
                GUIStyle deleteFileAlert = new GUIStyle(GUI.skin.label);
                deleteFileAlert.normal.textColor = Color.red;
                deleteFileAlert.fontSize         = 14;
                deleteFileAlert.fixedHeight      = 28;
                deleteFileAlert.padding          = new RectOffset(30, 0, 14, 0);
                EditorGUILayout.LabelField("Deleted!", deleteFileAlert);
            }
            EditorGUILayout.Space();
            if (GUILayout.Button("Delete All", deleteAllButton, new GUILayoutOption[] { GUILayout.Height(30), GUILayout.Width(75) }))
            {
                SimpleAlert.Pop("Are you sure you want to delete all stored test run reports?", new EditorDelegate(DeleteAll));
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(20);

            for (int ar = 0; ar < automationReports.Count; ar++)
            {
                bool     isNewest  = ar == 0;
                string[] splitTime = automationReports[ar].CreationTime.ToShortTimeString().Split(':');
                int      hour      = int.Parse(splitTime[0]);
                bool     am        = true;
                if (hour >= 12)
                {
                    am = false;
                    if (hour != 12)
                    {
                        hour -= 12;
                    }
                }

                if (!isNewest)
                {
                    fileNameButton.normal.textColor = fileLabel.normal.textColor = Swat.WindowDefaultTextColor;
                }

                string timeOfDay = string.Format("{0}:{1} {2}", hour.ToString(), splitTime[1], am ? "AM" : "PM");
                if (isNewest)
                {
                    EditorGUILayout.LabelField("-----Newest-----", fileLabel);
                }
                EditorGUILayout.LabelField(string.Format("{0}    {1}", automationReports[ar].CreationTime.ToLongDateString(), timeOfDay), fileLabel);

                List <KeyValuePair <string, List <KeyValuePair <string, string> > > > matchMetaResults = metaData.FindAll(x => automationReports[ar].Directory.ToString().Contains(x.Key.Replace(".html", string.Empty)));

                if (matchMetaResults.Any())
                {
                    KeyValuePair <string, List <KeyValuePair <string, string> > > matchMeta = matchMetaResults.First();
                    EditorGUILayout.LabelField(string.Format("{0}:{1}     {2}:{3}     {4}:{5}     {6}:{7}",
                                                             TestManifest.PASSED, matchMeta.Value.Find(x => x.Key == "Passes").Value,
                                                             TestManifest.FAILED, matchMeta.Value.Find(x => x.Key == "Fails").Value,
                                                             TestManifest.SKIPPED, matchMeta.Value.Find(x => x.Key == "Skips").Value,
                                                             TestManifest.IGNORED, matchMeta.Value.Find(x => x.Key == "Ignores").Value), fileLabel);

                    if (Nexus.Self.MouseOver())
                    {
                        Nexus.Self.SetToolTip(matchMeta.Value.Find(x => x.Key == "RunCommand").Value.Replace(",", "\n"));
                    }
                }

                if (isNewest)
                {
                    GUILayout.Box(string.Empty, divider, new GUILayoutOption[] { GUILayout.Height(1), GUILayout.Width(180) });
                }

                GUILayout.BeginHorizontal();

                if (GUILayout.Button("Open Report", fileNameButton, new GUILayoutOption[] { GUILayout.Height(30), GUILayout.Width(150) }))
                {
                    System.Diagnostics.Process.Start(automationReports[ar].FullName);
                }
                if (GUILayout.Button("X", deleteFileButton, new GUILayoutOption[] { GUILayout.Height(30), GUILayout.Width(30) }))
                {
                    //Delete report and associated meta file.
                    Directory.Delete(automationReports[ar].Directory.ToString().Replace("/report.html", string.Empty), true);
                    ReDrawAutomationReports = true;
                    _fileDeletedTime        = DateTime.Now;
                    _showFileDeletedMessage = true;
                }
                GUILayout.EndHorizontal();

                if (isNewest)
                {
                    GUILayout.Box(string.Empty, divider, new GUILayoutOption[] { GUILayout.Height(1), GUILayout.Width(180) });
                }

                EditorGUILayout.Space();
                EditorGUILayout.Space();
            }
        }
コード例 #7
0
ファイル: ConsoleMessage.cs プロジェクト: lacostej/trilleon
        public override void OnGUI()
        {
            if (Nexus.Self == null || Nexus.Self.SelectedTab.Window.GetType() != constraint)
            {
                Close();
                return;
            }

            if (lastWindowWidth != Nexus.Self.position.width)
            {
                DoPositionWindow = true;
            }

            if (DoPositionWindow)
            {
                DoPositionWindow = false;
                lastWindowWidth  = Nexus.Self.position.width;
                PositionWindow();
            }

            GUI.skin.textArea.wordWrap = true;

            buttons                  = new GUIStyle(GUI.skin.button);
            buttons.fixedHeight      = buttonHeight;
            buttons.fixedWidth       = buttonWidth;
            buttons.margin           = new RectOffset(0, 0, 10, 0);
            buttons.normal.textColor = EditorGUIUtility.isProSkin ? Color.white : Color.black;
            buttonGroup              = new GUIStyle();

            closeBox                  = new GUIStyle(GUI.skin.button);
            closeBox.fontSize         = 16;
            closeBox.padding          = new RectOffset(2, 0, 0, 0);
            closeBox.normal.textColor = Color.red;

            detailsBox             = new GUIStyle(GUI.skin.box);
            detailsBox.margin      = new RectOffset(10, 25, 0, 0);
            detailsBox.fixedWidth  = minSize.x - 20;
            detailsBox.fixedHeight = minSize.y - 100;

            detailsLabel           = new GUIStyle(GUI.skin.label);
            detailsLabel.fontStyle = FontStyle.Bold;
            detailsLabel.fontSize  = 12;

            details             = new GUIStyle(GUI.skin.textArea);
            details.fixedHeight = detailsBox.fixedHeight - 150;
            details.fixedWidth  = detailsBox.fixedWidth - 15;
            details.padding     = detailsBox.padding = new RectOffset(5, 5, 5, 5);

            divider = new GUIStyle(GUI.skin.box);
            divider.normal.background = Swat.MakeTextureFromColor(Color.white);
            divider.margin            = new RectOffset(25, 0, 10, 20);

            header                  = new GUIStyle(GUI.skin.label);
            header.fontSize         = 14;
            header.fixedHeight      = 25;
            header.normal.textColor = EditorGUIUtility.isProSkin ? Color.white : Color.black;
            header.fontStyle        = FontStyle.Bold;
            header.alignment        = TextAnchor.MiddleCenter;
            header.padding          = new RectOffset(0, 0, -20, 0);

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            Nexus.Self.Button("X", "Show/Hide test status details section.",
                              new Nexus.SwatDelegate(delegate() {
                IsVisible = false;
                Close();
            }), closeBox, new GUILayoutOption[] { GUILayout.Width(20), GUILayout.Height(20) });
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.LabelField("Console Message", header);
            GUILayout.Space(10);

            GUILayout.BeginVertical(detailsBox);
            EditorGUILayout.LabelField("Time:", detailsLabel, new GUILayoutOption[] { GUILayout.Width(120) });
            EditorGUILayout.SelectableLabel(Timestamp);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Type:", detailsLabel, new GUILayoutOption[] { GUILayout.Width(120) });
            EditorGUILayout.SelectableLabel(MessageType);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Verbosity:", detailsLabel, new GUILayoutOption[] { GUILayout.Width(120) });
            EditorGUILayout.SelectableLabel(MessageLevel);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Message:", detailsLabel, new GUILayoutOption[] { GUILayout.Width(120) });
            GUILayout.BeginHorizontal();
            _scrollConsoleDetails = GUILayout.BeginScrollView(_scrollConsoleDetails, false, true, GUIStyle.none, GUI.skin.verticalScrollbar);
            EditorGUILayout.SelectableLabel(Message, details);
            GUILayout.EndScrollView();
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();

            buttonGroup.margin = new RectOffset(System.Convert.ToInt32(System.Math.Round(position.width / 2)) - 25, 0, 0, 10);
            EditorGUILayout.BeginHorizontal(buttonGroup);
            if (GUILayout.Button("Close", buttons))
            {
                IsVisible = false;
                Close();
            }
            EditorGUILayout.EndHorizontal();
        }
コード例 #8
0
ファイル: Swat.cs プロジェクト: kingsteen/trilleon
        /*TODO: Fix it not being called.
         * void OnGUI() {
         *
         *      bool active = false;
         *      Event e = Event.current;
         *      if(e != null && e.type == EventType.keyDown) {
         *
         *              if(Event.current.keyCode == KeyCode.LeftShift) {
         *
         *                      active = true;
         *
         *              }
         *
         *      }
         *      if(active) {
         *
         *              for(int s = 0; s < SwatWindows.Count; s++) {
         *
         *                      bool activated = false;
         *                      for(int k = 0; k < SwatWindows[s].Shortcut.Count; k++) {
         *
         *                              if(Event.current.keyCode == SwatWindows[s].Shortcut[k]) {
         *
         *                                      activated = true;
         *
         *                              } else {
         *
         *                                      activated = false;
         *                                      break;
         *
         *                              }
         *
         *                      }
         *
         *                      if(activated) {
         *
         *                              SelectedTab = SwatWindows[s];
         *
         *                      }
         *
         *              }
         *
         *      }
         *
         * }*/

        /// <summary>
        /// Render all tabs and selected SWAT window.
        /// </summary>
        public void Render()
        {
            RenderToolTip = false;
            if (!_initialized)
            {
                Initialize(PlayModeStateChange.EnteredEditMode);
                                #if UNITY_2017_2_OR_NEWER
                EditorApplication.playModeStateChanged += Initialize;
                                #else
                EditorApplication.playmodeStateChanged += Initialize;
                                #endif
            }

            GUI.DrawTexture(new Rect(0, 0, position.width, position.height), WindowBackgroundTexture);

            if (popping)
            {
                GUI.DrawTexture(new Rect(0, 0, position.width, position.height), Swat.MakeTextureFromColor((Color) new Color32(100, 100, 100, 150)));
            }

            if (!SwatWindows.Any())
            {
                return;
            }

            _tabButton        = new GUIStyle(GUI.skin.button);
            _closeButtonWidth = 25;

            //Render tabs based on current size of window.
            _tabWidthTotal = 90 * SwatWindows.Count + _closeButtonWidth;

            if (position.width >= _tabWidthTotal)
            {
                _currentTabSize = TabSize.Large;
            }
            else if (position.width > (_tabWidthTotal / 1.25))
            {
                _currentTabSize = TabSize.Medium;
            }
            else
            {
                _currentTabSize = TabSize.Small;
            }

            _tabWidthTotal = position.width;             //Tabs will span the entire width of the Swat window.

            EditorGUILayout.BeginHorizontal();

            //Only render the tab group if this is a primary window. Sub windows (such as Favorites) will not be included in the toolbar.
            if (SelectedTab.PriorityID >= 0)
            {
                for (int tb = 1; tb < SwatWindows.Count; tb++)
                {
                    TabDetails tabDetails = SwatWindows.Find(s => s.PriorityID == tb);
                    if (tabDetails == null)
                    {
                        continue;                         //Hidden window, so no tabs.
                    }
                    RenderTab(tabDetails);
                }

                List <TabDetails> priorityZeros = SwatWindows.FindAll(s => s.PriorityID == 0);
                for (int p = 0; p < priorityZeros.Count; p++)
                {
                    RenderTab(priorityZeros[p]);
                }
            }

            _tabButton = new GUIStyle(GUI.skin.button);
            _tabButton.normal.textColor  = SelectedTab.PriorityID >= 0 ? Color.red : TextGreen;
            _tabButton.margin            = new RectOffset(-2, -2, 0, 0);
            _tabButton.fontSize          = 14;
            _tabButton.alignment         = TextAnchor.MiddleCenter;
            _tabButton.normal.background = TabButtonBackgroundTexture;
            _closeButtonWidth            = SelectedTab.PriorityID >= 0 ? _closeButtonWidth : 50;

            Nexus.Self.Button(SelectedTab.PriorityID >= 0 ? "X" : "<<<", "Show/Hide currently-selected game object in heirarchy window.",
                              new Nexus.SwatDelegate(delegate() {
                if (SelectedTab.PriorityID >= 0)
                {
                    this.CloseSwat();
                }
                else
                {
                    SelectedTab = LastSelectedTab;
                }
            }), _tabButton, new GUILayoutOption[] { GUILayout.Height(25), GUILayout.Width(_closeButtonWidth) });

            EditorGUILayout.EndHorizontal();

            if (SelectedTab != LastSelectedTab)
            {
                _scroll = new Vector2(0, 0);
                SelectedTab.Window.OnTabSelected();
            }

            if (!SelectedTab.OverrideScroll)
            {
                _scroll = EditorGUILayout.BeginScrollView(_scroll);
            }

            try {
                if (SelectedTab.Window == null)
                {
                    return;
                }
                if (LastSelectedTab != SelectedTab && SelectedTab.PriorityID >= 0)
                {
                    LastSelectedTab = SwatWindows.Find(x => x.Window == SelectedTab.Window);
                }
                SelectedTab.Window.Render();
                RenderAnyError();
                RenderLoadingOverlay();
            } catch (Exception e) {
                if (IsValidError(e.Message))
                {
                    throw e;
                }
            }

            if (!SelectedTab.OverrideScroll)
            {
                EditorGUILayout.EndScrollView();
            }

            RenderToolTipIfHovering(position);
        }
コード例 #9
0
        public override void OnGUI()
        {
            if (Nexus.Self == null || Nexus.Self.SelectedTab.Window.GetType() != constraint)
            {
                Close();
                return;
            }

            if (lastWindowWidth != Nexus.Self.position.width)
            {
                positionWindow = true;
            }

            if (positionWindow)
            {
                positionWindow  = false;
                lastWindowWidth = Nexus.Self.position.width;
                PositionWindow();
            }

            GUI.DrawTexture(new Rect(0, 0, position.width, position.height), Swat.MakeTextureFromColor(Color.gray));

            scrollBar        = new GUIStyle();
            scrollBar.margin = new RectOffset(25, 20, 0, 0);

            divider = new GUIStyle(GUI.skin.box);
            divider.normal.background = Swat.MakeTextureFromColor(Color.white);
            divider.margin            = new RectOffset(25, 0, 10, 20);

            toggleGroup        = new GUIStyle();
            toggleGroup.margin = new RectOffset(12, 0, 0, 0);

            toggle                  = new GUIStyle(GUI.skin.label);
            toggle.padding          = new RectOffset(35, 0, 0, 0);
            toggle.normal.textColor = Color.white;
            toggle.fixedWidth       = 25;
            toggle.fixedHeight      = 25;

            toggleLabel = new GUIStyle(GUI.skin.label);
            toggleLabel.normal.textColor = Color.white;

            header                  = new GUIStyle(GUI.skin.label);
            header.fontSize         = 15;
            header.fixedHeight      = 20;
            header.normal.textColor = Color.white;
            header.fontStyle        = FontStyle.Bold;
            header.alignment        = TextAnchor.MiddleCenter;

            buttons                   = new GUIStyle(GUI.skin.button);
            buttons.fixedHeight       = buttonHeight;
            buttons.fixedWidth        = buttonWidth;
            buttons.normal.textColor  = Color.white;
            buttons.normal.background = Swat.MakeTextureFromColor((Color) new Color32(80, 80, 80, 255));

            buttonGroup = new GUIStyle();

            EditorGUILayout.BeginVertical();

            GUILayout.Space(15);
            EditorGUILayout.LabelField("Select Categories", header);
            GUILayout.Box(string.Empty, divider, new GUILayoutOption[] { GUILayout.Height(1), GUILayout.Width(position.width - 50) });

            scrollY = EditorGUILayout.BeginScrollView(scrollY, scrollBar);

            for (int x = 0; x < Cats.Count; x++)
            {
                EditorGUILayout.BeginHorizontal(toggleGroup);
                toggle.padding  = CatsSelected[x] ? new RectOffset(0, 0, -6, 0) : new RectOffset(2, 0, -2, 0);
                toggle.fontSize = CatsSelected[x] ? 25 : 18;
                if (GUILayout.Button(CatsSelected[x] ? Swat.TOGGLE_ON : Swat.TOGGLE_OFF, toggle))
                {
                    CatsSelected[x] = !CatsSelected[x];
                }

                GUILayout.Space(-15);
                if (GUILayout.Button(string.Format("  {0}", Cats[x]), toggleLabel))
                {
                    CatsSelected[x] = !CatsSelected[x];                     //Toggle accompanying checkbox.
                }
                EditorGUILayout.EndHorizontal();
                GUILayout.Space(-10);
            }

            EditorGUILayout.EndScrollView();

            GUILayout.Box(string.Empty, divider, new GUILayoutOption[] { GUILayout.Height(1), GUILayout.Width(position.width - 50) });

            GUILayout.Space(15);
            EditorGUILayout.BeginHorizontal();
            GUILayout.Space(50);
            toggle.padding  = AutomationMaster.DisregardDependencies ? new RectOffset(0, 0, -6, 0) : new RectOffset(2, 0, -2, 0);
            toggle.fontSize = AutomationMaster.DisregardDependencies ? 25 : 18;
            if (GUILayout.Button(AutomationMaster.DisregardDependencies ? Swat.TOGGLE_ON : Swat.TOGGLE_OFF, toggle))
            {
                AutomationMaster.DisregardDependencies = !AutomationMaster.DisregardDependencies;
            }
            GUILayout.Space(-10);
            if (GUILayout.Button("Also Run Dependencies? ", toggleLabel))
            {
                AutomationMaster.DisregardDependencies = !AutomationMaster.DisregardDependencies;                 //Toggle accompanying checkbox.
            }
            EditorGUILayout.EndHorizontal();
            GUILayout.Space(15);

            float margin = (position.width - (buttonWidth * 2)) / 2;

            buttonGroup.margin = new RectOffset((int)margin, (int)margin, 0, 10);

            EditorGUILayout.BeginHorizontal(buttonGroup);

            if (GUILayout.Button("Cancel", buttons))
            {
                Nexus.Overseer.Master_Editor_Override = new KeyValuePair <string, string>();
                IsVisible = false;
                Close();
            }
            if (GUILayout.Button("Launch", buttons))
            {
                Nexus.Overseer.ignoreDependentTestsForRun = true;
                string command   = string.Empty;
                string testsOnly = string.Empty;
                for (int x = 0; x < Cats.Count; x++)
                {
                    if (CatsSelected[x])
                    {
                        if (Cats[x].StartsWith("*"))
                        {
                            string cat = Cats[x].Replace("*", string.Empty);
                            List <KeyValuePair <string, List <KeyValuePair <bool, string> > > > match = Nexus.Self.Favorites.FavoritesList.FindAll(f => f.Key == cat);
                            if (match.Count == 0)
                            {
                                SimpleAlert.Pop(string.Format("Cannot find data for Favorite, \"{0}\", selected in multi-category launch.", cat), null);
                                return;
                            }
                            else
                            {
                                List <KeyValuePair <bool, string> > contents = match.First().Value;
                                for (int c = 0; c < contents.Count; c++)
                                {
                                    if (contents[c].Key)
                                    {
                                        //If the next item in this list is not a category, then the current category is merely a header for the test list that follows, and should not be included.
                                        if (c + 1 < contents.Count && !contents[c + 1].Key)
                                        {
                                            continue;
                                        }

                                        command += string.Format("{0},", contents[c].Value);
                                    }
                                    else
                                    {
                                        testsOnly += string.Format("{0},", contents[c].Value);
                                    }
                                }
                            }
                        }
                        else
                        {
                            string category = string.Empty;
                            if (Cats[x].Contains("("))
                            {
                                category = Cats[x].Replace("<", string.Empty).Replace(">", string.Empty).Split('(')[1].Trim(')');
                            }
                            else
                            {
                                category = Cats[x].Replace("<", string.Empty).Replace(">", string.Empty);
                            }
                            command += string.Format("{0},", category);
                        }
                    }
                }
                command = command.Trim(',').Replace("*", "@");                 //@ represents favorite when * represents single test.
                if (testsOnly.Length > 0)
                {
                    command = string.Format("&&{0}%{1}", command, testsOnly);
                }

                Close();
                Nexus.Self.Tests.LaunchTests(command, "class");
                IsVisible = false;
                AutomationMaster.DisregardDependencies = true;                 //Ignore dependencies.
            }

            EditorGUILayout.EndHorizontal();
        }
コード例 #10
0
        public override void Render()
        {
            console = new GUIStyle(GUI.skin.box);
            console.normal.background = Swat.MakeTextureFromColor((Color) new Color32(100, 100, 100, 255));
            console.wordWrap          = true;
            console.normal.textColor  = Color.white;
            console.padding           = new RectOffset(10, 20, 0, 0);
            console.fontSize          = 15;
            console.alignment         = TextAnchor.MiddleLeft;

            description                  = new GUIStyle(GUI.skin.label);
            description.wordWrap         = true;
            description.margin           = new RectOffset(10, 10, 0, 0);
            description.padding          = new RectOffset(0, 0, 5, 5);
            description.normal.textColor = Swat.WindowDefaultTextColor;
            description.fontSize         = 12;

            args                  = new GUIStyle(GUI.skin.label);
            args.wordWrap         = true;
            args.margin           = new RectOffset(10, 10, 0, 0);
            args.normal.textColor = Swat.WindowDefaultTextColor;
            args.fontSize         = 11;

            editorName                  = new GUIStyle(GUI.skin.label);
            editorName.fontSize         = 16;
            editorName.fixedHeight      = 20;
            editorName.fontStyle        = FontStyle.Bold;
            editorName.padding          = new RectOffset(8, 0, 0, 0);
            editorName.normal.textColor = Swat.WindowDefaultTextColor;

            load = new GUIStyle(GUI.skin.box);
            load.normal.background = Swat.MakeTextureFromColor((Color) new Color32(75, 75, 75, 255));
            load.normal.textColor  = Color.white;
            load.fontSize          = 18;
            load.alignment         = TextAnchor.MiddleCenter;

            open                   = new GUIStyle(GUI.skin.button);
            open.fontSize          = 14;
            open.fixedHeight       = 28;
            open.fixedWidth        = 100;
            open.margin            = new RectOffset(10, 10, 0, 0);
            open.normal.textColor  = Swat.WindowDefaultTextColor;
            open.normal.background = open.active.background = open.focused.background = Swat.ToggleButtonBackgroundSelectedTexture;

            variables                  = new GUIStyle(GUI.skin.textField);
            variables.fontSize         = 12;
            variables.margin           = new RectOffset(10, 10, 0, 0);
            variables.normal.textColor = Swat.WindowDefaultTextColor;

            _scroll = GUILayout.BeginScrollView(_scroll);

            GUILayout.Space(!Application.isPlaying ? 15 : 45);
            EditorGUILayout.LabelField("Filter (Search for command name or description/purpose matching)", description);
            search = EditorGUILayout.TextField(search, variables, new GUILayoutOption[] { GUILayout.MaxWidth(400) });
            GUILayout.Space(25);

            int inputFieldId = 0;

            for (int x = 0; x < Commands.Count; x++)
            {
                Command command       = Commands[x];
                string  longestAlias  = string.Empty;
                bool    filterActive  = !string.IsNullOrEmpty(search.Trim());
                bool    filterMatched = false;
                for (int l = 0; l < command.Aliases.Count; l++)
                {
                    if (filterActive && (command.Aliases[l].ToLower().Contains(search) || command.Purpose.ToLower().Contains(search)))
                    {
                        filterMatched = true;
                    }
                    longestAlias = command.Aliases[l].Length > longestAlias.Length ? command.Aliases[l] : longestAlias;
                }

                if (filterActive && !filterMatched)
                {
                    continue;                     //Don't render this information; no match found.
                }

                EditorGUILayout.LabelField(longestAlias, editorName);
                GUILayout.Space(4);
                EditorGUILayout.LabelField(command.Purpose, description);
                GUILayout.Space(6);

                if (command.Args.Count > 0)
                {
                    for (int a = 0; a < command.Args.Count; a++)
                    {
                        EditorGUILayout.LabelField(string.Format("(Arg {0}) <{1}> {2}", a, command.Args[a].Key, command.Args[a].Value), description);
                        GUILayout.Space(2);
                    }

                    GUILayout.Space(4);
                    if (VariableInputFields.Count == inputFieldId)
                    {
                        VariableInputFields.Add(string.Empty);
                    }
                    VariableInputFields[inputFieldId] = EditorGUILayout.TextField(VariableInputFields[inputFieldId], variables, new GUILayoutOption[] { GUILayout.MaxWidth(400) });
                    GUILayout.Space(8);
                    inputFieldId++;
                }
                if (GUILayout.Button("Launch", open))
                {
                    if (!EditorApplication.isPlaying)
                    {
                        SimpleAlert.Pop("Console commands can only be executed when Play Mode is active.", null);
                    }
                    else
                    {
                        ConsoleCommands.SendCommand(string.Format("{0} {1}", longestAlias, VariableInputFields[inputFieldId - 1]));                         //Minus one because we are handling and incrementing this input before this onClick is implemented.
                        showCommandLog = true;
                    }
                }
                GUILayout.Space(20);
            }
            GUILayout.Space(40);
            GUILayout.EndScrollView();

            string arrow = showCommandLog ? "▲" : "▼";

            if (Application.isPlaying)
            {
                load.padding  = showCommandLog ? new RectOffset(0, 0, -8, 0) : new RectOffset(0, 0, 0, 0);
                load.fontSize = 15;
                if (GUI.Button(new Rect(0, 24, Nexus.Self.position.width, 30), string.Format("{0}    Show Command Log    {0}", arrow), load))
                {
                    showCommandLog = !showCommandLog;
                }
                if (showCommandLog)
                {
                    //_scrollConsole = GUI.BeginScrollView(new Rect(0, 30, Nexus.Self.position.width, 400), _scrollConsole, new Rect(0, 30, Nexus.Self.position.width, 400));
                    GUI.TextArea(new Rect(0, 50, Nexus.Self.position.width, 400), ConsoleCommands.ConsoleLog.text, console);
                    //GUILayout.EndScrollView();
                }
            }
        }