public Dictionary<int, Statement> LoadStatements(string nameIn) { //Get statment id in //string nameIn = "Smith"; //Debug.Log("SET STATE" + nameIn.ToString()); Statement statement; Dictionary<int,Statement> statements = new Dictionary<int, Statement>(); // Statement[] statement_array = new Statement[10]; int index = -1; bool found = false; xml = (TextAsset)Resources.Load(statement_xml); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xml.text); //Debug.Log("REACHED"); XmlNodeList statement_list = xmlDoc.GetElementsByTagName("Stage"); foreach(XmlNode dialog_fragment in statement_list){ XmlNodeList xnl = dialog_fragment.ChildNodes; statement = new Statement(); foreach(XmlNode xn in xnl ){ //ADD NPC ID TO DATABASE if(xn.Name == "Owner_Name" && xn.InnerText != nameIn.ToString()){ found = false; } if(xn.Name == "Owner_Name" && xn.InnerText == nameIn.ToString()){ found = true; index++; //Debug.Log("Response_id : " + xn.InnerText); statement.SetOwnerName(xn.InnerText); } if(xn.Name == "Statement_ID" && found){ // Debug.Log("Symbol: " + xn.InnerText); statement.SetStatementId(xn.InnerText); } if(xn.Name == "Text" && found){ //Debug.Log("TEXT: " + xn.InnerText); statement.SetText(xn.InnerText); } if(xn.Name == "AudioFile" && found){ // Debug.Log("Audio File: " + xn.InnerText); statement.SetAudioFile(xn.InnerText); } if(xn.Name == "Response_ID" && found){ //Debug.Log("Next Statement: " + xn.InnerText); statement.SetResponseId(xn.InnerText); } } //Add to response array if(found) //Before statement is saved to array, load responses statement.SetResponses(); //Debug.Log("DICT BROKE " + statement.GetResponseId().ToString()); if (statement.GetStatementId() != 0){ statements.Add(statement.GetStatementId(), statement);} //statement_array[index] = statement; } /*for(int i = 0; i < 4; i++){ Debug.Log("Array test: " + response_array[i].getText()); }*/ //Return array return statements; }