public void OnRightClick(Vector2 mousePosNodeSpace)
        {
            WirePinDisplayer clicked = null;

            foreach (WirePinDisplayer inputs in InputPinsDisplayer)
            {
                if (inputs.InteractionRect.Contains(mousePosNodeSpace))
                {
                    clicked = inputs;
                }
            }
            foreach (WirePinDisplayer outputs in OutputPinsDisplayer)
            {
                if (outputs.InteractionRect.Contains(mousePosNodeSpace))
                {
                    clicked = outputs;
                }
            }
            if (clicked != null)
            {
                clicked.OnRightClick();
            }
            else
            {
                GenericMenu menu = GetContextMenu();
                if (menu != null)
                {
                    menu.ShowAsContext();
                }
            }
        }
        public virtual void DrawWindow()
        {
            if (RenderedNode == null)
            {
                return;
            }
            int inputsCount  = InputPinsDisplayer.Count;
            int outputsCount = OutputPinsDisplayer.Count;
            int rowCount     = Math.Max(inputsCount, outputsCount);

            GUILayout.BeginVertical();
            for (int i = 0; i < rowCount; i++)
            {
                GUILayout.BeginHorizontal();

                WirePinDisplayer renderedInput = null;
                if (i < inputsCount)
                {
                    renderedInput = InputPinsDisplayer[i];
                }
                if (renderedInput != null)
                {
                    renderedInput.DrawAsInput();
                }

                WirePinDisplayer renderedOutput = null;
                if (i < outputsCount)
                {
                    renderedOutput = OutputPinsDisplayer[i];
                }
                if (renderedOutput != null)
                {
                    GUILayout.FlexibleSpace();
                    renderedOutput.DrawAsOutput();
                }
                GUILayout.EndHorizontal();
            }
            DoCustomDrawing();

            GUILayout.EndVertical();

            RenderedNode.DisplayerPosition = WindowRect.position;
        }
        public virtual void DrawWires()
        {
            foreach (WirePinDisplayer input in InputPinsDisplayer) // The wires are rendered by the node having the end of the connection (inputs)
            {
                WirePin          inputPin        = input.DisplayedWirePin;
                WirePinDisplayer targetDisplayer = (WirePinDisplayer)inputPin.WirePinDisplayer;

                Rect targetRect = new Rect(targetDisplayer.InteractionRect.position + WindowRect.position, targetDisplayer.InteractionRect.size);

                if (inputPin.IsConnected)
                {
                    WirePinDisplayer sourceDisplayer = (WirePinDisplayer)inputPin.GetConnectedPin().WirePinDisplayer;
                    Rect             sourceRect      = new Rect(
                        sourceDisplayer.InteractionRect.position + sourceDisplayer.OwnerDisplayer.WindowRect.position,
                        targetDisplayer.InteractionRect.size
                        );
                    WireGraphEditor.DrawNodeCurve(sourceRect, targetRect, WDEngine.ClassicWireColor);
                }
            }
        }