Пример #1
0
        /// <summary>
        ///  Implement CCDirector and CCScene init code here.
        /// </summary>
        /// <returns>
        ///  true  Initialize success, app continue.
        ///  false Initialize failed, app terminate.
        /// </returns>
        public override bool ApplicationDidFinishLaunching()
        {
            ContentRootDirectory = "Content";

            //CCSpriteFontCache.FontScale = 0.6f;
            //CCSpriteFontCache.RegisterFont("MarkerFelt", 22);

            CCDirector director = CCDirector.SharedDirector;
            director.DisplayStats = true;
            director.AnimationInterval = 1.0 / 60;

            // turn on display FPS
            director.DisplayStats = true;

            // set FPS. the default value is 1.0/60 if you don't call this
            director.AnimationInterval = 1.0 / 60;

            CCScene scene = new CCScene();

            var label = TestClass.PCLLabel(AppDelegate.PlatformMessage());

            scene.AddChild(label);

            director.RunWithScene(scene);

            return true;
        }
Пример #2
0
        /// <summary>
        /// Called when app launched.
        /// </summary>
        /// <param name="application">application object</param>
        /// <param name="mainWindow">main window</param>
        public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
        {
            application.PreferMultiSampling = false;

            application.ContentRootDirectory = "Content";
            var windowSize = mainWindow.WindowSizeInPixels;

            var desiredHeight = 1024.0f;
            var desiredWidth = 768.0f;

            // This will set the world bounds to be (0,0, w, h)
            // CCSceneResolutionPolicy.ShowAll will ensure that the aspect ratio is preserved
            CCScene.SetDefaultDesignResolution(desiredWidth, desiredHeight, CCSceneResolutionPolicy.ShowAll);

            CCSimpleAudioEngine.SharedEngine.PreloadEffect("sounds/hit_paddle");
            CCSimpleAudioEngine.SharedEngine.PreloadEffect("sounds/hit_wall");
            CCSimpleAudioEngine.SharedEngine.PreloadEffect("sounds/hit_off");

            var scene = new CCScene(mainWindow);
            var introLayer = new IntroLayer();

            scene.AddChild(introLayer);

            mainWindow.RunWithScene(scene);
        }
Пример #3
0
        public override bool ApplicationDidFinishLaunching()
        {
            ContentRootDirectory = "Content";

            CCSpriteFontCache.FontScale = 0.6f;
            CCSpriteFontCache.RegisterFont("MarkerFelt", 22);

            CCDirector director = CCDirector.SharedDirector;
            director.DisplayStats = true;
            director.AnimationInterval = 1.0 / 60;

            CCSize designSize = new CCSize(480, 320);

            if (CCDrawManager.FrameSize.Height > 320)
            {
                CCSize resourceSize = new CCSize(960, 640);
                ContentSearchPaths.Add("hd");
                director.ContentScaleFactor = resourceSize.Height / designSize.Height;
            }

            CCDrawManager.SetDesignResolutionSize(designSize.Width, designSize.Height, CCResolutionPolicy.ShowAll);

            CCScene scene = new CCScene();

            var label = TestClass.PCLLabel(AppDelegate.PlatformMessage());

            scene.AddChild(label);

            director.RunWithScene(scene);

            return true;
        }
        public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
        {
            application.PreferMultiSampling = false;
            application.ContentRootDirectory = "Content";
            application.ContentSearchPaths.Add ("animations");
            application.ContentSearchPaths.Add ("fonts");
            application.ContentSearchPaths.Add ("sounds");

            CCSize windowSize = mainWindow.WindowSizeInPixels;

            float desiredHeight = 512.0f;
            float desiredWidth = 384.0f;

            // This will set the world bounds to be (0,0, w, h).
            // CCSceneResolutionPolicy.ShowAll will ensure that the aspect ratio is preserved.
            CCScene.SetDefaultDesignResolution (desiredWidth, desiredHeight, CCSceneResolutionPolicy.ShowAll);

            // Determine whether to use the high or low def versions of our images.
            // Make sure the default texel to content size ratio is set correctly.
            // Of course you're free to have a finer set of image resolutions e.g (ld, hd, super-hd).
            if (desiredWidth < windowSize.Width) {
                application.ContentSearchPaths.Add ("images/hd");
                CCSprite.DefaultTexelToContentSizeRatio = 2.0f;
            } else {
                application.ContentSearchPaths.Add ("images/ld");
                CCSprite.DefaultTexelToContentSizeRatio = 1.0f;
            }

            CCScene scene = new CCScene (mainWindow);
            GameLayer gameLayer = new GameLayer ();

            scene.AddChild (gameLayer);

            mainWindow.RunWithScene (scene);
        }
