public override void reorderChild (CCNode child, int z)
		{
			NSUtils.Assert( child != null, "Child must be non-nil");
			NSUtils.Assert( _children.Contains(child), "Child doesn't belong to Sprite" );
			
			if( z == child.zOrder )
				return;
			base.reorderChild (child, z);
		}
Exemple #2
0
		public virtual void reorderChild(CCNode child, int z)
		{
			NSUtils.Assert( child != null, "Child must be non-nil");
			
			_isReorderChildDirty = true;
			
			child.orderOfArrival= globalOrderOfArrival++;
			child._setZOrder(z);
		}
		public override void addChild (CCNode child, int z, string tag)
		{
			NSUtils.Assert( child != null, "Argument must be non-nil");

			//CCNode already sets _isReorderChildDirty so this needs to be after batchNode check
			base.addChild (child, z, tag);
			
//			_hasChildren = true;
		}
Exemple #4
0
		void detachChild(CCNode child, bool cleanup)
		{
			// IMPORTANT:
			//  -1st do onExit
			//  -2nd cleanup
			if (_isRunning)
			{
				child.onExitTransitionDidStart();
				child.onExit();
			}
			
			child.parent = null;
			_children.Remove(child);
			
			
			// If you don't do cleanup, the child's actions will not get removed and the
			// its scheduledSelectors_ dict will not get released!
			if (cleanup)
				child.cleanup ();
			else
				child.gameObject.SetActive(false);
		}
Exemple #5
0
		// helper used by reorderChild & add
		public virtual void insertChild(CCNode child, int z)
		{
			_isReorderChildDirty=true;
			
			_children.Add(child);
			child.zOrder=z;
		}
Exemple #6
0
		/* "remove" logic MUST only be on this method
		 * If a class wants to extend the 'removeChild' behavior it only needs
		 * to override this method
		 */
		public virtual void removeChild(CCNode child){
			removeChildAndCleanup (child, true);
		}
Exemple #7
0
		public virtual void removeChildAndCleanup(CCNode child, bool cleanup){
			if (child == null)
				return;
			NSUtils.Assert(_children.Contains(child), "This node does not contain the specified child.");
			detachChild(child, cleanup);
		}
Exemple #8
0
		public void addChild(CCNode child, int z){
			NSUtils.Assert( child != null, "Argument must be non-nil");
			addChild (child, z, child.userTag);
		}
Exemple #9
0
		/* "add" logic MUST only be on this method
		 * If a class want's to extend the 'addChild' behaviour it only needs
		 * to override this method
		 */
		public virtual void addChild(CCNode child, int z, string tag){
			NSUtils.Assert( child != null, "Argument must be non-nil");
			NSUtils.Assert( child.parent == null, "child already added. It can't be added again");
			
			if (_children == null)
				_children = new List<CCNode> ();
			insertChild (child, z);
			
			child.userTag = tag;
			child.parent = this;
			child.orderOfArrival = globalOrderOfArrival ++;
			
			if (_isRunning) {
				child.onEnter();
				child.onEnterTransitionDidFinish();
			}
		}
Exemple #10
0
		public virtual void cleanup()
		{
			// actions
			stopAllActions ();
			unscheduleAllSelectors ();
			
			// timers
			if (_children != null) {

				var enumerator = _children.GetEnumerator();
				while (enumerator.MoveNext()) {
					CCNode child = enumerator.Current;
					child.cleanup ();
				}
				_parent = null;
				_children.Clear ();
			}
			recycleGear ();
		}
Exemple #11
0
		protected virtual void initWithGear(CCFactoryGear gear){
			_gear = gear;
			_gear.gameObject.name = "Node";
			_gear.gameObject.transform.localPosition = Vector3.zero;
//			_gear.gameObject.transform.localScale = new Vector3 (1, 1, 1);
			_isRunning = false;
			
			//			_skewX = _skewY = 0.0f;
			_rotation = 0.0f;
			_scaleX = _scaleY = 1.0f;
			_position = Vector2.zero;
			_contentSize = Vector2.zero;
			_anchorPointInPixels = _anchorPoint = Vector2.zero;
			
			
			// "whole screen" objects. like Scenes and Layers, should set ignoreAnchorPointForPosition to YES
			_ignoreAnchorPointForPosition = false;
			
			_isUpdateTransformDirty = _isTransformDirty = _isInverseDirty = true;
			
			//			_vertexZ = 0;
			
			//			_grid = nil;
			
			_visible = true;
			
			_userTag = null;
			
			_zOrder = 0;
			
			// lazy alloc
			//			_camera = nil;
			
			// children (lazy allocs)
			_children = null;
			
			// userData is always inited as nil
			_userObject = null;
			
			//initialize parent to nil
			_parent = null;
			
			//			_shaderProgram = nil;
			
			_orderOfArrival = 0;
			
			//			_glServerState = 0;
			
			// set default scheduler and actionManager
			CCDirector director = CCDirector.sharedDirector;
			this.actionManager = director.actionManager;
			this.scheduler = director.scheduler;
		}
Exemple #12
0
		/*
		 * override add:
		 */
		public override void addChild (CCNode child, int z, string tag)
		{
			NSUtils.Assert( child is CCMenuItem, "Menu only supports MenuItem objects as children");
			base.addChild (child, z, tag);
		}