public ReadHeroSkinConfig(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("SkinCfg ").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; HeroSkinConfigInfo HeroSkininfo = new HeroSkinConfigInfo(); HeroSkininfo.GoodsId = Convert.ToInt32(typeName); string un8ConsumeType = ""; string n32Price = ""; foreach (XmlElement xEle in infoNodeList[i].ChildNodes) { #region 搜索 switch (xEle.Name) { case "SkinName": HeroSkininfo.SkinName = Convert.ToString(xEle.InnerText); break; case "un8ConsumeType": un8ConsumeType = Convert.ToString(xEle.InnerText); break; case "n32Price": n32Price = Convert.ToString(xEle.InnerText); break; case "Description": HeroSkininfo.Description = Convert.ToString(xEle.InnerText); break; case "Time": HeroSkininfo.Time = Convert.ToInt32(xEle.InnerText); break; case "Icon": HeroSkininfo.Icon = Convert.ToString(xEle.InnerText); break; case "ResourcesID": HeroSkininfo.ResourcesID = Convert.ToString(xEle.InnerText); break; case "Skill1Effect": HeroSkininfo.Skill1Effect = Convert.ToString(xEle.InnerText); break; case "Skill2Effect": HeroSkininfo.Skill2Effect = Convert.ToString(xEle.InnerText); break; } #endregion } HeroSkininfo.Consume = GameMethod.ResolveToIntDict(un8ConsumeType, n32Price); ConfigReader.heroSkinXmlInfoDict.Add(HeroSkininfo.GoodsId, HeroSkininfo); } }
public void UpdateMail(MailData mdb) { if (GoldList.Count != 0) { foreach (var item in GoldList) { UnityEngine.GameObject.DestroyImmediate(item); } curMailObj.mGrid.transform.parent.gameObject.SetActive(false); GoldList.Clear(); } if ((curMailObj != null) && (mdb != null) && (curtMailId == mdb.MailId)) { curMailObj.mMailSenderTxt.text = mdb.mailSender; curMailObj.mMailTitleTxt.text = mdb.mailTitle; curMailObj.mMailContentTxt.text = mdb.mailContent; curMailObj.mMailCreateTimeTxt.text = mdb.mailCreateTime; mTemp.gameObject.SetActive(true); string[] giftArray = mdb.mailGift.Split('|'); for (int i = 0; i < giftArray.Length; i++) { if (giftArray[i].Length == 0) { continue; } curMailObj.mGrid.transform.parent.gameObject.SetActive(true); ResourceItem objUnit = ResourcesManager.Instance.loadImmediate(GameConstDefine.LoadMailAttachGUI, ResourceType.PREFAB); GameObject obj = GameObject.Instantiate(objUnit.Asset) as GameObject; obj.transform.parent = curMailObj.mGrid.transform; obj.transform.localPosition = Vector3.zero; obj.transform.localScale = Vector3.one; GoldList.Add(obj); string[] giftStr = giftArray[i].Split(','); if (giftStr.Length == 3) { Int32 goodsId = Convert.ToInt32(giftStr[1]); MailGiftType giftType = (MailGiftType)Convert.ToInt32(giftStr[0]); switch (giftType) { case MailGiftType.eMerchType_Gold: { obj.GetComponent <UISprite>().spriteName = "9"; obj.transform.Find("Label").GetComponent <UILabel>().text = giftStr[2]; } break; case MailGiftType.eMerchType_Diamond: { obj.GetComponent <UISprite>().spriteName = "10"; obj.transform.Find("Label").GetComponent <UILabel>().text = giftStr[2]; } break; //HeroBuyCfg:100001-109999 // SkinCfg:110001-119999 // RuneCfg:120001-129999 default: { if (goodsId >= 100001 && goodsId <= 109999) { HeroBuyConfigInfo buyInfo = ConfigReader.GetHeroBuyInfo(goodsId); if (buyInfo != null) { ResourceItem GetMoneyUnit = ResourcesManager.Instance.loadImmediate(GameConstDefine.LoadDailyHeroIcon, ResourceType.PREFAB); UIAtlas uia_hero = (GetMoneyUnit.Asset as GameObject).GetComponent <UIAtlas>(); obj.GetComponent <UISprite>().atlas = uia_hero; obj.GetComponent <UISprite>().spriteName = buyInfo.DefaultIcon.ToString(); obj.transform.Find("Label").GetComponent <UILabel>().text = giftStr[2]; } } else if (goodsId >= 120001 && goodsId <= 129999) { RuneConfigInfo runeInfo = ConfigReader.GetRuneFromID((uint)goodsId); if (runeInfo != null) { obj.GetComponent <UISprite>().spriteName = runeInfo.Icon.ToString(); obj.transform.Find("Label").GetComponent <UILabel>().text = giftStr[2]; } } else if (goodsId >= 110001 && goodsId <= 119999) { HeroSkinConfigInfo skinInfo = ConfigReader.GetHeroSkinInfo(goodsId); if (skinInfo != null) { obj.GetComponent <UISprite>().spriteName = skinInfo.Icon.ToString(); obj.transform.Find("Label").GetComponent <UILabel>().text = giftStr[2]; } } else if (goodsId >= 130001 && goodsId <= 139999) { OtherItemConfigInfo otherInfo = ConfigReader.GetOtherItemInfo((uint)goodsId); if (otherInfo != null) { obj.GetComponent <UISprite>().spriteName = otherInfo.icon; obj.transform.Find("Label").GetComponent <UILabel>().text = giftStr[2]; } } } break; } } else { Debug.LogError("the error mail gift str:" + giftArray[i]); } } } UpdateLeftMailTitleList(); curMailObj.mGrid.repositionNow = true; curMailObj.mGrid.Reposition(); }