Beispiel #1
0
		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);
			}
		}
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
            }
        }