private void DrawHeader() { Rect titlePosition = GUILayoutUtility.GetRect(GUIContent.none, BTEditorStyle.RegionBackground, GUILayout.ExpandWidth(true), GUILayout.Height(15.0f)); titlePosition.x -= 19; titlePosition.y -= 2; titlePosition.width += 28; Rect optionsButtonPosition = new Rect(titlePosition.xMax - 28.0f, titlePosition.y, 20.0f, 20.0f); DrawCategoryHeader(titlePosition, m_target.Title); if (GUI.Button(optionsButtonPosition, BTEditorStyle.OptionsIcon, EditorStyles.label)) { GenericMenu menu = BTContextMenuFactory.CreateNodeInspectorContextMenu(m_target); menu.DropDown(new Rect(Event.current.mousePosition, Vector2.zero)); } GUILayout.Space(2.5f); DrawSeparator(); // show obsolete tip if (BTNodeObsoleteFactory.IsObsolete(m_target)) { string tip = BTNodeObsoleteFactory.GetTipString(m_target); EditorGUILayout.HelpBox(tip, MessageType.Warning); GUILayout.Space(2.5f); DrawSeparator(); } // show reference of class. string reference = BTNodeHelpBoxFactory.GetHelpString(m_target); if (!string.IsNullOrEmpty(reference)) { EditorGUILayout.LabelField(reference, BTEditorStyle.HelpBox); GUILayout.Space(2.5f); DrawSeparator(); } //m_target.Name = EditorGUILayout.TextField("Name", m_target.Name); EditorGUILayout.LabelField("Comment"); m_target.Comment = EditorGUILayout.TextArea(m_target.Comment, BTEditorStyle.MultilineTextArea); if (m_graphNode.Parent != null && m_graphNode.Parent.Node is WeightedRandom) { EditorGUILayout.Space(); m_target.Weight = EditorGUILayout.Slider("Weight", m_target.Weight, 0.0f, 1.0f); } GUILayout.Space(2.5f); DrawSeparator(); EditorGUILayout.Space(); }
private void DrawConstraints() { EditorGUILayout.Space(); DrawSeparator(); for (int i = 0; i < m_target.Constraints.Count; i++) { Constraint constraint = m_target.Constraints[i]; Rect headerPos = GUILayoutUtility.GetRect(0, 18.0f, GUILayout.ExpandWidth(true)); Rect foldoutPos = new Rect(headerPos.x, headerPos.y, 20.0f, headerPos.height); Rect labelPos = new Rect(foldoutPos.xMax, headerPos.y, headerPos.width - 56.0f, headerPos.height); Rect togglePos = new Rect(labelPos.xMax - 40, headerPos.y, 18.0f, headerPos.height); Rect toggleLabelPos = new Rect(togglePos.xMax - 5, headerPos.y, 45.0f, headerPos.height); Rect optionsButtonPos = new Rect(togglePos.xMax + 40, headerPos.y, 18.0f, headerPos.height); constraint.IsExpanded = EditorGUI.Foldout(foldoutPos, constraint.IsExpanded, GUIContent.none); EditorGUI.LabelField(labelPos, constraint.Title, BTEditorStyle.BoldLabel); constraint.InvertResult = EditorGUI.Toggle(togglePos, GUIContent.none, constraint.InvertResult); EditorGUI.LabelField(toggleLabelPos, "invert", BTEditorStyle.BoldLabel); if (GUI.Button(optionsButtonPos, BTEditorStyle.OptionsIcon, EditorStyles.label)) { GenericMenu menu = BTContextMenuFactory.CreateConstraintContextMenu(m_target, i); menu.DropDown(new Rect(BTEditorCanvas.Current.Event.mousePosition, Vector2.zero)); } if (constraint.IsExpanded) { var constraintInspector = GetConstraintInspector(constraint); constraintInspector.OnInspectorGUI(); } // show obsolete tip if (BTNodeObsoleteFactory.IsObsolete(constraint)) { string tip = BTNodeObsoleteFactory.GetTipString(constraint); EditorGUILayout.HelpBox(tip, MessageType.Warning); GUILayout.Space(2.5f); DrawSeparator(); } DrawSeparator(); } }