Example #1
0
        int GetGoodsId(int goodsId)
        {
            HeroBuyConfigInfo buyInfo = ConfigReader.GetHeroBuyInfo(goodsId);

            if (buyInfo == null)
            {
                return(0);
            }
            foreach (var item in ConfigReader.HeroBuyXmlInfoDict.Values)
            {
                if (item.Time == -1)
                {
                    if (item.UnlockHeroID == buyInfo.UnlockHeroID)
                    {
                        return(item.GoodsId);
                    }
                }
            }
            return(0);
        }
Example #2
0
            /// <summary>
            /// 刷新卡片上显示的价格
            /// </summary>
            ///
            public void ReFreshTimeCardTag()
            {
                HeroBuyConfigInfo conInfo = ConfigReader.GetHeroBuyInfo(this.mGoodsIdChild);

                if (conInfo == null)
                {
                    return;
                }
                mGold_DisCount.SetActive(false);
                mDiamond_DisCount.SetActive(false);
                if (IsOwn.gameObject.activeSelf)
                {
                    mGold_Common.SetActive(false);
                    mDiamond_Common.SetActive(false);
                    return;
                }
                if (conInfo.Consume != null && conInfo.Consume.Count > 1)
                {
                    mGold_Common.transform.Find("LabelMoney1").GetComponent <UILabel>().text    = conInfo.Consume.ElementAt(0).Value.ToString();
                    mDiamond_Common.transform.Find("LabelMoney1").GetComponent <UILabel>().text = conInfo.Consume.ElementAt(1).Value.ToString();
                    mGold_Common.SetActive(true);
                    mDiamond_Common.SetActive(true);
                }
            }
Example #3
0
        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();
        }
        void ShowVipPre()
        {
            int vipLevel = PresonInfoCtrl.Instance.mVipLevel;

            foreach (var item in ConfigReader.ViplevelXmlInfoDict.Values)
            {
                string            temp       = null;
                string[]          value      = null;
                MsgConfigInfo     info       = null;
                HeroBuyConfigInfo heroinfo   = null;
                RuneConfigInfo    runeinfo   = null;
                int          runeLevel       = 0;
                int          j               = 0;
                ResourceUnit objHomeBaseUnit = ResourcesManager.Instance.loadImmediate(GameConstDefine.LoadVIPInfoUI, ResourceType.PREFAB);
                GameObject   obj             = GameObject.Instantiate(objHomeBaseUnit.Asset) as GameObject;
                obj.transform.parent        = mGrid.transform;
                obj.transform.localPosition = Vector3.zero;
                obj.transform.localScale    = Vector3.one;
                obj.name = (j++).ToString();
                value    = item.VipHero.Split(':');

                UILabel uil      = obj.transform.FindChild("InfoLabel").GetComponent <UILabel>();
                UILabel viplevel = obj.transform.FindChild("NameLabel").GetComponent <UILabel>();
                viplevel.text = "VIP " + item.VipUserLevel.ToString();
                info          = ConfigReader.msgXmlInfoDic[20001];
                for (int i = 0; i < value.Length; i++)
                {
                    if (i % 2 == 0)
                    {
                        //英雄ID  20001
                        int index = Convert.ToInt32(value[i]);
                        if (index == 0)
                        {
                            break;
                        }
                        heroinfo = ConfigReader.GetHeroBuyInfo(Convert.ToInt32(value[i]));
                        if (heroinfo == null)
                        {
                            Debug.LogError("herocfg not find id");
                            return;
                        }
                    }
                    else
                    {
                        //英雄时限
                    }
                }//temp 暂时当Label用
                if (heroinfo != null)
                {
                    temp = string.Format(info.content, heroinfo.Name);
                }
                value = item.VipRune.Split(':');
                info  = ConfigReader.msgXmlInfoDic[20002];
                for (int i = 0; i < value.Length; i++)
                {
                    if (i % 2 == 0)
                    {
                        //符文ID
                        int index = Convert.ToInt32(value[i]);
                        if (index == 0)
                        {
                            break;
                        }
                        runeinfo = ConfigReader.GetRuneFromID((uint)index);
                        if (runeinfo == null)
                        {
                            Debug.LogError("runecfg not find id");
                            return;
                        }
                    }
                    else
                    {
                        //符文等级
                        runeLevel = Convert.ToInt32(value[i]);
                    }
                }
                if (runeLevel != 0)
                {
                    temp += (string.Format(info.content, runeinfo.RuneName, runeLevel));
                }

                temp = GetTemp(temp, item.VipPrivilege1, 21001);
                temp = GetTemp(temp, item.VipPrivilege2, 21002);
                temp = GetTemp(temp, item.VipPrivilege3, 21003);
                temp = GetFloatTemp(temp, item.VipPrivilege4, 21004);

                temp = GetTemp(temp, item.VipPrivilege5, 21005);
                temp = GetFloatTemp(temp, item.VipPrivilege6, 21006);
                temp = GetFloatTemp(temp, item.VipPrivilege7, 21007);
                temp = GetTemp(temp, item.VipPrivilege8, 21008);

                temp     = GetTemp(temp, item.VipPrivilege9, 21009);
                temp     = GetTemp(temp, item.VipPrivilege10, 21010);
                uil.text = temp;
            }
        }
Example #5
0
    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);
        }
    }