public void AddNode(Node node) { node.Scene = this; if( node is RenderableNode ) { _renderableNodes.Add(node); if( node is Sprite ) { _flatNodes.Add(node); } } else { _environmentalNodes.Add(node); } }
private void LoadAndAddChild(object item) { if( _items.Contains(item)) { return; } if (null != NodeTemplate) { if( null == _templateContent ) { _templateContent = NodeTemplate.LoadContent() as Node; if (null == _templateContent) { throw new ArgumentException("Content of the template for NodeTemplate must be a derivative of Node"); } AddItemAsChild(item, _templateContent); } else { _addedItems.Push(item); } } _items.Add(item); }
private void AddItemAsChild(object item, Node node) { node.DataContext = item; var modifier = Modifier; if (null != modifier) { var index = 0; if (_itemsSource is IList) { index = ((IList)_itemsSource).IndexOf(item); } modifier.Apply(node, index, item); } if( !Children.Contains(node)) { Children.Add(node); } }