private SortedList <string, GENpc.GELine> ProcessLines(List <NPCsTypeNPCConversationLine> lines, GENpc.GEConversation conv) { SortedList <string, GENpc.GELine> processedLines = new SortedList <string, GENpc.GELine>(); if (lines == null || lines.Count == 0) { return(processedLines); } foreach (NPCsTypeNPCConversationLine line in lines) { GENpc.GELine newLine = new GENpc.GELine(line.id, conv, line.isLastLine); List <GENpc.GEAnswer> answers = ProcessAnswers(line.Answer, newLine); newLine.Answers = answers; OnReferenceProcessing += delegate(object o, EventArgs e) { newLine.LineText = elementManager.GetTextElement(line.lineTextId); }; processedLines.Add(line.id, newLine); elementManager.AddNpcConvLine(newLine); } return(processedLines); }
public void AddNpcConvLine(GENpc.GELine line) { AddToDic(npcConvLines, line); }
private List <GENpc.GEAnswer> ProcessAnswers(List <NPCsTypeNPCConversationLineAnswer> answers, GENpc.GELine line) { List <GENpc.GEAnswer> processedAnswers = new List <GENpc.GEAnswer>(); if (answers == null || answers.Count == 0) { return(processedAnswers); } foreach (NPCsTypeNPCConversationLineAnswer answer in answers) { GERequirement requirement = ProcessRequirements(answer.Requirements); GENpc.GEItemAction action = ProcessActions(answer.Actions, answer.id); GENpc.GEAnswer newAnser = new GENpc.GEAnswer(answer.id, answer.activeAtStart, line) { Requirement = requirement, Action = action }; OnReferenceProcessing += delegate(object o, EventArgs e) { newAnser.AnswerText = elementManager.GetTextElement(answer.textId); newAnser.NextLine = elementManager.GetNpcConvLine(answer.nextLineId); }; processedAnswers.Add(newAnser); elementManager.AddNpcAnswer(newAnser); } return(processedAnswers); }
public static MenuItemBundle CreateConversationLineBundle(string bundleName, MenuItemBundle parent, GENpc.GELine line, string talkerName) { Description descriptionPanel = Description.GetInstance(); MenuItemBundle newBundle = new MenuItemBundle(bundleName, parent); newBundle.OnExecutionSidefects += delegate(object o, EventArgs e) { descriptionPanel.AddDescriptionText(talkerName + ":\n" + line.LineText.GetText()); }; if (line.Answers.Count == 0 || line.IsLastLine) { newBundle.AddMenuItem(new MIBack(parent)); return(newBundle); } int i = 1; bool isShort = GENpc.GEAnswer.IsAnswerShort(line.Answers, 12); foreach (GENpc.GEAnswer answer in line.Answers) { if (isShort) { newBundle.AddMenuItem(new MIAnswer(answer.AnswerText.GetText(), answer, parent, talkerName)); } else { MIAnswer item = new MIAnswer(i++.ToString(), answer, parent, talkerName); newBundle.AddMenuItem(item); newBundle.OnExecutionSidefects += delegate(object o, EventArgs e) { if (answer.IsActive()) { descriptionPanel.AddDescriptionText(item.GetMenuText() + ": " + answer.AnswerText.GetText()); } }; } answer.OnActivationChange += newBundle.RefreshOnEvent; } return(newBundle); }