예제 #1
0
파일: Scene.cs 프로젝트: tekbob27/Balder
		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);
			}
		}
예제 #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);
        }
예제 #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);
            }
        }