private static DialogNode loadNode(XmlElement xmlEl, ref Conversation conversation, ref List <DialogResponse> respWithoutChildren, ref List <DialogResponse> respThatSwitchConv) { string id = xmlEl.GetAttribute("id"); string npcPhrase = xmlEl.GetAttribute("npcPhrase"); //string voiceFile = xmlEl.GetAttribute("voiceFile"); DialogNode node = new DialogNode(id, npcPhrase); XmlNodeList responsesXNL = xmlEl.ChildNodes; for (int j = 0; j < responsesXNL.Count; j++) { XmlElement responseXE = (XmlElement)responsesXNL[j]; string pcPhrase = responseXE.GetAttribute("pcPhrase"); string link = responseXE.GetAttribute("link"); ResponseLinkType linkType = ResponseLinkType.dialogNode; if (responseXE.GetAttribute("linkType"). Equals("dialogNode")) { linkType = ResponseLinkType.dialogNode; } else if (responseXE.GetAttribute("linkType"). Equals("endConversation")) { linkType = ResponseLinkType.endConversation; } else { linkType = ResponseLinkType.endAndChangeConversation; } string switchConv = responseXE. GetAttribute("switchConversation"); bool onlyAllowOnce = bool.Parse(responseXE. GetAttribute("onlyAllowOnce")); DialogResponse response = new DialogResponse(pcPhrase, link, onlyAllowOnce, linkType, switchConv); node.addResponse(response); if (responseXE.HasChildNodes) { XmlElement childNode = (XmlElement)responseXE.FirstChild; DialogNode dn = loadNode(childNode, ref conversation, ref respWithoutChildren, ref respThatSwitchConv); response.childNode = dn; conversation.addDialogNode(dn); } else if (linkType == ResponseLinkType.dialogNode) { respWithoutChildren.Add(response); } if (linkType == ResponseLinkType.endAndChangeConversation) { respThatSwitchConv.Add(response); } } return(node); }
public DialogResponse(String response, String link, bool onlyAllowOnce, ResponseLinkType linkType, String switchConversation): this(response, link, onlyAllowOnce) { this.linkType = linkType; this.switchConversation = switchConversation; }
public DialogResponse(String response, String link, bool onlyAllowOnce, ResponseLinkType linkType, String switchConversation) : this(response, link, onlyAllowOnce) { this.linkType = linkType; this.switchConversation = switchConversation; }