public ReadMsgSettingConfig(string xmlFilePath) { //TextAsset xmlfile = Resources.Load(xmlFilePath) as TextAsset; ResourceUnit xmlfileUnit = ResourcesManager.Instance.loadImmediate(xmlFilePath, ResourceType.ASSET); TextAsset xmlfile = xmlfileUnit.Asset as TextAsset; if (!xmlfile) { //Debug.LogError(" error infos: 没有找到指定的xml文件:" + xmlFilePath); } xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xmlfile.text); XmlNodeList infoNodeList = xmlDoc.SelectSingleNode("MsgSettingConfig ").ChildNodes; for (int i = 0; i < infoNodeList.Count; i++) { if ((infoNodeList[i] as XmlElement).GetAttributeNode("id") == null) { continue; } string typeName = (infoNodeList[i] as XmlElement).GetAttributeNode("id").InnerText; //Debug.LogError(typeName); MsgSettingConfigInfo msgSettingInfo = new MsgSettingConfigInfo(); msgSettingInfo.id = Convert.ToInt32(typeName); #region 搜索 foreach (XmlElement xEle in infoNodeList[i].ChildNodes) { switch (xEle.Name) { case "color": { msgSettingInfo.color = GameMethod.ResolveToColor(xEle.InnerText); } break; case "font_size": { msgSettingInfo.font_size = Convert.ToInt32(xEle.InnerText); } break; case "effect": { msgSettingInfo.font_effect = Convert.ToInt32(xEle.InnerText); } break; case "effect_color": { msgSettingInfo.fontEffect_color = GameMethod.ResolveToColor(xEle.InnerText); } break; case "effect_distance": { msgSettingInfo.fontEffect_distance = GameMethod.ResolveToVector2(xEle.InnerText); } break; case "position_start_in": { msgSettingInfo.position_start_in = GameMethod.ResolveToVector3(xEle.InnerText); } break; case "position_end_in": { msgSettingInfo.position_end_in = GameMethod.ResolveToVector3(xEle.InnerText); } break; case "position_time_in": msgSettingInfo.position_time_in = float.Parse(xEle.InnerText, System.Globalization.CultureInfo.InvariantCulture.NumberFormat); break; case "position_start_out": { msgSettingInfo.position_start_out = GameMethod.ResolveToVector3(xEle.InnerText); } break; case "position_end_out": { msgSettingInfo.position_end_out = GameMethod.ResolveToVector3(xEle.InnerText); } break; case "position_time_out": msgSettingInfo.position_time_out = float.Parse(xEle.InnerText, System.Globalization.CultureInfo.InvariantCulture.NumberFormat); break; case "rotation_start_in": { msgSettingInfo.rotation_start_in = GameMethod.ResolveToVector3(xEle.InnerText); } break; case "rotation_end_in": { msgSettingInfo.rotation_end_in = GameMethod.ResolveToVector3(xEle.InnerText); } break; case "rotation_time_in": msgSettingInfo.rotation_time_in = float.Parse(xEle.InnerText); break; case "rotation_start_out": { msgSettingInfo.rotation_start_out = GameMethod.ResolveToVector3(xEle.InnerText); } break; case "rotation_end_out": { msgSettingInfo.rotation_end_out = GameMethod.ResolveToVector3(xEle.InnerText); } break; case "rotation_time_out": msgSettingInfo.rotation_time_out = float.Parse(xEle.InnerText); break; case "scale_start_in": { msgSettingInfo.scale_start_in = GameMethod.ResolveToVector3(xEle.InnerText); } break; case "scale_end_in": { msgSettingInfo.scale_end_in = GameMethod.ResolveToVector3(xEle.InnerText); } break; case "scale_time_in": msgSettingInfo.scale_time_in = float.Parse(xEle.InnerText, System.Globalization.CultureInfo.InvariantCulture.NumberFormat); break; case "scale_start_out": { msgSettingInfo.scale_start_out = GameMethod.ResolveToVector3(xEle.InnerText); } break; case "scale_end_out": { msgSettingInfo.scale_end_out = GameMethod.ResolveToVector3(xEle.InnerText); } break; case "scale_time_out": msgSettingInfo.scale_time_out = float.Parse(xEle.InnerText, System.Globalization.CultureInfo.InvariantCulture.NumberFormat); break; case "alpha_start_in": { msgSettingInfo.alpha_start_in = float.Parse(xEle.InnerText, System.Globalization.CultureInfo.InvariantCulture.NumberFormat); } break; case "alpha_end_in": { msgSettingInfo.alpha_end_in = float.Parse(xEle.InnerText, System.Globalization.CultureInfo.InvariantCulture.NumberFormat); } break; case "alpha_time_in": msgSettingInfo.alpha_time_in = float.Parse(xEle.InnerText, System.Globalization.CultureInfo.InvariantCulture.NumberFormat); break; case "alpha_start_out": { msgSettingInfo.alpha_start_out = float.Parse(xEle.InnerText, System.Globalization.CultureInfo.InvariantCulture.NumberFormat); } break; case "alpha_end_out": { msgSettingInfo.alpha_end_out = float.Parse(xEle.InnerText, System.Globalization.CultureInfo.InvariantCulture.NumberFormat); } break; case "alpha_time_out": msgSettingInfo.alpha_time_out = float.Parse(xEle.InnerText, System.Globalization.CultureInfo.InvariantCulture.NumberFormat); break; case "if_frame": msgSettingInfo.if_frame = Convert.ToInt32(xEle.InnerText); break; case "staytime": msgSettingInfo.stayTime = Convert.ToInt32(xEle.InnerText); break; } } #endregion ConfigReader.msgSettingXmlInfoDic.Add(msgSettingInfo.id, msgSettingInfo); } }