예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SurfaceNodeElementControl"/> class.
 /// </summary>
 /// <param name="parentNode">The parent node.</param>
 /// <param name="archetype">The element archetype.</param>
 /// <param name="location">The location.</param>
 /// <param name="size">The size.</param>
 /// <param name="canFocus">if set to <c>true</c> can focus this control.</param>
 protected SurfaceNodeElementControl(SurfaceNode parentNode, NodeElementArchetype archetype, Vector2 location, Vector2 size, bool canFocus)
     : base(location, size)
 {
     CanFocus   = canFocus;
     ParentNode = parentNode;
     Archetype  = archetype;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SurfaceNodeElementControl"/> class.
 /// </summary>
 /// <param name="parentNode">The parent node.</param>
 /// <param name="archetype">The element archetype.</param>
 /// <param name="location">The location.</param>
 /// <param name="size">The size.</param>
 /// <param name="autoFocus">if set to <c>true</c> can focus this control.</param>
 protected SurfaceNodeElementControl(SurfaceNode parentNode, NodeElementArchetype archetype, Vector2 location, Vector2 size, bool autoFocus)
     : base(location, size)
 {
     AutoFocus   = autoFocus;
     TooltipText = archetype.Tooltip;
     ParentNode  = parentNode;
     Archetype   = archetype;
 }
예제 #3
0
        /// <summary>
        /// Creates an element from the archetype and adds the element to the node.
        /// </summary>
        /// <param name="arch">The element archetype.</param>
        /// <returns>The created element. Null if the archetype is invalid.</returns>
        public ISurfaceNodeElement AddElement(NodeElementArchetype arch)
        {
            ISurfaceNodeElement element = null;

            switch (arch.Type)
            {
            case NodeElementType.Input:
                element = new InputBox(this, arch);
                break;

            case NodeElementType.Output:
                element = new OutputBox(this, arch);
                break;

            case NodeElementType.BoolValue:
                element = new BoolValue(this, arch);
                break;

            case NodeElementType.FloatValue:
                element = new FloatValue(this, arch);
                break;

            case NodeElementType.IntegerValue:
                element = new IntegerValue(this, arch);
                break;

            case NodeElementType.ColorValue:
                element = new ColorValue(this, arch);
                break;

            case NodeElementType.ComboBox:
                element = new ComboBoxElement(this, arch);
                break;

            case NodeElementType.Asset:
                element = new AssetSelect(this, arch);
                break;

            case NodeElementType.Text:
                element = new TextView(this, arch);
                break;

            case NodeElementType.TextBox:
                element = new TextBoxView(this, arch);
                break;

            case NodeElementType.SkeletonNodeSelect:
                element = new SkeletonNodeSelectElement(this, arch);
                break;

            case NodeElementType.BoxValue:
                element = new BoxValue(this, arch);
                break;

            case NodeElementType.EnumValue:
                element = new EnumValue(this, arch);
                break;
            }
            if (element != null)
            {
                AddElement(element);
            }

            return(element);
        }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SurfaceNodeElementControl"/> class.
 /// </summary>
 /// <param name="parentNode">The parent node.</param>
 /// <param name="archetype">The element archetype.</param>
 /// <param name="width">The width.</param>
 /// <param name="height">The height.</param>
 /// <param name="canFocus">if set to <c>true</c> can focus this control.</param>
 protected SurfaceNodeElementControl(SurfaceNode parentNode, NodeElementArchetype archetype, float width, float height, bool canFocus)
     : base(archetype.ActualPositionX, archetype.ActualPositionY, width, height)
 {
     ParentNode = parentNode;
     Archetype  = archetype;
 }
예제 #5
0
        /// <summary>
        /// Creates an element from the archetype and adds the element to the node.
        /// </summary>
        /// <param name="arch">The element archetype.</param>
        /// <returns>The created element. Null if the archetype is invalid.</returns>
        public ISurfaceNodeElement AddElement(NodeElementArchetype arch)
        {
            ISurfaceNodeElement element = null;

            switch (arch.Type)
            {
            case NodeElementType.Input:
                element = new InputBox(this, arch);
                break;

            case NodeElementType.Output:
                element = new OutputBox(this, arch);
                break;

            case NodeElementType.BoolValue:
                element = new BoolValue(this, arch);
                break;

            case NodeElementType.FloatValue:
                element = new FloatValue(this, arch);
                break;

            case NodeElementType.IntegerValue:
                element = new IntegerValue(this, arch);
                break;

            case NodeElementType.ColorValue:
                element = new ColorValue(this, arch);
                break;

            case NodeElementType.ComboBox:
                element = new ComboBoxElement(this, arch);
                break;

            case NodeElementType.Asset:
                element = new AssetSelect(this, arch);
                break;

            case NodeElementType.Text:
                element = new TextView(this, arch);
                break;

            case NodeElementType.TextBox:
                element = new TextBoxView(this, arch);
                break;

            case NodeElementType.SkeletonBoneIndexSelect:
                element = new SkeletonBoneIndexSelectElement(this, arch);
                break;

            case NodeElementType.BoxValue:
                element = new BoxValue(this, arch);
                break;

            case NodeElementType.EnumValue:
                element = new EnumValue(this, arch);
                break;

            case NodeElementType.SkeletonNodeNameSelect:
                element = new SkeletonNodeNameSelectElement(this, arch);
                break;
                //default: throw new NotImplementedException("Unknown node element type: " + arch.Type);
            }
            if (element != null)
            {
                AddElement(element);
            }

            return(element);
        }