/// <summary> /// Gets the parent dialog for the given choice, or null if no parent is found /// </summary> /// <param name="choice">The choice to search for</param> /// <returns>The output that contains the choice, or null</returns> public DialogueOutput GetParentForChoice(DialogueChoice choice) { foreach (DialogueOutput dialog in Dialogs) { if (dialog.ChoicesIndices.Contains(choice.Id)) { return(dialog); } } return(null); }
/// <summary> /// Reads a Dialog Scene from an XML document /// </summary> /// <param name="node">The node that represents this scene</param> /// <param name="context">The Lua context to use for this scene</param> /// <returns>A dialog Scene as read from the document</returns> public static DialogueScene ReadFromXML(XmlNode node, LuaContext context) { DialogueScene scene = new DialogueScene(context); if (node.Attributes["name"] != null) { scene.m_name = node.Attributes["name"].Value; } if (node["selector"] != null) { scene.m_initDialogSelector = node["selector"].InnerText; } XmlNode dialogs = node["dialogues"]; foreach (XmlNode dialogNode in dialogs) { if (dialogNode.Name == "dialog") { scene.m_dialogs.Add(DialogueOutput.ReadFromXML(dialogNode)); } } XmlNode choices = node["choices"]; foreach (XmlNode choiceNode in choices) { if (choiceNode.Name == "choice") { scene.m_choices.Add(DialogueChoice.ReadFromXML(choiceNode)); } } return(scene); }
public void AddChoice(DialogueChoice dialogChoice) { m_choices.Add(dialogChoice.Id); }
public bool RemoveChoice(DialogueChoice dialogChoice) { return(m_choices.Remove(dialogChoice.Id)); }
/// <summary> /// Perform the actions for a given choice and move dialog to the next part /// </summary> /// <param name="dialogChoice">The choice to perform</param> public void SelectChoice(DialogueChoice dialogChoice) { dialogChoice.PerformCommands(m_luaContext); CurrentDialog = this[dialogChoice.NextId]; }
public bool DeleteChoice(DialogueChoice choice) { return(m_choices.Remove(choice)); }
public void AddChoice(DialogueChoice dialogChoice) { dialogChoice.Id = m_choices.Count(); m_choices.Add(dialogChoice); }