Пример #5
0
        public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
        {
            //application.SupportedOrientations = CCDisplayOrientation.LandscapeRight | CCDisplayOrientation.LandscapeLeft;
            //application.AllowUserResizing = true;
            //application.PreferMultiSampling = false;
            application.ContentRootDirectory = "Content";


            CCRect boundsRect = new CCRect(0.0f, 0.0f, 960, 640);

			sharedViewport = new CCViewport(new CCRect (0.0f, 0.0f, 1.0f, 1.0f));

            sharedWindow = mainWindow;
            sharedCamera = new CCCamera(boundsRect.Size, new CCPoint3(boundsRect.Center, 100.0f), new CCPoint3(boundsRect.Center, 0.0f));

            mainWindow.SetDesignResolutionSize(960, 640, CCSceneResolutionPolicy.ShowAll);

            #if WINDOWS || WINDOWSGL || WINDOWSDX 
			//application.PreferredBackBufferWidth = 1024;
			//application.PreferredBackBufferHeight = 768;
            #elif MACOS
            //application.PreferredBackBufferWidth = 960;
            //application.PreferredBackBufferHeight = 640;
            #endif

            #if WINDOWS_PHONE8
            application.HandleMediaStateAutomatically = false; // Bug in MonoGame - https://github.com/Cocos2DXNA/cocos2d-xna/issues/325
            #endif

            CCSpriteFontCache.FontScale = 0.6f;
            CCSpriteFontCache.RegisterFont("arial", 12, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 38, 50, 64);
            CCSpriteFontCache.RegisterFont("MarkerFelt", 16, 18, 22, 32);
            CCSpriteFontCache.RegisterFont("MarkerFelt-Thin", 12, 18);
            CCSpriteFontCache.RegisterFont("Paint Boy", 26);
            CCSpriteFontCache.RegisterFont("Schwarzwald Regular", 26);
            CCSpriteFontCache.RegisterFont("Scissor Cuts", 26);
            CCSpriteFontCache.RegisterFont("A Damn Mess", 26);
            CCSpriteFontCache.RegisterFont("Abberancy", 26);
            CCSpriteFontCache.RegisterFont("Abduction", 26);

            //sharedDirector = new CCDirector();
            //director.DisplayStats = true;
            //director.AnimationInterval = 1.0 / 60;


//            if (sharedWindow.WindowSizeInPixels.Height > 320)
//            {
//                application.ContentSearchPaths.Insert(0,"HD");
//            }

            //sharedWindow.AddSceneDirector(sharedDirector);

            CCScene scene = new CCScene(sharedWindow);
			scene.Camera = sharedCamera;

            CCLayer layer = new TestController();

            scene.AddChild(layer);
            sharedWindow.RunWithScene(scene);
        }
        public void passToGame(int i)
        {
            GameData.scores = new int[GameData.players];
            CCSimpleAudioEngine.SharedEngine.StopEffect(mid);
            var newScene = new CCScene(Window);
            if(i == 1)
            {
                var silla = new SillaMusicalLayer();
                newScene.AddChild(silla);
                Window.DefaultDirector.ReplaceScene(newScene);

            }
            else if (i == 2)
            {
                var dictado = new DictadoLayercs();
                newScene.AddChild(dictado);
                Window.DefaultDirector.ReplaceScene(newScene);

            }
            else if (i == 3)
            {
                var maleta = new MaletaLayer();
                newScene.AddChild(maleta);
                Window.DefaultDirector.ReplaceScene(newScene);

            }
            else
            {
                var tablero = new Tablero();
                newScene.AddChild(tablero);
                Window.DefaultDirector.ReplaceScene(newScene);
            }
        }
Пример #7
0
 public static void runTableViewTest()
 {
     var pScene = new CCScene(AppDelegate.SharedWindow, AppDelegate.SharedViewport);
     var pLayer = new TableViewTestLayer();
     pScene.AddChild(pLayer);
     AppDelegate.SharedWindow.DefaultDirector.ReplaceScene(pScene);
 }
