void Load(string _strFilePath) { XElement root = XDocument.Load(_strFilePath).Root; foreach (XElement element in root.Elements()) { EquipmentInfo tmp = new EquipmentInfo(); tmp.m_EquipmentInfo = new EquipmentInfomationData(); tmp.m_EquipmentInfo.m_strTitle = element.Attribute("name").Value; Debug.LogError(tmp.m_EquipmentInfo.m_strTitle); List <EquipmentInfomation> listEquipmentInfomation = new List <EquipmentInfomation>(); foreach (XElement i in element.Elements()) { EquipmentInfomation equipmentInfomation = new EquipmentInfomation( i.Attribute("patht").Value, int.Parse(i.Attribute("w").Value), int.Parse(i.Attribute("h").Value), i.Attribute("texture").Value, (i.Attribute("h_information") != null ? int.Parse(i.Attribute("h_information").Value) : 498)); listEquipmentInfomation.Add(equipmentInfomation); } tmp.m_EquipmentInfo.m_listEquipmentInfo = listEquipmentInfomation; tmp.SaveEquipment(); } Debug.Log("Load xml suc"); }