public void LoadNextLevel() { if (this.m_currentEpisodeType == GameManager.EpisodeType.Race) { this.LoadRaceLevel(this.NextRaceLevel()); return; } int num = this.NextLevel(); bool flag = LevelInfo.IsLevelUnlocked(this.CurrentEpisodeIndex, num); bool flag2 = true; bool flag3 = false; bool flag4 = num % 5 == 0; int num2 = num / 5; bool flag5 = GameProgress.IsLevelAdUnlocked(LevelInfo.GetLevelNames(this.CurrentEpisodeIndex)[num2 * 5]); bool flag6 = LevelInfo.IsLevelUnlocked(this.CurrentEpisodeIndex, num2 * 5); if (flag4 && !flag5 && !flag6) { EventManager.Send(new UIEvent(UIEvent.Type.LevelSelection)); } else if (LevelInfo.IsContentLimited(this.CurrentEpisodeIndex, num) && Singleton <BuildCustomizationLoader> .Instance.IsChina && GameProgress.GetInt(Singleton <GameManager> .Instance.CurrentSceneName + "_stars", 0, GameProgress.Location.Local, null) != 3 && GameProgress.GetInt(Singleton <GameManager> .Instance.CurrentSceneName + "_stars", 0, GameProgress.Location.Local, null) != 0) { LevelInfo.DisplayContentLimitNotification(); GameProgress.SetBool("show_content_limit_popup", true, GameProgress.Location.Local); EventManager.Send(new UIEvent(UIEvent.Type.LevelSelection)); } else if (flag3 && !flag2 && flag) { EventManager.Send(new UIEvent(UIEvent.Type.LevelSelection)); } else { if (Singleton <BuildCustomizationLoader> .Instance.IsChina && GameProgress.GetInt(Singleton <GameManager> .Instance.CurrentSceneName + "_stars", 0, GameProgress.Location.Local, null) == 3 && GameProgress.GetMinimumLockedLevel(this.CurrentEpisodeIndex) <= this.CurrentLevel + 1) { GameProgress.SetMinimumLockedLevel(this.CurrentEpisodeIndex, GameProgress.GetMinimumLockedLevel(this.CurrentEpisodeIndex) + 1); } this.m_currentLevel = num; this.LoadLevel(this.CurrentLevel); } if (this.m_currentEpisode != string.Empty) { int num3 = this.m_currentLevel / 15; int num4 = this.m_currentLevel / 5; if (num4 % 3 == 2 && this.m_currentLevel % 5 == 3 && !flag2) { num3++; } UserSettings.SetInt(this.m_currentEpisode + "_active_page", num3); } }
public static bool IsContentLimited(int episodeIndex, int levelIndex = 0) { bool flag = GameProgress.GetFullVersionUnlocked() || (episodeIndex == 0 && levelIndex < 15) || (episodeIndex == -1 && levelIndex < 4) || (episodeIndex > 0 && levelIndex < 5); if (Singleton <BuildCustomizationLoader> .Instance.IsChina && episodeIndex >= 0) { if (!LevelInfo.IsStarLevel(episodeIndex, levelIndex) && levelIndex + 1 - (levelIndex + 1) / 5 + 1 == GameProgress.GetMinimumLockedLevel(episodeIndex) && LevelInfo.GetStars(episodeIndex, levelIndex) == 3) { GameProgress.SetMinimumLockedLevel(episodeIndex, GameProgress.GetMinimumLockedLevel(episodeIndex) + 1); } flag = (episodeIndex >= 0 && levelIndex + 1 - (levelIndex + 1) / 5 < GameProgress.GetMinimumLockedLevel(episodeIndex)); if (LevelInfo.IsStarLevel(episodeIndex, levelIndex)) { flag = true; } } return(!flag); }
public void TextUpdated(GameObject textObject) { TextMesh component = textObject.GetComponent <TextMesh>(); if (component.text.Contains("%")) { if (this.isButton) { component.text = component.text.Replace("%3", base.gameObject.transform.FindChildRecursively("PriceText").GetComponent <TextMesh>().text); } string text = GameProgress.GetMinimumLockedLevel(Singleton <GameManager> .Instance.CurrentEpisodeIndex).ToString(); component.text = component.text.Replace("%1", text); string text2 = Mathf.Min(Singleton <GameManager> .Instance.LevelCount - Singleton <GameManager> .Instance.LevelCount / 5, int.Parse(text) + 9).ToString(); component.text = component.text.Replace("%2", text2); if (text == text2) { component.text = component.text.Replace("s " + text2 + "-" + text2, " " + text2); component.text = component.text.Replace(text2 + "-" + text2, text2); } } }
public static GameObject Create() { Object original = Resources.Load("UI/PageLevelsLocked"); GameObject gameObject = UnityEngine.Object.Instantiate(original) as GameObject; gameObject.name = "RegistrationDialog"; GameObject gameObject2 = GameObject.FindGameObjectWithTag("HUDCamera"); gameObject.transform.position = gameObject2.transform.position + Vector3.forward * 5f; if (Singleton <GameManager> .Instance.LevelCount - Singleton <GameManager> .Instance.LevelCount / 5 < GameProgress.GetMinimumLockedLevel(Singleton <GameManager> .Instance.CurrentEpisodeIndex) + 10) { gameObject.transform.FindChildRecursively("BuyButton10").gameObject.SetActive(false); gameObject.transform.FindChildRecursively("BuyButtonWholeEpisode").gameObject.SetActive(false); gameObject.transform.FindChildRecursively("DescriptionText10").gameObject.SetActive(false); gameObject.transform.FindChildRecursively("DescriptionTextWhole").gameObject.SetActive(false); gameObject.transform.FindChildRecursively("SmokeParticles10").gameObject.SetActive(false); gameObject.transform.FindChildRecursively("SmokeParticlesWhole").gameObject.SetActive(false); gameObject.transform.FindChildRecursively("BuyButton9").gameObject.SetActive(true); gameObject.transform.FindChildRecursively("DescriptionTextWhole").gameObject.SetActive(false); gameObject.transform.FindChildRecursively("DescriptionText9").gameObject.SetActive(true); gameObject.transform.FindChildRecursively("SmokeParticles9").gameObject.SetActive(true); } return(gameObject); }