public ReadOtherItemConfig(string xmlFilePath) { 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("OtherItemCfg ").ChildNodes; for (int i = 0; i < infoNodeList.Count; i++) { XmlAttribute xmlAttr = (infoNodeList[i] as XmlElement).GetAttributeNode("ID"); if (xmlAttr == null) { continue; } OtherItemConfigInfo otherItemInfo = new OtherItemConfigInfo(); foreach (XmlElement xEle in infoNodeList[i].ChildNodes) { switch (xEle.Name) { case "Name": otherItemInfo.sName = xEle.InnerText; break; case "EffectID": otherItemInfo.effectid = Convert.ToUInt32(xEle.InnerText); break; case "EffectValue": otherItemInfo.effectvalue = Convert.ToUInt32(xEle.InnerText); break; case "ConsumeType": otherItemInfo.consumetype = Convert.ToUInt32(xEle.InnerText); break; case "PriceSeries": otherItemInfo.priceseries = Convert.ToUInt32(xEle.InnerText); break; case "bIsShowInShop": otherItemInfo.isShowInShop = Convert.ToUInt32(xEle.InnerText) == 1?true:false; break; case "Time": otherItemInfo.time = Convert.ToInt32(xEle.InnerText); break; case "Icon": otherItemInfo.icon = xEle.InnerText; break; } } ConfigReader.otherItemXmlInfoDic.Add(Convert.ToUInt32(xmlAttr.InnerText), otherItemInfo); } }
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(); }