private void DoNode (Node node)
		{
			GUIStyle style = FsmEditorStyles.GetNodeStyle (node.color, selection.Contains (node), node.GetType () == typeof(StateMachine));
			string state = string.Empty;
			if (FsmEditor.Active.Owner != null && FsmEditor.Active.Owner.ActiveNode && (node == FsmEditor.Active.Owner.ActiveNode || node == FsmEditor.Active.Owner.AnyState || node == FsmEditor.Active.Owner.ActiveNode.Parent) && EditorApplication.isPlaying) {
				if (!FsmEditor.Active.Owner.IsPaused && !FsmEditor.Active.Owner.IsDisabled) {
					state = "[Active]";
				} else if (FsmEditor.Active.Owner.IsPaused) {
					state = "[Paused]";
				} else if (FsmEditor.Active.Owner.IsDisabled) {
					state = "[Disabled]";
				}

			}

			GUI.Box (node.position, node.Name + state, style);

			if (ErrorChecker.HasErrors (node) && Event.current.type != EventType.Layout) {
				Rect rect = node.position;
				if (node is StateMachine) {
					rect.x += 10;
					rect.y += 6;
				}
				GUI.Label (rect, "", "CN EntryError");
			}

			if (node is State && (node as State).IsSequence) {
				Rect rect = node.position;
				rect.x += 25;
				rect.y += 3;
				GUI.Label (rect, EditorGUIUtility.FindTexture ("d_PlayButtonProfile"));			
			} 

			if (PreferencesEditor.GetBool (Preference.ShowStateDescription)) {
				GUILayout.BeginArea (new Rect (node.position.x, node.position.y + node.position.height, node.position.width, 500));
				GUILayout.Label (node.comment, FsmEditorStyles.wrappedLabel);
				GUILayout.EndArea ();
			}

			if (DisplayProgress (node)) {
				Rect rect = new Rect (node.position.x + 5, node.position.y + 20, debugProgress, 5);

				if (node == FsmEditor.Active.Owner.ActiveNode.Parent) {
					rect.y += 5;
					rect.x += 15;
					rect.width *= 0.8f;
				}
				GUI.Box (rect, "", "MeLivePlayBar");
			}	

		}
Example #2
0
        protected override void OnHeaderGUI()
        {
            GUILayout.BeginVertical("IN BigTitle");
            EditorGUIUtility.labelWidth = 50;

            GUILayout.BeginHorizontal();

            node.Name = EditorGUILayout.TextField("Name", node.Name);
            if (node.GetType() == typeof(State) && !node.IsStartNode)
            {
                GUIStyle style = FsmEditorStyles.GetNodeStyle(node.color, false, false);
                Rect     rect  = GUILayoutUtility.GetRect(25, 17, style);
                rect.y += 1;
                if (GUI.Button(rect, GUIContent.none, style))
                {
                    GenericMenu menu = new GenericMenu();
                    foreach (NodeColor color in System.Enum.GetValues(typeof(NodeColor)))
                    {
                        if (color != NodeColor.Aqua && color != NodeColor.Orange)
                        {
                            int mColor = (int)color;
                            menu.AddItem(new GUIContent(color.ToString()), node.color == mColor, delegate() {
                                node.color = mColor;
                            });
                        }
                    }
                    menu.ShowAsContext();
                }
            }
            GUILayout.EndHorizontal();
            GUILayout.Label("Description:");
            node.comment = EditorGUILayout.TextArea(node.comment, GUILayout.MinHeight(45));
            GUILayout.EndVertical();

            if (GUI.changed)
            {
                EditorUtility.SetDirty(node);
                FsmEditor.RepaintAll();
            }
        }