public ReadGuideHelpConfig(string xmlFilePath) { TextAsset xmlfile = Resources.Load(xmlFilePath) as TextAsset; if (!xmlfile) { Debug.LogError(" error infos: 没有找到指定的xml文件:" + xmlFilePath); } xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xmlfile.text); XmlNodeList infoNodeList = xmlDoc.SelectSingleNode("HelpTips").ChildNodes; for (int i = 0; i < infoNodeList.Count; i++)//(XmlNode xNode in infoNodeList) { if ((infoNodeList[i] as XmlElement).GetAttributeNode("id") == null) { continue; } string typeName = (infoNodeList[i] as XmlElement).GetAttributeNode("id").InnerText; GuideHelpData helpInfo = new GuideHelpData(); helpInfo.helpId = Convert.ToInt32(typeName); foreach (XmlElement xEle in infoNodeList[i].ChildNodes) { #region 搜索 switch (xEle.Name) { case "tiptimes": helpInfo.helpTimes = Convert.ToInt32(xEle.InnerText); break; case "tipmatches": helpInfo.helpMatches = Convert.ToInt32(xEle.InnerText); break; case "tippath": helpInfo.helpObjPathList = GameMethod.ResolveToStrList(Convert.ToString(xEle.InnerText), ';'); break; case "tipevent": helpInfo.helpTriggerEvent = Convert.ToInt32(xEle.InnerText); break; case "tipShowTimes": helpInfo.helpShowTime = float.Parse(xEle.InnerText); break; } #endregion } ConfigReader.guideHelpXmlInfoDict.Add(helpInfo.helpId, helpInfo); } }
public void SetJungleMonsterBeAtkVoice() { int id = (int)ObjTypeID; NpcConfigInfo info = ConfigReader.GetNpcInfo(id); if (entityType != EntityType.Monster || Hp < hpLimit || AudioManager.Instance.HeroLinesAudioDict.ContainsKey(GameObjGUID)) { return; } List <float> ifPlaySoundList = new List <float>(); for (int i = 0; i < ifPlayMonsterSound.Length; i++) { ifPlaySoundList.Add(ifPlayMonsterSound[i]); } int indexPlay = GameMethod.RandProbablityIndex(ifPlaySoundList);//获得是否播放下标 if (indexPlay == 1) { return; } if (HasSameTypeNpcPlaySoundIsPlaying()) { return; } if (info.n32Script1Rate == null) { return; } List <float> probabilityList = GameMethod.ResolveToFloatList(info.n32Script1Rate);//获得概率集合 for (int i = 0; i < probabilityList.Count; i++) { probabilityList[i] = (float)(probabilityList[i] - 90000) / 100f; } int index = GameMethod.RandProbablityIndex(probabilityList); //获得概率下标 List <string> voiceList = GameMethod.ResolveToStrList(info.un32Script1); string name = voiceList[index]; //获得概率下标对应的声音 string path = AudioDefine.PATH_JUNGLE_MONSTER_BE_ATK_SOUND + name; //AudioClip clip = Resources.Load(path) as AudioClip; ResourceItem clipUnit = ResourcesManager.Instance.loadImmediate(path, ResourceType.ASSET); AudioClip clip = clipUnit.Asset as AudioClip; AudioManager.Instance.PlayHeroLinesAudio(GameObjGUID, clip); }
public ReadHeroBuyConfig(string xmlFilePath) { //TextAsset xmlfile = Resources.Load(xmlFilePath) as TextAsset; ResourceItem 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("HeroBuyCfg ").ChildNodes; for (int i = 0; i < infoNodeList.Count; i++) //XmlNode xNode in infoNodeList) { if ((infoNodeList[i] as XmlElement).GetAttributeNode("un32ID") == null) { continue; } string typeName = (infoNodeList[i] as XmlElement).GetAttributeNode("un32ID").InnerText; HeroBuyConfigInfo HeroBuyInfo = new HeroBuyConfigInfo(); HeroBuyInfo.GoodsId = Convert.ToInt32(typeName); string un8ConsumeType = ""; string n32Price = ""; foreach (XmlElement xEle in infoNodeList[i].ChildNodes) { #region 搜索 switch (xEle.Name) { case "Name": HeroBuyInfo.Name = Convert.ToString(xEle.InnerText); break; case "HeroKind": HeroBuyInfo.HeroKind = GameMethod.ResolveToIntList(xEle.InnerText); break; case "un8ConsumeType": un8ConsumeType = Convert.ToString(xEle.InnerText); break; case "n32Price": n32Price = Convert.ToString(xEle.InnerText); break; case "UnlockHeroID": HeroBuyInfo.UnlockHeroID = Convert.ToInt32(xEle.InnerText); break; case "Time": HeroBuyInfo.Time = Convert.ToInt32(xEle.InnerText); break; case "DefaultSkin": HeroBuyInfo.DefaultSkin = Convert.ToInt32(xEle.InnerText); break; case "DefaultIcon": HeroBuyInfo.DefaultIcon = Convert.ToString(xEle.InnerText); break; case "OnSaleSkins": HeroBuyInfo.OnSaleSkins = GameMethod.ResolveToStrList(xEle.InnerText); break; case "bIsShowInShop": HeroBuyInfo.IsShowShop = Convert.ToBoolean(Convert.ToInt32(xEle.InnerText)); break; case "bIsShowInHeroInfo": HeroBuyInfo.bIsShowInHeroInfo = Convert.ToBoolean(Convert.ToInt32(xEle.InnerText)); break; } #endregion } HeroBuyInfo.Consume = GameMethod.ResolveToIntDict(un8ConsumeType, n32Price); ConfigReader.heroBuyXmlInfoDict.Add(HeroBuyInfo.GoodsId, HeroBuyInfo); } }
public ReadIGuideTaskConfig(string xmlFilePath) { //TextAsset xmlfile = Resources.Load(xmlFilePath) as TextAsset; ResourceItem 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("UiTaskEvent").ChildNodes; for (int i = 0; i < infoNodeList.Count; i++)//(XmlNode xNode in infoNodeList) { if ((infoNodeList[i] as XmlElement).GetAttributeNode("id") == null) { continue; } string typeName = (infoNodeList[i] as XmlElement).GetAttributeNode("id").InnerText; IGuideData taskInfo = new IGuideData(); taskInfo.TaskId = Convert.ToInt32(typeName); foreach (XmlElement xEle in infoNodeList[i].ChildNodes) { #region 搜索 switch (xEle.Name) { case "startEvent": taskInfo.StartTaskEvent = Convert.ToInt32(xEle.InnerText); break; case "endEvent": taskInfo.EndTaskEvent = Convert.ToInt32(xEle.InnerText); break; case "textpath": taskInfo.TextPath = Convert.ToString(xEle.InnerText); break; case "textpos": taskInfo.TextPos = GameMethod.ResolveToVector3(Convert.ToString(xEle.InnerText), ';'); break; case "content": taskInfo.TextContent = GameMethod.ResolveToStrList(Convert.ToString(xEle.InnerText), ';'); break; case "shakepath": taskInfo.ShakePath = Convert.ToString(xEle.InnerText); break; case "shakepos": taskInfo.ShakePos = GameMethod.ResolveToVector3(Convert.ToString(xEle.InnerText), ';'); break; case "flashpath": taskInfo.FlashPath = Convert.ToString(xEle.InnerText); break; case "flashpos": taskInfo.FlashPos = GameMethod.ResolveToVector3(Convert.ToString(xEle.InnerText), ';'); break; case "destpos": taskInfo.FlashDstPos = GameMethod.ResolveToVector3(Convert.ToString(xEle.InnerText), ';'); break; case "isshield": taskInfo.IsMask = (Convert.ToInt32(xEle.InnerText) == 1) ? true : false; break; } #endregion } ConfigReader.iGuideDatalXmlInfoDict.Add(taskInfo.TaskId, taskInfo); } }