/// <summary> /// Load context.Map and data /// </summary> public void PrepareGame() { this.GameInit(); context.SelectedMap = levelSelectionScreen.World.GetMapFirstFile(levelSelectionScreen.SelectedLevelIndex); //Free memory if (context.Map != null) { context.Map.UnloadMapContent(); } context.Map = null; loadingLayer = new LoadingScreen(Map.GetMapOverview(context.SelectedMap), this); this.context.CurrentGameState = GameState.Loading; LoadMap(); }
/// <summary> /// Play next level or replay already loaded context.Map /// </summary> /// <param name="win"></param> public void NextLevel(bool win) { //Next context.Map or Menu if finish if (win) { if (levelSelectionScreen.World.CanGoNextLevel()) { context.SelectedMap = levelSelectionScreen.World.GetNextLevel(); } else { //End of the game if (context.IsTrialMode) { TGPAContext.Instance.CurrentGameState = GameState.DemoEnd; } else { TGPAContext.Instance.CurrentGameState = GameState.Credits; } return; } } //Reload context.Map else { //Free memory if (context.Map != null) { context.Map.UnloadMapContent(); } context.Map = null; context.SelectedMap = levelSelectionScreen.World.GetCurrentLevel(); } loadingLayer = new LoadingScreen(Map.GetMapOverview(context.SelectedMap), this); this.GameInit(); this.context.CurrentGameState = GameState.Loading; new Thread(LoadMap).Start(); }