/// <summary> /// Test conditionals are placed here. /// </summary> /// <param name="state"></param> /// <returns>true or false depending if transition conditions are met.</returns> public override string UpdateConditionalTest(baseState state) { artDisplayStates dState = (artDisplayStates)state; if (dState.SaveDataBool) { return(m_ChangeStateName); } return(null); }
/// <summary> /// Draws the "Display" window of this window. Everything is active. /// </summary> /// <param name="id"></param> void DrawNodeWindow(int id, artConfigurationData configData) { if (Event.current.button == 0 && Event.current.isMouse && ResizeBodyHover) { } if (Event.current.button == 1 && Event.current.isMouse) { //if (m_State != null && m_State is editorDisplayWindowsState) ArtimechEditor theStateMachineEditor = (ArtimechEditor)m_State.m_UnityObject; if (IsWithinUsingPanZoomTransform(Event.current.mousePosition, theStateMachineEditor.TransMtx)) { artDisplayStates dState = (artDisplayStates)m_State; if (dState != null && Event.current.type == EventType.MouseDown) { GenericMenu menu = new GenericMenu(); menu.AddItem(new GUIContent("Add Conditional/Empty Conditional"), false, dState.AddConditionalCallback, new editorDisplayWindowsState.menuData("Assets/Scripts/Common/statemachine/state_examples/stateConditionalTemplate.cs", "stateConditionalTemplate")); menu.AddItem(new GUIContent("Add Conditional/Subscription Conditional"), false, dState.AddConditionalCallback, new editorDisplayWindowsState.menuData("Assets/Scripts/Common/statemachine/state_examples/stateCondSubExample.cs", "stateCondSubExample")); menu.AddSeparator(""); menu.AddItem(new GUIContent("Edit Script"), false, dState.EditScriptCallback, this); menu.AddSeparator(""); menu.AddItem(new GUIContent("Refactor State Class"), false, this.RefactorClassCallback, this); //stateEditorUtils.SelectedNode = this; menu.ShowAsContext(); Event.current.Use(); } //Debug.Log("--------------------------------------"); return; } } //draws background and outline. //int lineWidth = 2; /* Color lineColor = new Color(0, 0.3f, 0, 1); * Color backGroundColor = new Color(0.0f, 0.8f, 0.8f, 1.0f);*/ Rect rect = new Rect(m_WinRect.x, m_WinRect.y, WinRect.width, WinRect.height); artGUIUtils.DrawRect(rect, configData.WindowOutlineLineWidth, configData.WindowLineColor, configData.StateWindowColor); DrawStateContent(configData); //draw the exit button in the title bar Color shadowCol = new Color(0, 0, 0, 0.2f); float xOffset = 8.0f; float yOffset = 9.0f; float boxSize = 8; //create the close button rectangle m_CloseButtonRect = new Rect(WinRect.x + WinRect.width - (xOffset + (boxSize * 0.5f)), WinRect.y + yOffset - (boxSize * 0.5f), boxSize, boxSize); if (m_CloseButtonRect.Contains(Event.current.mousePosition)) { artGUIUtils.DrawRect(m_CloseButtonRect, 2, Color.black, Color.red); } else { artGUIUtils.DrawRect(m_CloseButtonRect, 2, Color.black, Color.clear); } artGUIUtils.DrawX(new Vector3(WinRect.x + WinRect.width - (xOffset * 0.95f), WinRect.y + yOffset * 0.95f, 0), boxSize - 1, boxSize - 1, 2, shadowCol); artGUIUtils.DrawX(new Vector3(WinRect.x + WinRect.width - (xOffset * 1.0f), WinRect.y + yOffset * 1.0f, 0), boxSize - 1, boxSize - 1, 1, Color.black); //draw the resizer const float initSizerSize = 15; float sizerSize = initSizerSize; artGUIUtils.DrawWindowSizer(new Vector3(WinRect.x + WinRect.width - 2, WinRect.y + this.WinRect.height - 2, 0), sizerSize - 1, sizerSize - 3, 2, Color.grey); sizerSize = 10; artGUIUtils.DrawWindowSizer(new Vector3(WinRect.x + WinRect.width - 2, WinRect.y + this.WinRect.height - 2, 0), sizerSize - 1, sizerSize - 3, 2, Color.grey); sizerSize = 5; artGUIUtils.DrawWindowSizer(new Vector3(WinRect.x + WinRect.width - 2, WinRect.y + this.WinRect.height - 2, 0), sizerSize - 1, sizerSize - 3, 2, Color.grey); const float titleHeight = 15; //create the main body rectangle. m_MainBodyRectA = new Rect(WinRect.x, WinRect.y + titleHeight, WinRect.width, WinRect.height - initSizerSize - titleHeight); //m_MainBodyRectB = new Rect(WinRect.x, WinRect.y + titleHeight, WinRect.width - initSizerSize, WinRect.y - WinRect.height); //main body of the window EditorGUIUtility.AddCursorRect(m_MainBodyRectA, MouseCursor.MoveArrow); // EditorGUIUtility.AddCursorRect(m_MainBodyRectB, MouseCursor.MoveArrow); //resize m_ResizeBodyRect = new Rect(new Rect(WinRect.x + WinRect.width - initSizerSize, WinRect.y + WinRect.height - initSizerSize, initSizerSize, initSizerSize)); EditorGUIUtility.AddCursorRect(m_ResizeBodyRect, MouseCursor.ResizeUpLeft); //title const float rightMarginSize = 15; m_TitleRect = new Rect(WinRect.x, WinRect.y, WinRect.width - rightMarginSize, titleHeight); EditorGUIUtility.AddCursorRect(m_TitleRect, MouseCursor.Text); //close box EditorGUIUtility.AddCursorRect(m_CloseButtonRect, MouseCursor.ArrowMinus); //DrawStateContent(); UpdateMouseHover(Event.current.mousePosition); //artGUIUtils.DrawX(m_LinePos, 10, 10, 1, Color.black); //GUI.DragWindow(); }