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); }
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); }