コード例 #1
0
        /// <summary>
        /// Adds a new sprite node given the sprite and the parent node.
        /// </summary>
        public void AddSprite( SpriteEd sprite, AssetNode parent )
        {
            if( parent == null )
                parent = _mainNode;
            if( parent.NodeType != NodeType.Folder )
                parent = parent.Parent;

            sprite.FilePath = Global.World.WorldFolderPath + parent.FullPath + "\\" + sprite.Name + Consts.Files.SPRITE_EXTENSION;

            AssetNode newNode = new AssetNode( sprite.Name );
            newNode.Sprite = sprite;
            newNode.NodeType = NodeType.Sprite;

            newNode.ImageIndex = newNode.SelectedImageIndex = 0;
            //if ( this == Global.Assets.AssetsTree )
            //    newNode.ContextMenuStrip = Global.Assets.NodeContextMenu;

            if( parent == null )
                this.Nodes.Add( newNode );
            else
                parent.Nodes.Add( newNode );

            //_spritesPool.Add( newNode.Sprite.ID, newNode );
            Sort( );

            SelectedNode = newNode;
            _lastCreatedNode = newNode;

            parent.Expand( );
        }
コード例 #2
0
 /// <summary>
 /// Adds a new sprite node give the sprite. The node will be attached to the SelectedNode
 /// </summary>
 public void AddSprite( SpriteEd sprite )
 {
     AddSprite( sprite, SelectedNode );
 }