public static void AtScene(GameApp cm, string scene) { bool if_else = false; bool skip_line = false; // Debug.Log("AtScene: scenes[scene] = " + scenes[scene].ToString()); cm.status["atScene"] = null; JSONArray sceneItem = cm.scenes[scene].AsArray; for (int i = 0; i < sceneItem.Count; i++) { // 转换成 string, 去掉首尾的 “ string line = sceneItem[i].ToString().Substring(1, sceneItem[i].ToString().Length - 2); // Debug.Log("line = " + line); if (if_else) { if (line.StartsWith("<<elseif")) { skip_line = !skip_line; } else if (line.StartsWith("<<else")) { skip_line = !skip_line; continue; } else if (line.Equals("<<endif>>")) { if_else = false; continue; } if (skip_line) { continue; } } if (line.StartsWith("<<if") || line.StartsWith("<<elseif")) { if_else = true; string LineWithNoTag = line.Substring(2, line.Length - 4); if (LineWithNoTag.Contains(" and ")) { skip_line = AndOrInLine.and_InLine(cm, LineWithNoTag); } else if (LineWithNoTag.Contains(" or ")) { skip_line = AndOrInLine.or_InLine(cm, LineWithNoTag); } else { skip_line = AndOrInLine.and_or_NotInLine(cm, LineWithNoTag); } } else if (line.StartsWith("<<set")) { ParseText.HandleSet(cm, line); } else if (line.StartsWith("[[")) { ParseText.ToNewScene(cm, line); } else if (line.StartsWith("<<category")) { ParseText.HandleChoice(cm, line, scene); } else if (line.StartsWith("<<revert ")) { ParseText.HandleRevert(cm, line); } else { ParseText.AddLeftChats(cm, line, scene); } } }