UnityEditor.Graphs.Styles.GetNodeStyle C# (CSharp) Method

GetNodeStyle() public static method

public static GetNodeStyle ( string styleName, Color color, bool on ) : GUIStyle
styleName string
color Color
on bool
return UnityEngine.GUIStyle
        public static GUIStyle GetNodeStyle(string styleName, Color color, bool on)
        {
            string key = string.Format("flow {0} {1}{2}", styleName, (int) color, !on ? "" : " on");
            if (!m_NodeStyleCache.ContainsKey(key))
            {
                m_NodeStyleCache[key] = key;
            }
            return m_NodeStyleCache[key];
        }

Usage Example

Beispiel #1
0
 public virtual void OnGraphGUI()
 {
     this.m_Host.BeginWindows();
     foreach (Node current in this.m_Graph.nodes)
     {
         Node         n2    = current;
         bool         on    = this.selection.Contains(current);
         Styles.Color color = (!current.nodeIsInvalid) ? current.color : Styles.Color.Red;
         current.position = GUILayout.Window(current.GetInstanceID(), current.position, delegate
         {
             this.NodeGUI(n2);
         }, current.title, Styles.GetNodeStyle(current.style, color, on), new GUILayoutOption[]
         {
             GUILayout.Width(0f),
             GUILayout.Height(0f)
         });
     }
     this.m_Host.EndWindows();
     this.edgeGUI.DoEdges();
     this.edgeGUI.DoDraggedEdge();
     this.DragSelection(new Rect(-5000f, -5000f, 10000f, 10000f));
     this.ShowContextMenu();
     this.HandleMenuEvents();
 }