Пример #8
0
		void LoadGame (object sender, EventArgs e)
		{
			var nativeGameView = sender as CCGameView;

			if (nativeGameView != null)
			{
				var contentSearchPaths = new List<string> () { "Fonts", "Sounds" };
				CCSizeI viewSize = nativeGameView.ViewSize;
				CCSizeI designResolution = nativeGameView.DesignResolution;

				// Determine whether to use the high or low def versions of our images
				// Make sure the default texel to content size ratio is set correctly
				// Of course you're free to have a finer set of image resolutions e.g (ld, hd, super-hd)
				if (designResolution.Width < viewSize.Width)
				{
					contentSearchPaths.Add ("Images/Hd");
					CCSprite.DefaultTexelToContentSizeRatio = 2.0f;
				}
				else
				{
					contentSearchPaths.Add ("Images/Ld");
					CCSprite.DefaultTexelToContentSizeRatio = 1.0f;
				}

				nativeGameView.ContentManager.SearchPaths = contentSearchPaths;

				CCScene gameScene = new CCScene (nativeGameView);
				gameScene.AddLayer (new GameLayer ());
				nativeGameView.RunWithScene (gameScene);
			}
		}
Пример #9
0
        public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
        {
            application.ContentRootDirectory = "Content";
            var windowSize = mainWindow.WindowSizeInPixels;

            var desiredWidth = 1024.0f;
            var desiredHeight = 768.0f;
            
            // This will set the world bounds to be (0,0, w, h)
            // CCSceneResolutionPolicy.ShowAll will ensure that the aspect ratio is preserved
            mainWindow.SetDesignResolutionSize(desiredWidth, desiredHeight, CCSceneResolutionPolicy.ShowAll);
            
            // Determine whether to use the high or low def versions of our images
            // Make sure the default texel to content size ratio is set correctly
            // Of course you're free to have a finer set of image resolutions e.g (ld, hd, super-hd)
            if (desiredWidth < windowSize.Width)
            {
                application.ContentSearchPaths.Add("hd");
                CCSprite.DefaultTexelToContentSizeRatio = 2.0f;
            }
            else
            {
                application.ContentSearchPaths.Add("ld");
                CCSprite.DefaultTexelToContentSizeRatio = 1.0f;
            }
            
            var scene = new CCScene(mainWindow);
            var introLayer = new IntroLayer();

            scene.AddChild(introLayer);

            mainWindow.RunWithScene(scene);
        }
Пример #10
0
        public void openTest(string pCCBFileName, string pCCNodeName, CCNodeLoader pCCNodeLoader)
        {
            /* Create an autorelease CCNodeLoaderLibrary. */
            CCNodeLoaderLibrary ccNodeLoaderLibrary = new CCNodeLoaderLibrary();

            ccNodeLoaderLibrary.RegisterCCNodeLoader("TestHeaderLayer", new Loader<TestHeaderLayer>());
            if (pCCNodeName != null && pCCNodeLoader != null)
            {
                ccNodeLoaderLibrary.RegisterCCNodeLoader(pCCNodeName, pCCNodeLoader);
            }

            /* Create an autorelease CCBReader. */
            var ccbReader = new CCBReader(ccNodeLoaderLibrary);

            /* Read a ccbi file. */
            // Load the scene from the ccbi-file, setting this class as
            // the owner will cause lblTestTitle to be set by the CCBReader.
            // lblTestTitle is in the TestHeader.ccbi, which is referenced
            // from each of the test scenes.
            CCNode node = ccbReader.ReadNodeGraphFromFile(pCCBFileName, this);

            mTestTitleLabelTTF.Text = (pCCBFileName);

            CCScene scene = new CCScene(Scene);
            scene.AddChild(node);

            /* Push the new scene with a fancy transition. */
            CCColor3B transitionColor = new CCColor3B();
            transitionColor.R = 0;
            transitionColor.G = 0;
            transitionColor.B = 0;

            Scene.Director.PushScene(new CCTransitionFade(0.5f, scene, transitionColor));
        }
