/// <summary>
        /// Draws the event name in the supplied rect.
        /// <param name="position">The position in the screen to draw the event name.</param>
        /// </summary>
        public void DrawEventName(Rect position)
        {
            // It's not a repaint event?
            if (Event.current.type != EventType.Repaint)
            {
                return;
            }

            // Is there a valid styles?
            if (m_Styles == null)
            {
                m_Styles = new TransitionGUI.Styles();
            }

            // It's the active transition?
            bool on = m_Transition == BehaviourWindow.activeTransition;
            // Stores the event name
            string eventName;

            // Has errors?
            if (m_FsmEvent == null || m_FsmEvent.isInvalid)
            {
                eventName = "None";

                var oldGUIColor = GUI.color;

                GUI.color = on ? GUI.skin.settings.selectionColor : Color.red;
                var pingRect = position;
                pingRect.yMax -= 4f;

                m_Styles.ping.Draw(pingRect, "", false, false, false, false);

                GUI.color = oldGUIColor;
            }
            else
            {
                eventName = m_FsmEvent.name;
            }

            // Draw event name
            m_Styles.label.Draw(position, eventName, false, false, on, on);

            // Draw pins
            bool hasDestination = m_Destination != null;

            m_Styles.pin.Draw(new Rect(4, position.y, 2, defaultHeight), false, false, hasDestination, false);
            m_Styles.pin.Draw(new Rect(StateGUI.defaultWidth + 2, position.y, 2, defaultHeight), false, false, hasDestination, false);
        }
Exemple #2
0
        /// <summary>
        /// Draws the event name in the supplied rect.
        /// <param name="position">The position in the screen to draw the event name.</param>
        /// </summary>
        public void DrawEventName (Rect position) {
            // It's not a repaint event?
            if (Event.current.type != EventType.Repaint) 
                return;

            // Is there a valid styles?
            if (m_Styles == null)
                m_Styles = new TransitionGUI.Styles();

            // It's the active transition?
            bool on = m_Transition == BehaviourWindow.activeTransition;
            // Stores the event name
            string eventName;

            // Has errors?
            if (m_FsmEvent == null || m_FsmEvent.isInvalid) {
                eventName = "None";

                var oldGUIColor = GUI.color;
                
                GUI.color = on ? GUI.skin.settings.selectionColor : Color.red;
                var pingRect = position;
                pingRect.yMax -= 4f;

                m_Styles.ping.Draw(pingRect, "", false, false, false, false);

                GUI.color = oldGUIColor;
            }
            else
                eventName = m_FsmEvent.name;

            // Draw event name
            m_Styles.label.Draw(position, eventName, false, false,  on, on);

            // Draw pins
            bool hasDestination = m_Destination != null;
            m_Styles.pin.Draw(new Rect(4, position.y, 2, defaultHeight), false, false, hasDestination, false);
            m_Styles.pin.Draw(new Rect(StateGUI.defaultWidth + 2, position.y, 2, defaultHeight), false, false, hasDestination, false);
        }