public Node(Vector2 position, Vector2 dimensions, NodeStyleInfo styleInfo, Action <ConnectionPointBase> onClickInPoint, Action <ConnectionPointBase> onClickOutPoint, Action <Node> onClickRemoveNode, string inPointId = null, string outPointId = null) { rect = new Rect(position.x, position.y, dimensions.x, dimensions.y); inPoint = new NodeConnectionPoint(this, ConnectionPointType.In, styleInfo.inPointStyle, onClickInPoint, inPointId); outPoint = new NodeConnectionPoint(this, ConnectionPointType.Out, styleInfo.outPointStyle, onClickOutPoint, outPointId); OnRemoveNode = onClickRemoveNode; }
public static NodeStyleInfo CreateDefaultNodeStyle() { var defaultNodeStyle = new NodeStyleInfo(); defaultNodeStyle.defaultNodeStyle = new GUIStyle(); defaultNodeStyle.defaultNodeStyle.normal.background = EditorGUIUtility.Load(defaultSkinPath) as Texture2D; defaultNodeStyle.defaultNodeStyle.border = new RectOffset(defaultNodeSize, defaultNodeSize, defaultNodeSize, defaultNodeSize); defaultNodeStyle.selectedNodeStyle = new GUIStyle(); defaultNodeStyle.selectedNodeStyle.normal.background = EditorGUIUtility.Load(defaultSkinPath) as Texture2D; defaultNodeStyle.selectedNodeStyle.border = new RectOffset(defaultNodeSize, defaultNodeSize, defaultNodeSize, defaultNodeSize); defaultNodeStyle.inPointStyle = new GUIStyle(); defaultNodeStyle.inPointStyle.normal.background = EditorGUIUtility.Load(defaultInPointSkinPath) as Texture2D; defaultNodeStyle.inPointStyle.active.background = EditorGUIUtility.Load(defaultInPointActiveSkinPath) as Texture2D; defaultNodeStyle.inPointStyle.border = new RectOffset(defaultPointSize, defaultPointSize, defaultNodeSize, defaultNodeSize); defaultNodeStyle.outPointStyle = new GUIStyle(); defaultNodeStyle.outPointStyle.normal.background = EditorGUIUtility.Load(defaultOutPointSkinPath) as Texture2D; defaultNodeStyle.outPointStyle.active.background = EditorGUIUtility.Load(defaultOutPointActiveSkinPath) as Texture2D; defaultNodeStyle.outPointStyle.border = new RectOffset(defaultPointSize, defaultPointSize, defaultNodeSize, defaultNodeSize); return(defaultNodeStyle); }
protected virtual void OnEnable() { defaultNodeStyle = EditorConfig.CreateDefaultNodeStyle(); }