//--------------------------------------------------------------------------------------------------------- // BackToMain //--------------------------------------------------------------------------------------------------------- // Returns to Main Menu //--------------------------------------------------------------------------------------------------------- void BackToMain(object stuff = null) { var layer = MenuLayer.CreateScene(Window); var transitionToLayer = new CCTransitionSlideInL(0.2f, layer); Director.ReplaceScene(transitionToLayer); }
//--------------------------------------------------------------------------------------------------------- // CreateScene //--------------------------------------------------------------------------------------------------------- public static CCScene CreateScene(CCWindow mainWindow) { var scene = new CCScene(mainWindow); var layer = new MenuLayer(); scene.AddChild(layer); return(scene); }
//--------------------------------------------------------------------------------------------------------- // QuitLevel //--------------------------------------------------------------------------------------------------------- // Transitions to the main MenuLayer //--------------------------------------------------------------------------------------------------------- void QuitLevel(object stuff = null) { var nextTutorialLevel = GetNextTutorialLevelToPlay(); if (nextTutorialLevel.BranchNum > 0) { activePlayer.BranchProgression [1].IsLocked = false; activePlayer.BranchProgression [0].BranchState = CompletionState.completed; activePlayer.ConsumableAdd = activePlayer.ConsumableCheckPoint = activePlayer.ConsumableNextSeq = activePlayer.ConsumableSubtract = 0; activePlayer.WriteData(activePlayer); } var mainMenu = MenuLayer.CreateScene(Window); var transitionToMainMenu = new CCTransitionFade(2.0f, mainMenu); Director.ReplaceScene(transitionToMainMenu); }
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"); sharedWindow = mainWindow; CCSize windowSize = mainWindow.WindowSizeInPixels; float desiredWidth = 1080.0f; // 960 float desiredHeight = 1920.0f; // 1704 // 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; } //var scene = GameStartLayer.CreateScene(mainWindow); var scene = MenuLayer.CreateScene(mainWindow); mainWindow.RunWithScene(scene); }