Beispiel #1
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 desiredWidth  = 600.0f;
            float desiredHeight = 600.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;
            }

            mainWindow.RunWithScene(GameLayer.GameScene(mainWindow));
        }
Beispiel #2
0
        public static CCScene GameScene(CCWindow mainWindow)
        {
            var scene = new CCScene(mainWindow);
            var layer = new GameLayer();

            scene.AddChild(layer);

            return(scene);
        }
Beispiel #3
0
        public GameOverLayer(Board.State?winner)
        {
            var touchListener = new CCEventListenerTouchAllAtOnce();

            touchListener.OnTouchesEnded = (touches, ccevent) => Window.DefaultDirector.ReplaceScene(GameLayer.GameScene(Window));

            AddEventListener(touchListener, this);

            if (!winner.HasValue)
            {
                scoreMessage = "Game Over, but it ended Remis.";
            }
            else
            {
                scoreMessage = String.Format("Game Over. {0} has won!", winner.Value.ToString());
            }

            Color = new CCColor3B(CCColor4B.Black);

            Opacity = 255;
        }