Пример #11
0
		public override void ApplicationDidFinishLaunching (CCApplication application, CCWindow mainWindow)
		{
			application.PreferMultiSampling = false;
			application.ContentRootDirectory = "Content";
			application.ContentSearchPaths.Add ("animations");
			application.ContentSearchPaths.Add ("fonts");
			application.ContentSearchPaths.Add ("sounds");

			CCSize windowSize = mainWindow.WindowSizeInPixels;

			float desiredHeight = 1024.0f;
			float desiredWidth = 768.0f;
    
			// This will set the world bounds to be (0,0, w, h)
			// CCSceneResolutionPolicy.ShowAll will ensure that the aspect ratio is preserved
			CCScene.SetDefaultDesignResolution (desiredWidth, desiredHeight, CCSceneResolutionPolicy.ShowAll);
            
           
			CCScene scene = new CCScene (mainWindow);
			GameLayer gameLayer = new GameLayer ();

			scene.AddChild (gameLayer);

			mainWindow.RunWithScene (scene);
		}
Пример #12
0
        public void switchLayer(float dt)
        {
            //unschedule(schedule_selector(Bug624Layer::switchLayer));

            CCScene scene = new CCScene(Scene);
            scene.AddChild(new Bug624Layer(), 0);
            Scene.Director.ReplaceScene(new CCTransitionFade(2.0f, scene, new CCColor3B { R = 255, G = 0, B = 0 }));
        }
Пример #13
0
        public static CCScene scene()
        {
            CCScene pScene = new CCScene(AppDelegate.SharedWindow);
            //Bug1159Layer layer = Bug1159Layer.node();
            //pScene.addChild(layer);

            return pScene;
        }
 public void passToGame()
 {
     GameData.scores = new int[GameData.players];
     CCSimpleAudioEngine.SharedEngine.StopEffect(mid);
     var newScene = new CCScene(Window);
     var silla = new Tablero();
     newScene.AddChild(silla);
     Window.DefaultDirector.ReplaceScene(newScene);
 }
Пример #15
0
        public static CCScene GameScene(CCWindow mainWindow)
        {
            var scene = new CCScene (mainWindow);
            var layer = new MonsterRun();

            scene.AddChild(layer);

            return scene;
        }
        public static CCScene GameStartLayerScene (CCWindow mainWindow)
        {
            var scene = new CCScene (mainWindow);
            var layer = new GameStartLayer ();

            scene.AddChild (layer);

            return scene;
        }
Пример #17
0
        public static CCScene SceneWithScore (CCWindow mainWindow, int score)
        {
            var scene = new CCScene (mainWindow);
            var layer = new GameOverLayer (score);

            scene.AddChild (layer);

            return scene;
        }
Пример #18
0
		public static CCScene SceneWithScore (int score)
		{
			var scene = new CCScene ();
			var layer = new GameOverLayer (score);

			scene.AddChild (layer);

			return scene;
		}
Пример #19
0
        public static void runTouchesTest()
        {
            s_nTouchCurCase = 0;
            CCScene pScene = new CCScene(AppDelegate.SharedWindow, AppDelegate.SharedViewport);
            CCLayer pLayer = new TouchesPerformTest1(true, TEST_COUNT, s_nTouchCurCase);

            pScene.AddChild(pLayer);

            AppDelegate.SharedWindow.DefaultDirector.ReplaceScene(pScene);
        }
Пример #20
0
        public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
        {
            SharedWindow = mainWindow;

            DefaultResolution = new CCSize(
                application.MainWindow.WindowSizeInPixels.Width,
                application.MainWindow.WindowSizeInPixels.Height);

            application.ContentRootDirectory = "Content";

            CCScene scene = new CCScene(mainWindow);
            CCLayer layer = new IntroLayer(DefaultResolution);

            var b = new CozyColorSampleButton(100, 100, 158, 158)
            {
                NormalColor     = new CCColor4B(255, 0, 0),
                ClickedColor    = new CCColor4B(0, 255, 0),
                Text            = "Hello Bttton",
                HasBorder       = true,
            };

            b.OnClick += () =>
            {
            };

            var list = new CozySampleListView()
            {
                ContentSize = new CCSize(350, 350),
                Orientation = ControlOrientation.Vertical,
                Position    = new CCPoint(100, 100),
                HasBorder   = true,
            };
            layer.AddChild(list);

            list.AddItem(new CozySampleListViewItemSprite(new CCSprite("gold"))

            {
                MarginBottom    = 10,
                MarginTop       = 10,
                HasBorder       = true,
            });
            list.AddItem(b);
            list.AddItem(new CozySampleListViewItemSprite(new CCSprite("gold"))

            {
                MarginBottom    = 10,
                MarginTop       = 10,
                HasBorder       = true,
            });

            layer.AddEventListener(b.EventListener, layer);

            scene.AddChild(layer);
            mainWindow.RunWithScene(scene);
        }
 public static CCScene SceneWithTitle(string title)
 {
     var scene = new CCScene (AppDelegate.SharedWindow);
     var controlLayer = new CCControlSliderTest();
     if (controlLayer != null)
     {
         controlLayer.SceneTitleLabel.Text = (title);
         scene.AddChild(controlLayer);
     }
     return scene;
 }
