Exemplo n.º 1
0
        public AboutLayer() : base(CCColor4B.Blue)
        {
            background             = new CCSprite("aboutBg.jpg");
            background.AnchorPoint = CCPoint.AnchorLowerLeft;
            background.Position    = CCPoint.Zero;
            AddChild(background);

            // create and initialize a Label
            label1 = new CCLabel("Developed by:", "Fonts/MarkerFelt", 22, CCLabelFormat.SpriteFont);
            label2 = new CCLabel(" Lin LY", "Fonts/MarkerFelt", 22, CCLabelFormat.SpriteFont);
            label3 = new CCLabel(" Youke XIANG", "Fonts/MarkerFelt", 22, CCLabelFormat.SpriteFont);

            // add the label as a child to this Layer
            AddChild(label1);
            AddChild(label2);
            AddChild(label3);

            mniBack = new CCMenuItemImage(new CCSprite("btnBack.png"), new CCSprite("btnBack.png"), delegate(object obj)
            {
                GameView.Director.PushScene(HomeLayer.HomeScene(GameView));
            });
            mnuBack = new CCMenu(new CCMenuItem[] { mniBack });
            mnuBack.AlignItemsVertically();

            AddChild(mnuBack);
        }
Exemplo n.º 2
0
        public ScoreLayer() : base(CCColor4B.Blue)
        {
            background             = new CCSprite("aboutBg.jpg");
            background.AnchorPoint = CCPoint.AnchorLowerLeft;
            background.Position    = CCPoint.Zero;
            AddChild(background);

            mniBack = new CCMenuItemImage(new CCSprite("btnBack.png"), new CCSprite("btnBack.png"), delegate(object obj)
            {
                GameView.Director.PushScene(HomeLayer.HomeScene(GameView));
            });
            mnuBack = new CCMenu(new CCMenuItem[] { mniBack });
            mnuBack.AlignItemsVertically();

            AddChild(mnuBack);

            var sprSheet = new CCSpriteSheet("coin.plist");

            sprCoin = new CCSprite(sprSheet.Frames[0]);
            var spinningAnimation       = new CCAnimation(sprSheet.Frames, 0.05f);
            var spinningRepeatAnimation = new CCRepeatForever(new CCAnimate(spinningAnimation));

            sprCoin.RunAction(spinningRepeatAnimation);

            AddChild(sprCoin);

            label = new CCLabel("High scores", "Fonts/MarkerFelt", 22, CCLabelFormat.SpriteFont);
            AddChild(label);
        }
Exemplo n.º 3
0
        public static CCScene HomeScene(CCGameView gameView)
        {
            var scene = new CCScene(gameView);
            var layer = new HomeLayer();

            scene.AddChild(layer);

            return(scene);
        }
Exemplo n.º 4
0
        public static void LoadGame(object sender, EventArgs e)
        {
            CCGameView gameView = sender as CCGameView;

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

                int width  = 768;
                int height = 1280;

                // Set world dimensions
                gameView.DesignResolution = new CCSizeI(width, height);

                // 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 (width < viewSize.Width)
                {
                    contentSearchPaths.Add("Images/Hd");
                    CCSprite.DefaultTexelToContentSizeRatio = 2.0f;
                }
                else
                {
                    contentSearchPaths.Add("Images/Ld");
                    CCSprite.DefaultTexelToContentSizeRatio = 1.0f;
                }

                gameView.ContentManager.SearchPaths = contentSearchPaths;

                gameView.RunWithScene(HomeLayer.HomeScene(gameView));
            }
        }