/// <summary> /// 解析剧情(主要是比较复杂的项目使用,小项目直接new) /// </summary> /// <returns></returns> public PlotInfo ParsePlot(string command) { command = command.Replace("\r", ""); string[] commandAry = command.Split('\n'); Init(); for (int i = 0; i < commandAry.Length; i++) { if (commandAry[i].Equals("")) { continue; } string[] commandStruct = commandAry[i].Split('_'); //命令 PlotCommand pc = PlotFactory.CreatePlotCommand(commandStruct[0]); if (pc != null) { pc.OnParse(commandStruct[1]); PI.AddCommand(pc); } else { Debug.Log("创建命令失败"); } } return(PI); }
public void AddCommand(PlotCommand plotCommand) { if (Count > 0) { plotCommand.PreCommand = m_PlotCommands[Count - 1]; m_PlotCommands[Count - 1].NextCommand = plotCommand; } m_PlotCommands.Add(plotCommand); }
public static PlotCommand CreatePlotCommand(string name) { PlotCommand command = null; switch (name) { case "DialogUICommand": command = new DialogUICommand(true); break; } return(command); }