public void EnterNextLevel() { DisableInteractivity(); Player player = Player.mainPlayer; player.currentLevelIndex++; if (player.currentLevelIndex >= 50) { Debug.Log("通关"); return; } if (player.currentLevelIndex > player.maxUnlockLevelIndex) { player.maxUnlockLevelIndex = player.currentLevelIndex; } GameManager.Instance.persistDataManager.SaveCompletePlayerData(); GameLevelData levelData = GameManager.Instance.gameDataCenter.gameLevelDatas [player.currentLevelIndex]; SetUpExploreView(levelData); EnableInteractivity(); }
public void RefrestCurrentLevel() { mapGenerator.PrepareToResetMap(); PlayerData playerData = GameManager.Instance.persistDataManager.LoadPlayerData(); Player.mainPlayer.SetUpPlayerWithPlayerData(playerData); int gameLevel = Player.mainPlayer.currentLevelIndex; GameLevelData levelData = GameManager.Instance.gameDataCenter.gameLevelDatas [gameLevel]; battlePlayerCtr.ResetAgent(); if (monsterEntered != null) { monsterEntered.GetComponent <BattleMonsterController> ().ResetAgent(); monsterEntered = null; } expUICtr.QuitFight(); SetUpExploreView(levelData); }
private IEnumerator LoadExploreData() { yield return(null); GameLevelData levelData = GameManager.Instance.gameDataCenter.gameLevelDatas [Player.mainPlayer.currentLevelIndex]; QuitHomeView(); GameManager.Instance.UIManager.UnloadAllCanvasInSceneExcept(new string[] { "BagCanvas" }); GameManager.Instance.UIManager.SetUpCanvasWith(CommonData.exploreSceneBundleName, "ExploreCanvas", () => { TransformManager.FindTransform("ExploreManager").GetComponent <ExploreManager> ().SetUpExploreView(levelData); }, true, false); }
//Initializes the game for each level. public void SetUpExploreView(GameLevelData levelData) { // StartCoroutine ("SetUpExploreAfterDataReady",levelData); // // } // // private IEnumerator SetUpExploreAfterDataReady(GameLevelData levelData){ // // bool dataReady = false; // // while (!dataReady) { // // dataReady = GameManager.Instance.gameDataCenter.CheckDatasReady (new GameDataCenter.GameDataType[] { // GameDataCenter.GameDataType.UISprites, // GameDataCenter.GameDataType.GameLevelDatas, //// GameDataCenter.GameDataType.Monsters, // GameDataCenter.GameDataType.NPCs, // GameDataCenter.GameDataType.ItemModels, // GameDataCenter.GameDataType.ItemSprites, // GameDataCenter.GameDataType.MapSprites, // GameDataCenter.GameDataType.Skills, // GameDataCenter.GameDataType.SkillSprites, // }); // // yield return null; // } if (!SoundManager.Instance.bgmAS.isPlaying || SoundManager.Instance.bgmAS.clip.name != CommonData.exploreBgmName) { SoundManager.Instance.PlayBgmAudioClip(CommonData.exploreBgmName); } levelData.LoadAllData(); currentLevelIndex = levelData.gameLevelIndex; mapGenerator.SetUpMap(levelData); ExploreUICotroller expUICtr = TransformManager.FindTransform("ExploreCanvas").GetComponent <ExploreUICotroller> (); expUICtr.SetUpExploreCanvas(levelData.gameLevelIndex, levelData.chapterName); battlePlayerCtr.InitBattlePlayer(); EnableInteractivity(); }