Пример #22
0
		public static CCScene CreateScene (CCWindow mainWindow) 
		{
			var scene = new CCScene(mainWindow);
			var layer = new IntroLayer();

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

			// return the scene
			return scene;
		}
Пример #23
0
 public new static CCScene sceneWithTitle(string title)
 {
     var pScene = new CCScene (AppDelegate.SharedWindow, AppDelegate.SharedViewport);
     var controlLayer = new CCControlSwitchTest();
     if (controlLayer != null)
     {
         controlLayer.getSceneTitleLabel().Text = (title);
         pScene.AddChild(controlLayer);
     }
     return pScene;
 }
Пример #24
0
 public static CCScene sceneWithTitle(string title)
 {
     var pScene = new CCScene(AppDelegate.SharedWindow);
     var controlLayer = new CCControlColourPickerTest();
     if (controlLayer != null)
     {
         controlLayer.getSceneTitleLabel().Text = (title);
         pScene.AddChild(controlLayer);
     }
     return pScene;
 }
Пример #25
0
        public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
        {

            //application.AllowUserResizing = true;
            application.PreferMultiSampling = false;
            application.ContentRootDirectory = "Content";

            application.ContentSearchResolutionOrder = new List<string>() { "", "images", "fonts" };

            sharedWindow = mainWindow;

            CCSize winSize = mainWindow.WindowSizeInPixels;
            CCScene.SetDefaultDesignResolution(winSize.Width, winSize.Height, CCSceneResolutionPolicy.ShowAll);
            //CCScene.SetDefaultDesignResolution(winSize.Width/2, winSize.Height/2, CCSceneResolutionPolicy.ShowAll);


            #if WINDOWS || WINDOWSGL || WINDOWSDX 
            //application.PreferredBackBufferWidth = 1024;
            //application.PreferredBackBufferHeight = 768;
            #elif MACOS
            //application.PreferredBackBufferWidth = 960;
            //application.PreferredBackBufferHeight = 640;
            #endif

            #if WINDOWS_PHONE8
            application.HandleMediaStateAutomatically = false; // Bug in MonoGame - https://github.com/Cocos2DXNA/cocos2d-xna/issues/325
            #endif

            //CCSpriteFontCache.FontScale = 0.6f;
            CCSpriteFontCache.RegisterFont("arial", 12, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 38, 50, 64);
            CCSpriteFontCache.RegisterFont("MarkerFelt", 16, 18, 22, 32);
            CCSpriteFontCache.RegisterFont("MarkerFelt-Thin", 12, 18);
            CCSpriteFontCache.RegisterFont("Paint Boy", 26);
            CCSpriteFontCache.RegisterFont("Schwarzwald Regular", 26);
            CCSpriteFontCache.RegisterFont("Scissor Cuts", 26);
            CCSpriteFontCache.RegisterFont("A Damn Mess", 26);
            CCSpriteFontCache.RegisterFont("Abberancy", 26);
            CCSpriteFontCache.RegisterFont("Abduction", 26);

            mainWindow.DisplayStats = true;
            mainWindow.StatsScale = 1;

            //            if (mainWindow.WindowSizeInPixels.Height > 320)
            //            {
            //                application.ContentSearchPaths.Insert(0,"HD");
            //            }
            //CCApplication.DefaultTexelToContentSizeRatio = 2f;
            CCScene scene = new CCScene(sharedWindow);
            CCLayer layer = new TestController();

            scene.AddChild(layer);
            sharedWindow.RunWithScene(scene);
        }
Пример #26
0
        public static CCScene scene()
        {
            // 'scene' is an autorelease object.
            CCScene pScene = new CCScene(AppDelegate.SharedWindow);
            // 'layer' is an autorelease object.
            //Bug914Layer layer = Bug914Layer.node();

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

            // return the scene
            return pScene;
        }
