/// <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( ); }
/// <summary> /// Adds a new archetype node given the archetype object and the parent node. /// </summary> public void AddActorType( ActorTypeEd actorType, AssetNode parent ) { if( parent == null ) parent = _mainNode; if( parent.NodeType != NodeType.Folder ) parent = parent.Parent; actorType.FilePath = Global.World.WorldFolderPath + parent.FullPath + "\\" + actorType.Name + Consts.Files.ACTORTYPE_EXTENSION; AssetNode newNode = new AssetNode( actorType.Name ); newNode.ActorType = actorType; newNode.NodeType = NodeType.ActorType; newNode.ImageIndex = newNode.SelectedImageIndex = 1; //if ( this == Global.Assets.AssetsTree ) // newNode.ContextMenuStrip = Global.Assets.NodeContextMenu; parent.Nodes.Add( newNode ); //_actorTypesPool.Add( newNode.ActorType.ID, newNode ); Sort( ); SelectedNode = newNode; _lastCreatedNode = newNode; parent.Expand( ); }
public void AddScript( Script script, AssetNode parent ) { if( parent == null ) parent = _mainNode; if ( parent.NodeType != NodeType.Folder ) parent = parent.Parent; //script.FilePath = Global.World.WorldFolderPath + parent.FullPath + "\\" + script.Name + Consts.Files.LUASSEMBLY_EXTENSION; AssetNode newNode = new AssetNode( script.Name ); newNode.Script = script; newNode.NodeType = NodeType.Script; newNode.ImageIndex = newNode.SelectedImageIndex = 4; //if ( this == Global.Assets.AssetsTree ) // newNode.ContextMenuStrip = Global.Assets.NodeContextMenu; parent.Nodes.Add( newNode ); //_scriptsPool.Add( newNode.Script.ID, newNode ); Sort( ); SelectedNode = newNode; _lastCreatedNode = newNode; parent.Expand( ); }