public string GetPropertyValue(XmlParamItem item) { return(item.sValue); }
public void ReadXml(ref Dictionary <int, XmlDataList> dict) { #if UNITY_EDITOR if (File.Exists(m_XmlPathInEditor)) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc = new XmlDocument(); xmlDoc.Load(m_XmlPathInEditor); XmlElement root = xmlDoc.SelectSingleNode(sRoot) as XmlElement; if (root == null) { return; } foreach (XmlElement xml_data in root) { if (xml_data == null) { continue; } XmlDataList _data = new XmlDataList(); _data.iIndex = Convert.ToInt32(xml_data.GetAttribute(iIndex)); _data.sDescribe = xml_data.GetAttribute(sDes); foreach (XmlElement xml_class in xml_data) { XmlClassData _class = new XmlClassData(); _class.sLogicName = xml_class.LocalName; foreach (XmlElement xml_property in xml_class) { XmlParamItem _property = new XmlParamItem(); _property.sName = xml_property.LocalName; _property.sType = xml_property.GetAttribute("Type"); _property.sValue = xml_property.InnerText; _class.Add(_property); } _data.Add(_class); } if (dict.ContainsKey(_data.iIndex)) { dict.Remove(_data.iIndex); } dict.Add(_data.iIndex, _data); } } #else string strFileCon = ResourcesProxy.LoadTextString(m_XmlFilePath); if (string.IsNullOrEmpty(strFileCon)) { return; } XmlDocument xmlDoc = new XmlDocument(); xmlDoc = new XmlDocument(); try { byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strFileCon); MemoryStream ms = new MemoryStream(buffer); xmlDoc.Load(ms); } catch (XmlException e) { Log.Debug("LoadDefine error!"); Log.Debug("line : " + e.LineNumber + " pos : " + e.LinePosition); Log.Debug("reason : " + e.Message); } XmlElement root = xmlDoc.SelectSingleNode(sRoot) as XmlElement; if (root == null) { return; } foreach (XmlElement xml_data in root) { if (xml_data == null) { continue; } XmlDataList _data = new XmlDataList(); _data.iIndex = Convert.ToInt32(xml_data.GetAttribute(iIndex)); _data.sDescribe = xml_data.GetAttribute(sDes); foreach (XmlElement xml_class in xml_data) { XmlClassData _class = new XmlClassData(); _class.sLogicName = xml_class.LocalName; foreach (XmlElement xml_property in xml_class) { XmlParamItem _property = new XmlParamItem(); _property.sName = xml_property.LocalName; _property.sType = xml_property.GetAttribute("Type"); _property.sValue = xml_property.InnerText; _class.Add(_property); } _data.Add(_class); } if (dict.ContainsKey(_data.iIndex)) { dict.Remove(_data.iIndex); } dict.Add(_data.iIndex, _data); } #endif }