public void LoadAllCustomChapters() { string[] folders = Directory.GetDirectories(Application.persistentDataPath + "/CustomChapters/"); Debug.Log(TAG + "___________________there are " + folders.Length + " custom chapters________________"); customLevelFolder = new LevelCon[folders.Length]; for (int i = 0; i < folders.Length; i++) { string folder = folders[i]; string[] s = folder.Split('/'); string n = s[s.Length - 1]; string[] nn = n.Split('.'); string name = nn[0]; Debug.Log(TAG + "folder is " + folder); LevelCon l = new LevelCon(LoadCustomLevels(folder)); l.SetFolderName(name); customLevelFolder[i] = l; } }
public void SetUp(ChapterManager chapterManager) { Debug.Log(TAG + "setting up"); ChapterManager.ChapterRef[] chapters = chapterManager.GetChapters(); levelFolder = new LevelCon[chapters.Length]; for (int i = 0; i < chapters.Length; i++) { ChapterManager.ChapterRef chapter = chapters[i]; string folder = chapter.GetFolder(); levelFolder[i] = new LevelCon(LoadCurLevels(folder)); } if (!Directory.Exists(Application.persistentDataPath + "/CustomChapters")) { Debug.Log(TAG + "no folder found, creating now..."); Directory.CreateDirectory(Application.persistentDataPath + "/CustomChapters"); //there will be no levels so just return //return; } //posibly don't have to load custom chapters until needed //LoadAllCustomChapters(); }