Esempio n. 1
0
		private void DetachChild(SceneNode child, bool cleanup) {
			if (_isRunning) 
			{
				child.OnExit();
			}
			
			if (cleanup) 
			{
				child.CleanUp();
			}
			
			child.Parent = null;
			
			_children.Remove(child);
		}
Esempio n. 2
0
		public virtual void RemoveChild(SceneNode child, bool cleanup) 
		{
			if (child != null) 
			{
				if (Children.Contains(child)) 
				{
					DetachChild(child, cleanup);
				}
			}
		}
Esempio n. 3
0
		public virtual SceneNode AddChild(SceneNode child) 
		{
			if (child == null) 
			{
				throw new ArgumentNullException("child");
			}
			if (child.Parent != null) 
			{
				throw new ArgumentException("Child already has a parent", "child");
			}

			InsertChild(child);

			child.Parent = this;
			
			if (_isRunning) 
			{
				child.OnEnter();
			}
			
			return this;
		}
Esempio n. 4
0
		private void InsertChild(SceneNode child) 
		{
			int i = 0;
			bool added = false;

			int z = child.ZOrder;

			foreach (SceneNode node in _children)
			{
				if (node.ZOrder > z) 
				{
					added = true;
					_children.Insert(i, child);
					break;
				}
				++i;
			}
			
			if (!added) 
			{
				_children.Add(child);
			}
			
			child._zOrder = z;
		}
Esempio n. 5
0
		public SceneNode(){
			_name = "";
			_id = 0;
			_tag = TAG_INVALID;
			_zOrder = 0;
			
			_isTransformDirty = false;
			_rotation = 0;
			_scaleX = 1;
			_scaleY = 1;
			_position = Point.Zero;
			_isRunning = false;
			_isEnable = true;
			_anchorPoint = Point.Zero;
			_width = 0;
			_height = 0;
			_isVisible = true;

			_children = new List<SceneNode>();
			_parent = null;
			_userData = null;
		}