public bool SetStageStyle(string stageType) { if (stageType.Equals("spring_forest")) { stageStyle_ = StageStyle.SpringForest; return(true); } else if (stageType.Equals("cave")) { stageStyle_ = StageStyle.Cave; } else if (stageType.Equals("ice_world")) { stageStyle_ = StageStyle.IceWorld; } else if (stageType.Equals("rock_field")) { stageStyle_ = StageStyle.RockField; } else if (stageType.Equals("swimming")) { stageStyle_ = StageStyle.Swimming; } else if (stageType.Equals("under_the_sea")) { stageStyle_ = StageStyle.UnderTheSea; } else if (stageType.Equals("winter_Forest")) { stageStyle_ = StageStyle.WinterForest; } else { return(false); } return(true); }
public bool LoadStage(StageStyle stageStyle, int stageNum) { string stageFolder; switch (stageStyle) { case StageStyle.orignal: stageFolder = "StageData/OriginalStages/"; break; case StageStyle.hard: stageFolder = "StageData/HardStages/"; break; case StageStyle.custom: stageFolder = "StageData/CustomStages/"; break; default: stageFolder = "StageData/OriginalStages/"; break; } loadingFilePath_ = stageFolder + string.Format("{0:D2}.txt", stageNum); if (File.Exists(loadingFilePath_) == false) { return(false); } using (StreamReader sr = new StreamReader(loadingFilePath_)) { parcingLineNum_ = 0; string currentLine; TagType parcingTag = TagType.NONE; while (string.IsNullOrEmpty(currentLine = sr.ReadLine()) == false) { currentLine.Trim(); parcingLineNum_++; switch (parcingTag) { case TagType.monsters: ProcessMonsterLine(currentLine); break; case TagType.objects: ProcessObjectLine(currentLine); break; case TagType.stage: ProcessStageLine(currentLine); break; case TagType.NONE: default: { ParseError(currentLine, "unknown open tag"); } break; } if (IsComment(currentLine)) { continue; } if (IsCloseTag(currentLine)) { if (parcingTag != TagType.NONE) { parcingTag = TagType.NONE; } else { ParseError(currentLine, "unexcpeted close tag"); } continue; } if (IsOpenTag(currentLine)) { if (parcingTag != TagType.NONE) { ParseError(currentLine, "unexcepted open tag"); } parcingTag = ParseTag(currentLine); if (parcingTag == TagType.NONE) { ParseError(currentLine, "unknown open tag"); } continue; } } } return(false); }