Exemple #1
0
 /// <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);
 }
Exemple #2
0
        /// <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);
        }
Exemple #3
0
 public void AddChoice(DialogueChoice dialogChoice)
 {
     m_choices.Add(dialogChoice.Id);
 }
Exemple #4
0
 public bool RemoveChoice(DialogueChoice dialogChoice)
 {
     return(m_choices.Remove(dialogChoice.Id));
 }
Exemple #5
0
 /// <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];
 }
Exemple #6
0
 public bool DeleteChoice(DialogueChoice choice)
 {
     return(m_choices.Remove(choice));
 }
Exemple #7
0
 public void AddChoice(DialogueChoice dialogChoice)
 {
     dialogChoice.Id = m_choices.Count();
     m_choices.Add(dialogChoice);
 }