Пример #27
0
 void LoadGame(object sender, EventArgs e)
 {
     var nativeGameView = sender as CCGameView;
     if (nativeGameView == null)
         return;
     var contentSearchPaths = new List<string> () { "Fonts", "Sounds", "Images" };
     // TODO look at Ian Parson's Gone Bananas sample and make images path vary depending on resolution
     CCSprite.DefaultTexelToContentSizeRatio = 2.0f;  // TODO make this vary according to resolution
     nativeGameView.ContentManager.SearchPaths = contentSearchPaths;
     CCScene gameScene = new CCScene(nativeGameView);
     gameScene.AddLayer(GameModel.MakeLayer());
     nativeGameView.RunWithScene(gameScene);
 }
Пример #28
0
		public static CCScene SceneWithScore (CCWindow mainWindow, int score)
		{
			var scene = new CCScene (mainWindow);

			var winSize = mainWindow.WindowSizeInPixels;
			const float wbase = 640.0f;
			const float hbase = 1136.0f;

			var layer = new GameOverLayer (score, winSize.Width / wbase, winSize.Height / hbase);

			scene.AddChild (layer);

			return scene;
		}
        public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
        {
            application.PreferMultiSampling = false;
            application.ContentRootDirectory = "Content";
            application.ContentSearchPaths.Add("animations");
            application.ContentSearchPaths.Add("fonts");
            application.ContentSearchPaths.Add("sounds");

            CCSize windowSize = mainWindow.WindowSizeInPixels;

            float desiredWidth = 1024.0f;
            float desiredHeight = 768.0f;
            
            // This will set the world bounds to be (0,0, w, h)
            // Use CCSceneResolutionPolicy.Custom as we're manually setting our viewports
            CCScene.SetDefaultDesignResolution(desiredWidth, desiredHeight, CCSceneResolutionPolicy.Custom);
            
            // Determine whether to use the high or low def versions of our images
            // Make sure the default texel to content size ratio is set correctly
            // Of course you're free to have a finer set of image resolutions e.g (ld, hd, super-hd)
            if (desiredWidth < windowSize.Width)
            {
                application.ContentSearchPaths.Add("images/hd");
                CCSprite.DefaultTexelToContentSizeRatio = 2.0f;
            }
            else
            {
                application.ContentSearchPaths.Add("images/ld");
                CCSprite.DefaultTexelToContentSizeRatio = 1.0f;
            }
            
            var topViewport = new CCViewport(new CCRect(0.0f, 0.2f, .5f, 0.6f));
            var bottomViewport = new CCViewport(new CCRect(0.5f, 0.0f, .5f, 1.0f));

            // Each viewport needs its own director
            var sceneDirector1 = new CCDirector();
            var sceneDirector2 = new CCDirector();

            var scene1 = new CCScene(mainWindow, topViewport, sceneDirector1);
            var scene2 = new CCScene(mainWindow, bottomViewport, sceneDirector2);

            var layer1 = new GameLayer();
            var layer2 = new GameLayer();

            scene1.AddChild(layer1);
            scene2.AddChild(layer2);

            sceneDirector1.RunWithScene(scene1);
            sceneDirector2.RunWithScene(scene2);
        }
		public static CCScene GameStartLayerScene (CCWindow mainWindow)
		{
			var scene = new CCScene (mainWindow);

			var winSize = mainWindow.WindowSizeInPixels;
			const float wbase = 640.0f;
			const float hbase = 1136.0f;

			var layer = new GameStartLayer (winSize.Width / wbase, winSize.Height / hbase);

			scene.AddChild (layer);

			return scene;
		}
Пример #31
0
        public CCScene(CCScene scene)
            : this(scene.Window, scene.Viewport, scene.Director)
#endif
        {
        }
Пример #32
0
 public CCTransitionSceneContainerNode(CCScene scene, CCSize contentSize) : base(contentSize)
 {
     InnerScene = scene;
 }
Пример #33
0
 public CCTransitionScene(float duration, CCScene scene) : base(scene.Window, scene.Viewport)
 {
     InitCCTransitionScene(duration, scene);
 }
Пример #34
0
 public virtual void Reset(float t, CCScene scene)
 {
     InitCCTransitionScene(t, scene);
 }
Пример #35
0
 public void RunWithScene(CCScene scene)
 {
     StartGame();
     Director.RunWithScene(scene);
 }
 public CCTransitionFlipAngular(float t, CCScene s, CCTransitionOrientation o) : base(t, s, o)
 {
 }
