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(); }
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); 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); }