public AddPCPhrase(ref DialogResponse pcResponse) { InitializeComponent(); this.pcResponse = pcResponse; this.CancelButton = cancelButton; setupForm(); }
private static DialogNode loadNode(XmlElement xmlEl, ref Conversation conversation) { string id = xmlEl.GetAttribute("id"); string npcPhrase = xmlEl.GetAttribute("npcPhrase"); string voiceFile = xmlEl.GetAttribute("voiceFile"); DialogNode node = new DialogNode(id, npcPhrase, voiceFile); 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); response.childNode = dn; conversation.addDialogNode(dn); } } return node; }
private void addPCPhraseMiClicked(Object sender, EventArgs e) { if (!(treeListView.SelectedObject != null && treeListView.SelectedObject is DialogNode)) { showError("Please select some NPC phrase.", "Error"); return; } DialogNode selectedNode = (DialogNode)treeListView.SelectedObject; DialogResponse pcResponse = new DialogResponse("", "", false); Form addPCPhraseForm = new AddPCPhrase(ref pcResponse); addPCPhraseForm.ShowDialog(this); if (pcResponse.response.Equals("")) return; selectedNode.addResponse(pcResponse); treeListView.RefreshObject(selectedNode); treeListView.Expand(selectedNode); if (!changesMade) this.Text = this.Text + "*"; changesMade = true; }
public void removeResponse(DialogResponse dialogResponse) { responses.Remove(dialogResponse); }
public void addResponse(DialogResponse dialogResponse) { responses.Add(dialogResponse); }