public void OnPMLevelChanged() { currentGuide = GuideLoader.GetCurrentLevelGuide(); if (currentGuide != null) { currentGuide.currentGuideIndex = 0; } shouldPlayNext = true; }
private static LevelGuide BuildFromString(string filename, string fileText) { List <string> rows = new List <string>(fileText.Split(linebreaks, StringSplitOptions.RemoveEmptyEntries)); LevelGuide levelGuide = new LevelGuide(); //Target target; string target = ""; int lineNumber = 0; string guideMessage = ""; for (int i = 0; i < rows.Count; i++) { // Comments if (rows[i].StartsWith("//") || rows[i].StartsWith("#")) { continue; } // get index of colon and split into target and guidemessage int colonIndex = rows[i].IndexOf(":"); target = rows [i].Substring(0, colonIndex).Trim().ToLower(); guideMessage = rows[i].Substring(colonIndex + 1).Trim(); // Check if target is a number Match match = Regex.Match(target, @"^[0-9]+$"); if (match.Success) { int.TryParse(target, out lineNumber); levelGuide.guides.Add(new Guide(target, guideMessage, lineNumber)); } else { levelGuide.guides.Add(new Guide(target, guideMessage)); } } // Return no levelGuide if it has no guides if (levelGuide.guides.Count == 0) { return(null); } return(levelGuide); }
public static void BuildAll() { TextAsset masterAsset = Resources.Load <TextAsset>(guideResourceName); if (masterAsset == null) { throw new Exception("The file \"" + guideResourceName + "\" could not be found."); } string[] textRows = masterAsset.text.Trim().Split(linebreaks, StringSplitOptions.RemoveEmptyEntries); string guideFileName = ""; int guidesBuilt = 0; for (int i = 0; i < textRows.Length; i++) { if (guidesBuilt >= PMWrapper.numOfLevels) { break; } // Ignore comments if (textRows[i].StartsWith("//") || textRows[i].StartsWith("#")) { continue; } guideFileName = textRows[i].Trim(); LevelGuide guide = BuildFromPath(guideFileName); if (guide != null) { guide.level = guidesBuilt; allGuides.Add(guide); } guidesBuilt++; } }