Esempio n. 1
0
    /// <summary>
    /// 显示时装属性描述
    /// </summary>
    /// <param name="artRes">资源表数据</param>
    private void ShowSkinDes(ArtresourceTemplate artRes)
    {
        int count = DataTemplate.GetInstance().GetArtResourceAtrriCount(artRes);

        if (count > 0)
        {
            for (int i = 0; i < count; i++)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append(artRes.getSymbol()[i]);

                if (artRes.getIspercentage()[i] == 1)
                {
                    float val = (float)(artRes.getAttriValue()[i]) / 10f;
                    sb.Append(val);
                    sb.Append("%");
                }
                else
                {
                    sb.Append(artRes.getAttriValue()[i]);
                }

                CreateAttriItem(artRes.getAttriDes()[i], sb.ToString());
            }
        }
    }
Esempio n. 2
0
    public void SetShowData(ShopTemplate shopT)
    {
        if (shopT == null)
        {
            LogManager.LogError("皮肤预览传入的ShopTemplate is null");
            return;
        }

        mOldImg.sprite = GameUtils.GetSpriteByResourceType(shopT.getCostType());
        mNewImg.sprite = GameUtils.GetSpriteByResourceType(shopT.getCostType());

        bool isDiscount = ShopModule.IsShopItemInDiscount(shopT);

        mCostOldObj.SetActive(isDiscount);
        mCostNewObj.SetActive(isDiscount);

        int buyTimes = ObjectSelf.GetInstance().GetShopBuyInfoByShopId(shopT.getId()).todaynum;

        if (isDiscount)
        {
            mOldTxt.text = DataTemplate.GetInstance().GetShopBuyCost(shopT, buyTimes, false).ToString();
            mNewTxt.text = DataTemplate.GetInstance().GetShopBuyCost(shopT, buyTimes, true).ToString();
        }
        else
        {
            //临时这么写;
            mCostNewObj.SetActive(true);
            mNewTxt.text = DataTemplate.GetInstance().GetShopBuyCost(shopT, buyTimes, false).ToString();
        }

        int artTableId           = GameUtils.StringToInt(shopT.getPreviewContent());
        ArtresourceTemplate artT = DataTemplate.GetInstance().GetArtResourceTemplate(artTableId);

        if (artT == null)
        {
            LogManager.LogError("ArtresourceTemplate is null id=" + artTableId);
            return;
        }

        iconImg.sprite = UIResourceMgr.LoadSprite(common.defaultPath + shopT.getResourceName());
        iconImg.SetNativeSize();

        HeroTemplate heroT = DataTemplate.GetInstance().GetHeroTemplateByArtresourceId(artTableId);

        if (heroT != null)
        {
            heroTitleTxt.text = GameUtils.getString(heroT.getTitleID());
            heroNameTxt.text  = GameUtils.getString(heroT.getNameID());
        }
        else
        {
            LogManager.LogError("英雄表中找不到对应皮肤id=" + artTableId + "的数据");
        }

        int count = DataTemplate.GetInstance().GetArtResourceAtrriCount(artT);

        if (count > 0)
        {
            for (int i = 0; i < count; i++)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append(artT.getSymbol()[i]);

                if (artT.getIspercentage()[i] == 1)
                {
                    float val = (float)(artT.getAttriValue()[i]) / 10f;
                    sb.Append(val);
                    sb.Append("%");
                }
                else
                {
                    sb.Append(artT.getAttriValue()[i]);
                }

                CreateAttriItem(GameUtils.getString(artT.getAttriDes()[i]), sb.ToString());
            }
        }

        nameTxt.text = GameUtils.getString(artT.getNameID());

        UpdateMoneyInfo();
    }