private void DeserializeAllFiles()
 {
     for (int i = 0; i < _xmlFiles.Count; i++)
     {
         if (!_ndDictionary.ContainsKey(_xmlFiles[i].name))
         {
             _ndDictionary.Add(_xmlFiles[i].name, NodeDeserializer.Load(_xmlFiles[i]));
         }
     }
 }
Beispiel #2
0
        //Function to load the file and deserialize the xml file
        public static NodeDeserializer Load(TextAsset xmlFile)
        {
            TextAsset xml = xmlFile;

            if (xml == null)
            {
                Debug.LogError("No XML file found!");
            }

            //create XmlSerializer
            XmlSerializer serializer = new XmlSerializer(typeof(NodeDeserializer));

            //create StringReader
            StringReader reader = new StringReader(xml.text);

            //store and deserialize dialogues into a dialogues
            NodeDeserializer dialogues = serializer.Deserialize(reader) as NodeDeserializer;

            //close reader
            reader.Close();

            //return messages
            return(dialogues);
        }