public ConvoEntry TranslateToEntry(ConvoDatabase database) { List <string> keys = new List <string>(); List <List <string> > values = new List <List <string> >(); foreach (KeyValuePair <string, List <string> > item in database.dictionary) { keys.Add(item.Key); values.Add(item.Value); } return(new ConvoEntry(keys, values)); }
public void LoadConvos() { XmlSerializer serializer = new XmlSerializer(typeof(ConvoEntry)); //# if UNITY_EDITOR // FileStream stream = new FileStream(Application.dataPath + "/Resources/StreamingAssets/XML/Dialoge/" + scene + "_dialog_data.xml", FileMode.Open); // convoDB = TranslateToDatabase(serializer.Deserialize(stream) as ConvoEntry); // stream.Close(); //# else XmlDocument xmlDoc = new XmlDocument(); TextAsset textAsset = (TextAsset)Resources.Load("StreamingAssets/XML/Dialoge/" + scene + "_dialog_data"); xmlDoc.LoadXml(textAsset.text); XmlNodeList nodeList = xmlDoc.GetElementsByTagName("ConvoEntry"); convoDB = TranslateToDatabase(serializer.Deserialize(new XmlNodeReader(nodeList.Item(0))) as ConvoEntry); //# endif }