Exemple #1
0
    public static Dialog GetDialog(string id)
    {
        TextAsset   file = Resources.Load("Dialogs") as TextAsset;
        XmlDocument doc  = new XmlDocument();

        doc.LoadXml(file.text);

        try
        {
            XmlNodeList nodes   = doc.GetElementsByTagName("dialog");
            XmlNodeList curNode = GetNode(id, nodes).ChildNodes;
            Dialog      dialog  = new Dialog();

            for (int i = 0; i < curNode.Count; i++)
            {
                XmlNode frase = curNode[i];
                dialog.AddFrase(new Frase(frase.Attributes["person"].InnerText, frase.InnerText));
            }
            return(dialog);
        }
        catch
        {
            throw new System.Exception("There is an error in Dialogs while getting " + id);
        }
    }