Пример #1
0
    /// <summary>
    /// The Initializer for the <seealso cref="UtilityNode"/> when it is being loaded from an XML
    /// </summary>
    /// <param name="parent"></param>
    /// <param name="typeNumber"></param>
    /// <param name="posx"></param>
    /// <param name="posy"></param>
    /// <param name="subElem"></param>
    public void InitUtilityNodeFromXML(ClickableElement parent, utilityType type, fusionType fusionType, curveType curveType,
                                       float posx, float posy, string id, string name, float variableMax, float variableMin, float slope, float exp, float displX, float displY, List <Vector2> points, ClickableElement subElem = null)
    {
        InitBaseNode(parent, id);

        var foo = editor;

        this.type       = type;
        this.fusionType = fusionType;
        this.curveType  = curveType;

        if (subElem != null)
        {
            this.subElem = subElem;
            nodeName     = this.subElem.elementName;
            windowRect   = new Rect(posx, posy, ClickableElement.width, ClickableElement.height);
        }
        else
        {
            nodeName = parent.elementNamer.AddName(id, name);

            if (type == utilityType.Fusion)
            {
                windowRect = new Rect(posx, posy, width, height * 1.7f);
            }
            else if (type == utilityType.Curve)
            {
                baseHeight = height * 1.5f;
                windowRect = new Rect(posx, posy, width, baseHeight);
            }
            else
            {
                windowRect = new Rect(posx, posy, width, height);
            }
        }

        this.variableMax = variableMax;
        this.variableMin = variableMin;
        this.slope       = slope;
        this.exp         = exp;
        this.displX      = displX;
        this.displY      = displY;
        this.points      = points;
    }
Пример #2
0
    /// <summary>
    /// The Initializer for the <seealso cref="UtilityNode"/>
    /// </summary>
    /// <param name="parent"></param>
    /// <param name="typeNumber"></param>
    /// <param name="posx"></param>
    /// <param name="posy"></param>
    /// <param name="subElem"></param>
    public void InitUtilityNode(ClickableElement parent, utilityType type, float posx, float posy, ClickableElement subElem = null, string id = null)
    {
        InitBaseNode(parent, id);

        var foo = editor;

        this.type = type;

        if (subElem != null)
        {
            this.subElem = subElem;
            nodeName     = this.subElem.elementName;
            windowRect   = new Rect(posx, posy, ClickableElement.width, ClickableElement.height);
        }
        else
        {
            string nameToAdd = "New " + type;
            if (type != utilityType.Variable)
            {
                nameToAdd += " Node ";
            }
            nodeName = parent.elementNamer.AddName(identificator, nameToAdd);

            if (type == utilityType.Fusion)
            {
                windowRect = new Rect(posx, posy, width, height * 1.7f);
            }
            else if (type == utilityType.Curve)
            {
                baseHeight = height * 1.5f;
                windowRect = new Rect(posx, posy, width, baseHeight);
            }
            else
            {
                windowRect = new Rect(posx, posy, width, height);
            }
        }

        points = new List <Vector2>()
        {
            new Vector2(0, 0)
        };
    }