public static CCScene Scene()
 {
     CCScene scene = new CCScene();
     HelloKeyboardEvent layer = new HelloKeyboardEvent();
     scene.addChild(layer);
     return scene;
 }
 public static CCScene Scene()
 {
     CCScene scene = new CCScene();
     HelloNSNotification layer = new HelloNSNotification();
     scene.addChild(layer);
     return scene;
 }
 public static CCScene Scene()
 {
     CCScene scene = new CCScene();
     HelloEvents layer = new HelloEvents();
     scene.addChild(layer);
     return scene;
 }
Пример #4
0
 public static CCScene Scene()
 {
     CCScene scene = new CCScene();
     HelloFlash layer = new HelloFlash();
     scene.addChild(layer);
     return scene;
 }
    // Helper class method that creates a Scene with the HelloWorldLayer as the only child.
    public static CCScene Scene()
    {
        // 'scene' is an autorelease object.
        CCScene scene = new CCScene();

        // 'layer' is an autorelease object.
        HelloWorldLayer layer = new HelloWorldLayer();

        // add layer as a child to scene
        scene.addChild(layer);

        // return the scene
        return scene;
    }
Пример #6
0
		void setNextScene()
		{
			bool runningIsTransition = false;//[_runningScene isKindOfClass:transClass];
			bool newIsTransition = false;//[_nextScene isKindOfClass:transClass];
			
			// If it is not a transition, call onExit/cleanup
			if( ! newIsTransition ) {
				if(_runningScene!=null){
					_runningScene.onExitTransitionDidStart();
					_runningScene.onExit();
					// issue #709. the root node (scene) should receive the cleanup message too
					// otherwise it might be leaked.
					if( _sendCleanupToScene)
						_runningScene.cleanup();
				}
			}
			_runningScene = _nextScene;
			_nextScene = null;
			_runningScene.transform.parent = _view.transform;
			
			if( ! runningIsTransition ) {
				_runningScene.onEnter();
				_runningScene.onEnterTransitionDidFinish();
			}
		}
Пример #7
0
		public void end()
		{
			_runningScene.onExitTransitionDidStart();
			_runningScene.onExit();
			_runningScene.cleanup();
			
			_runningScene = null;
			_nextScene = null;
			
			// remove all objects, but don't release it.
			// runWithScene might be executed after 'end'.
			_scenesStack.Clear();
			
			this.stopAnimation();

			this.view = null;

			// Purge all managers / caches
			CCAnimationCache.PurgeSharedAnimationCache();
			CCSpriteFrameCache.PurgeSharedSpriteFrameCache();
		}
Пример #8
0
		public void presentScene(CCScene scene)
		{
			if (_runningScene != null)
				replaceScene (scene);
			else
				runWithScene (scene);
		}
Пример #9
0
		public void replaceScene(CCScene scene)
		{
			NSUtils.Assert( scene != null, "Argument must be non-nil");
			
			if (_runningScene != null)
			{
				_sendCleanupToScene = true;
				_scenesStack.Pop();
				_scenesStack.Push(scene);
				_nextScene = scene;	// _nextScene is a weak ref
			}
			else
			{
				pushScene (scene);
				startAnimation();
			}
		}
Пример #10
0
		public void popScene()
		{	
			NSUtils.Assert( _runningScene != null, "A running Scene is needed");
			
			_scenesStack.Pop();
			int c = _scenesStack.Count;
			
			if( c == 0 )
				this.end();
			else {
				_sendCleanupToScene = true;
				_nextScene = _scenesStack.Peek();
				_runningScene.gameObject.SetActive(_runningScene.visible);
			}
		}
Пример #11
0
		public void pushScene(CCScene scene)
		{
			NSUtils.Assert( scene != null, "Argument must be non-nil");
			
			_sendCleanupToScene = false;
			if (_runningScene != null){
				_runningScene.gameObject.SetActive(false);
			}

			_scenesStack.Push(scene);
			_nextScene = scene;	// _nextScene is a weak ref
		}
Пример #12
0
		public void runWithScene(CCScene scene)
		{
			NSUtils.Assert( scene != null, "Argument must be non-nil");
			NSUtils.Assert(_runningScene == null, "This command can only be used to start the CCDirector. There is already a scene present.");
			
			pushScene (scene);
			startAnimation();
		}
Пример #13
0
		protected CCDirector()
		{
			CCDebug.Log("cocos2d: cocos2d-iphone v2.1");
			// scenes
			_runningScene = null;
			_nextScene = null;
			
//			_notificationNode = nil;

			_oldAnimationInterval = _animationInterval = 1.0f / kDefaultFPS;
			_scenesStack = new Stack<CCScene> (10);
			
			// Set default projection (3D)
//			_projection = kCCDirectorProjectionDefault;
			
			// projection delegate if "Custom" projection is used
//			_delegate = nil;
			
			// FPS
			_displayStats = false;

			_displayError = false;

//			_totalFrames = _frames = 0;
			
			// paused ?
			_isPaused = false;
			
			// running thread
//			_runningThread = null;
			
			// scheduler
			_scheduler = new CCScheduler();
			
			// action manager
			_actionManager = new CCActionManager ();
			_scheduler.scheduleUpdate (_actionManager, CCScheduler.kCCPrioritySystem, false);
			
			_winSizeInPixels = Vector2.zero;


			//CCDirectorIOS
//			_ccContentScaleFactor = 1;
//			_isContentScaleSupported = false;
			_touchDispatcher = new CCTouchDispatcher ();
		}