Beispiel #1
0
    public void SetShowData(ShopTemplate shopT)
    {
        if (shopT == null)
        {
            LogManager.LogError("YueKaPreview ShopTemplate is null");
            return;
        }

        nameTxt.text  = GameUtils.getString(shopT.getCommodityName());
        iconBg.sprite = UIResourceMgr.LoadSprite(common.defaultPath + shopT.getBaseicon());
        iconBg.SetNativeSize();
        iconImg.sprite = UIResourceMgr.LoadSprite(common.defaultPath + shopT.getResourceName());
        string content = shopT.getPreviewContent();

        if (string.IsNullOrEmpty(content))
        {
            LogManager.LogError("ShopTemplate表格预览内容描述填写错误!id=" + shopT.getId());
            return;
        }

        string[] detailTxt = GameUtils.getString(content).Split(new string[] { "#" }, StringSplitOptions.None);
        if (detailTxt == null || detailTxt.Length == 0)
        {
            LogManager.LogError("ShopTemplate表格预览内容描述解析数据为空!id=" + shopT.getId());
            return;
        }

        for (int i = 0, j = detailTxt.Length; i < j; i++)
        {
            CreateDetail(detailTxt[i]);
        }
    }
Beispiel #2
0
    /// <summary>
    /// 商城道具图标点击处理函数;
    /// </summary>
    /// <param name="shopT"></param>
    /// <returns></returns>
    public static bool OnShopItemIconClickHandler(ShopTemplate shopT)
    {
        if (shopT == null)
        {
            LogManager.LogError("ShopTemplate is NULL");
            return(false);
        }

        switch (shopT.getPreviewType())
        {
        case -1:
            break;

        case 1:
            int tableId = GameUtils.StringToInt(shopT.getPreviewContent());

            return(ShowItemPreviewUIHandler(tableId));

        case 2:
            ShowGroupItemPreviewUI(shopT);
            break;

        case 3:
            ShowYUEKAPreviewUI(shopT);
            break;

        default:
            LogManager.LogError("没有处理的商品点击预览类型");
            return(false);
        }

        return(true);
    }
Beispiel #3
0
    public void SetShowData(ShopTemplate shopT)
    {
        string[] details = shopT.getPreviewContent().Split(new string[] { "#" }, StringSplitOptions.None);

        if (details == null || details.Length == 0)
        {
            LogManager.LogError("打包展示物品内容解析错误,shopid=" + shopT.getId());
            return;
        }

        for (int i = 0, j = details.Length; i < j; i++)
        {
            string[] cont = details[i].Split(new string[] { "-" }, StringSplitOptions.None);
            if (cont == null || cont.Length != 4)
            {
                LogManager.LogError("打包展示物品内容解析错误,shopid=" + shopT.getId());
            }

            try
            {
                switch (int.Parse(cont[0]))
                {
                case 1:
                    CreateItem(int.Parse(cont[1]), cont[2], cont[3]);
                    break;

                case 2:
                    CreateItem(cont[1], cont[2], cont[3]);
                    break;
                }
            }
            catch (Exception e)
            {
                LogManager.LogError(e.ToString());
            }
        }
    }
Beispiel #4
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();
    }