Пример #37
0
        public bool DeserializeState()
        {
            try
            {
                // open up isolated storage
                using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication())
                {
                    // see if our saved state directory exists
                    if (storage.DirectoryExists(storageDirName))
                    {
                        string saveFile = System.IO.Path.Combine(storageDirName, saveFileName);
                        try
                        {
                            CCLog.Log("Loading director data file: {0}", saveFile);
                            // see if we have a screen list
                            if (storage.FileExists(saveFile))
                            {
                                // load the list of screen types
                                using (IsolatedStorageFileStream stream = storage.OpenFile(saveFile, FileMode.Open, FileAccess.Read))
                                {
                                    using (StreamReader reader = new StreamReader(stream))
                                    {
                                        CCLog.Log("Director save file contains {0} bytes.", reader.BaseStream.Length);
                                        try
                                        {
                                            while (true)
                                            {
                                                // read a line from our file
                                                string line = reader.ReadLine();
                                                if (line == null)
                                                {
                                                    break;
                                                }
                                                CCLog.Log("Restoring: {0}", line);

                                                // if it isn't blank, we can create a screen from it
                                                if (!string.IsNullOrEmpty(line))
                                                {
                                                    if (line.StartsWith("[*]"))
                                                    {
                                                        // Reading my state
                                                        string s   = line.Substring(3);
                                                        int    idx = s.IndexOf('=');
                                                        if (idx > -1)
                                                        {
                                                            string name = s.Substring(0, idx);
                                                            string v    = s.Substring(idx + 1);
                                                            CCLog.Log("Restoring: {0} = {1}", name, v);
                                                            DeserializeMyState(name, v);
                                                        }
                                                    }
                                                    else
                                                    {
                                                        Type    screenType = Type.GetType(line);
                                                        CCScene scene      = Activator.CreateInstance(screenType) as CCScene;
                                                        PushScene(scene);
                                                        //                                                    m_pobScenesStack.Add(scene);
                                                    }
                                                }
                                            }
                                        }
                                        catch (Exception)
                                        {
                                            // EndOfStreamException
                                            // this is OK here.
                                        }
                                    }
                                }
                                // Now we deserialize our own state.
                            }
                            else
                            {
                                CCLog.Log("save file does not exist.");
                            }

                            // next we give each screen a chance to deserialize from the disk
                            for (int i = 0; i < scenesStack.Count; i++)
                            {
                                string filename = System.IO.Path.Combine(storageDirName, string.Format(sceneSaveFileName, i));
                                if (storage.FileExists(filename))
                                {
                                    using (IsolatedStorageFileStream stream = storage.OpenFile(filename, FileMode.Open, FileAccess.Read))
                                    {
                                        CCLog.Log("Restoring state for scene {0}", filename);
                                        scenesStack[i].Deserialize(stream);
                                    }
                                }
                            }
                            if (scenesStack.Count > 0)
                            {
                                CCLog.Log("Director is running with scene..");

                                RunWithScene(scenesStack[scenesStack.Count - 1]); // always at the top of the stack
                            }
                            return(scenesStack.Count > 0 && RunningScene != null);
                        }
                        catch (Exception ex)
                        {
                            // if an exception was thrown while reading, odds are we cannot recover
                            // from the saved state, so we will delete it so the game can correctly
                            // launch.
                            DeleteState(storage);
                            CCLog.Log("Failed to deserialize the director state, removing old storage file.");
                            CCLog.Log(ex.ToString());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                CCLog.Log("Failed to deserialize director state.");
                CCLog.Log(ex.ToString());
            }

            return(false);
        }
Пример #38
0
 public CCTransitionProgressHorizontal(float t, CCScene scene) : base(t, scene)
 {
 }
Пример #39
0
 //OLD_TRANSITION_CREATE_FUNC(CCTransitionProgressVertical)
 //TRANSITION_CREATE_FUNC(CCTransitionProgressVertical)
 public CCTransitionProgressVertical(float t, CCScene scene) : base(t, scene)
 {
 }
Пример #40
0
 public CCScene(CCScene scene, bool physics = false)
     : this(scene.Window, scene.Viewport, scene.Director, physics)
Пример #41
0
 public CCTransitionProgressRadialCCW(float t, CCScene scene) : base(t, scene)
 {
 }
Пример #42
0
 public CCTransitionProgressOutIn(float t, CCScene scene) : base(t, scene)
 {
 }