void Start() { this.curIdx = 1; this.lastIdx = -1; for (int i = SceneMng.sceneCountInBuildSettings; i > 0; i--) { string name = SceneUtil.GetScenePathByBuildIndex(i - 1); if (name.IndexOf(this.StopLoadingAt) != -1) { this.lastIdx = i - 1; break; } } if (this.lastIdx == -1) { throw new System.Exception("Couldn't find the last level"); } if (CreateLevelSelectors.cache == null) { cache = new CachedLevel[this.lastIdx]; for (int i = 0; i < cache.Length; i++) { CreateLevelSelectors.cache[i].tex = null; CreateLevelSelectors.cache[i].mat = null; } } this.StartCoroutine(this.start()); }
static private void UpdateList() { int i; int max = SceneMng.sceneCountInBuildSettings; for (i = 1; i < max; i++) { string name = SceneUtil.GetScenePathByBuildIndex(i); int pos = name.LastIndexOf("/"); char first = name[pos + 1]; /* Every level start with a number, so use this to find the * number of levels */ if (first < '0' && first > '9') { break; } } max = i; _list = new string[max]; for (i = 1; i < max; i++) { _list[i] = ProcessName(SceneUtil.GetScenePathByBuildIndex(i)); } }
private void listLevels() { this.lastIdx = -1; for (int i = SceneMng.sceneCountInBuildSettings; i > 0; i--) { string name = SceneUtil.GetScenePathByBuildIndex(i - 1); if (name.EndsWith(".unity")) { name = name.Remove(name.Length - 6); } if (name.EndsWith(this.StopLoadingAt)) { this.lastIdx = i - 1; break; } } if (this.lastIdx == -1) { throw new System.Exception("Couldn't find the last level"); } if (LevelSelectMenu.cache == null) { cache = new CachedLevel[this.lastIdx - 1]; for (int i = 0; i < LevelSelectMenu.cache.Length; i++) { LevelSelectMenu.cache[i].tex = null; LevelSelectMenu.cache[i].mat = null; LevelSelectMenu.cache[i].name = LevelNameList.GetLevel(i + 1); } } this.numItems = LevelSelectMenu.cache.Length; }