コード例 #1
0
    public Rect GetPinRect(int ID)
    {
        EditorPin    Pin      = Pins[ID];
        EPinLinkType LinkType = Pin.GetPinLinkType();

        int TypeIndex = 1;

        for (int Index = 0; Index < ID; ++Index)
        {
            if (Pins[Index].GetPinLinkType() == LinkType)
            {
                ++TypeIndex;
            }
        }

        Rect    ReturnRect   = new Rect();
        Vector2 RectPosition = new Vector2();

        ReturnRect.width  = _renderData.PinSize;
        ReturnRect.height = _renderData.PinSize;
        RectPosition.y    = _renderData.NodeRect.position.y + _renderData.PinVerticalOffset + TypeIndex * (ReturnRect.height + _renderData.PinVerticalSpacing);
        if (LinkType == EPinLinkType.Input)
        {
            RectPosition.x = _renderData.NodeRect.position.x + _renderData.InputPinHorizontalOffset;
        }
        else
        {
            RectPosition.x = _renderData.NodeRect.position.x + _renderData.OutputPinHorizontalOffset - _renderData.PinSize;
        }
        ReturnRect.position = RectPosition;

        return(ReturnRect);
    }
コード例 #2
0
    private int GetNumPins(EPinLinkType PinLinkType)
    {
        int OutNumPins = 0;

        for (int PinIndex = 0; PinIndex < PinCount; ++PinIndex)
        {
            EditorPin Pin = Pins[PinIndex];
            if (Pin.GetPinLinkType() == PinLinkType)
            {
                ++OutNumPins;
            }
        }
        return(OutNumPins);
    }