//end reference OnTouchesBegan //method returns the level select screen. used in TitleLayer public static CCScene GetLevelSelectScene(CCWindow window) { CCScene scene = new CCScene(window); CCLayer layer = new LevelSelect(window.WindowSizeInPixels); scene.AddChild(layer); return(scene); }
//LevelComplete displays the highscore and provides means to return to Level Select once the level is complete void LevelComplete(CCRect boundary) { highScore = p1Score; CCLabel label = new CCLabel("Level Complete!", "Arial", 60, CCLabelFormat.SystemFont); label.Position = boundary.Center; label.AnchorPoint = CCPoint.AnchorMiddle; label.Text = string.Format("Level Complete! Highscore: {0}", highScore); AddChild(label); CCLabel tapToReturn = new CCLabel("Tap to return to Level Select", "Arial", 50, CCLabelFormat.SystemFont); tapToReturn.PositionX = boundary.MaxX / 2; tapToReturn.PositionY = 1000; AddChild(tapToReturn); var touchListener = new CCEventListenerTouchAllAtOnce(); touchListener.OnTouchesEnded = (touches, ccevent) => Window.DefaultDirector.ReplaceScene(LevelSelect.GetLevelSelectScene(Window)); AddEventListener(touchListener, this); }
//what occurs when gameOver == true void GameOver(bool isGameOver) { if (isGameOver) { CCLabel label = new CCLabel("Tap to return to Level Select", "Arial", 50, CCLabelFormat.SystemFont); label.PositionX = 400; label.PositionY = 1000; label.AnchorPoint = CCPoint.AnchorUpperLeft; AddChild(label); var touchListener = new CCEventListenerTouchAllAtOnce(); touchListener.OnTouchesEnded = (touches, ccevent) => Window.DefaultDirector.ReplaceScene(LevelSelect.GetLevelSelectScene(Window)); AddEventListener(touchListener, this); highScore = p1Score; } }
public TitleLayer() : base() { var touchListener = new CCEventListenerTouchAllAtOnce(); touchListener.OnTouchesEnded = (touches, ccevent) => Window.DefaultDirector.ReplaceScene(LevelSelect.GetLevelSelectScene(Window)); AddEventListener(touchListener, this); }