public HighScoreLayer(int score)
            : base()
        {
            var batchnode = GetChild ((int)Tags.SpriteManager) as CCSpriteBatchNode;
            var title = new CCSprite (batchnode.Texture, new CGRect (608, 192, 225, 57)) { Position = new CGPoint (160, 240) };
            batchnode.Add (title);

            var button1 = new CCMenuItemImage ("Images/playAgainButton.png", "Images/playAgainButton.png", (sender) => {
                CCDirector.SharedDirector.ReplaceScene (new CCTransitionFade (.5f, GameLayer.Scene, CCColor3B.White));
            });
            var button2 = new CCMenuItemImage ("Images/changePlayerButton.png", "Images/changePlayerButton.png", (sender) => {

            });
            var menu = new CCMenu (new CCMenuItem[] { button1, button2 }) { Position = new CGPoint (160, 58) };
            menu.AlignItemsVertically (9);

            Add (menu);
        }
        public HelloWorldLayer()
        {
            // create and initialize a Label
            var label = new CCLabelTTF ("Hello mtouch", "Marker Felt", 64);
            // ask director for the window size
            var size = CCDirector.SharedDirector.WinSize;

            // position the label on the center of the screen
            label.Position = new PointF(size.Width/2, size.Height/2);
            // add the label as a child to this Layer
            Add(label);

            //
            // Leaderboards and Achievements
            //

            // Default font size will be 28 points.
            CCMenuItemFont.DefaultFontSize = 28;

            // Achievement Menu Item
            var itemAchievement = new CCMenuItemFont("Achievements", (sender)=>{
                var achievementController = new GKAchievementViewController() {Delegate = new AchievementDelegate()};
                var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate;
                var navController = appDelegate.NavController;
                navController.PresentModalViewController(achievementController, true);
            });

            // Leaderboard Menu Item
            var itemLeaderBoard = new CCMenuItemFont ("Leaderboard", (sender) => {
                var leaderboardController = new GKLeaderboardViewController() {Delegate = new LeaderboardDelegate()};
                var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate;
                var navController = appDelegate.NavController;
                navController.PresentModalViewController(leaderboardController, true);
            });

            var menu = new CCMenu (new CCMenuItem [] {itemAchievement, itemLeaderBoard});
            menu.AlignItemsHorizontally(20);
            menu.Position = new PointF (size.Width/2, size.Height/2 - 50);
            // Add the menu to the layer
            Add (menu);
        }
Ejemplo n.º 3
0
        void CreateMenu()
        {
            CCMenuItemFont.DefaultFontSize = 22;

            var reset = new CCMenuItemFont("Reset",(sender)=>{
                CCDirector.SharedDirector.ReplaceScene(HelloWorldLayer.Scene);
            });

            var menu = new CCMenu(new CCMenuItem[]{reset});
            menu.AlignItemsVertically();
            var size = CCDirector.SharedDirector.WinSize;
            menu.Position=new PointF(size.Width/2, size.Height/2);
            Add (menu,-1);
        }