Beispiel #1
0
 /// <summary>
 /// 确认购买
 /// </summary>
 public void ClickConfirmBuy()
 {
     Goods_obj.SetActive(false);
     for (int i = 0; i < goodsList.Count; i++)
     {
         if (curGoodsId == goodsList[i].goodsUIId)
         {
             if (goodsList[i].Currency == 1)
             {
                 if (Role.Instance.Cash < int.Parse(goodsList[i].price_txt.text))
                 {
                     CanvasView.Instance.AddNotice("铜钱不足!");
                     //currencytips_obj.SetActive(true);
                     //currencytip_txt.text = "铜钱不足!";
                     //curcg.alpha = 1;
                     //CurrencyTip();
                     return;
                 }
             }
             else if (goodsList[i].Currency == 2)
             {
                 if (Role.Instance.Gold < int.Parse(goodsList[i].price_txt.text))
                 {
                     CanvasView.Instance.AddNotice("金锭不足,无法购买!");
                     //currencytips_obj.SetActive(true);
                     //currencytip_txt.text = "金锭不足,无法购买!";
                     //curcg.alpha = 1;
                     //CurrencyTip();
                     return;
                 }
             }
             goodsList[i].SoldOut_btn.gameObject.SetActive(true);
             ShopMgr.Instance.goodsList[(int)ShopMgr.Instance.shoptype][i].num = 0;
             if (goodsList[i].Currency == 1)
             {
                 Role.Instance.Cash -= int.Parse(goodsList[i].price_txt.text);
             }
             else if (goodsList[i].Currency == 2)
             {
                 Role.Instance.Gold -= int.Parse(goodsList[i].price_txt.text);
             }
             int num = 0;
             if (goodsList[i].goodsnum_txt.text.Length == 0)
             {
                 num = 1;
             }
             else
             {
                 num = int.Parse(goodsList[i].goodsnum_txt.text);
             }
             Debug.Log(Role.Instance.Gold);
         }
     }
 }
Beispiel #2
0
 /// <summary>
 /// 确认购买货物
 /// </summary>
 public void ComfirmBuy()
 {
     Goods_obj.SetActive(false);
     for (int i = 0; i < goodsList.Count; i++)
     {
         if (curGoodsId == goodsList[i].goodsUIId)
         {
             goodsList[i].SoldOut_btn.gameObject.SetActive(true);
             //ShopMgr.Instance.goodsList[(int)ShopType.westernRegionsShop][i].saled = false;
         }
     }
 }
Beispiel #3
0
    /// <summary>
    /// 点击货物,对货物弹框赋值
    /// </summary>
    /// <param name="goods"></param>
    public void ClickGoods(GoodsUIView goods)
    {
        Goods_obj.SetActive(true);
        GoodsUIView goodsUI = null;

        for (int i = 0; i < goodsList.Count; i++)
        {
            if (goods.goodsUIId == goodsList[i].goodsUIId)
            {
                goodsUI = goodsList[i];
            }
        }
        curGoodsId            = goodsUI.goodsUIId;
        goodslevel_img.sprite = goodsUI.GoodsLevel_img.sprite;
        goods_img.sprite      = goodsUI.Goods_img.sprite;
        goodsname_txt.text    = goodsUI.GoodsName_txt.text;
        if (ItemMgr.Instance.GetItemNum(goods.goodsUIId) == 0)
        {
            goodsnum_txt.color = Color.red;
        }
        else
        {
            goodsnum_txt.color = Color.yellow;
        }
        goodsnum_txt.text = ItemMgr.Instance.GetItemNum(goods.goodsUIId).ToString();
        buyprice_txt.text = goodsUI.price_txt.text;
        if (goodsUI.goodsnum_txt.text == "")
        {
            buynum_txt.text = "1";
        }
        else
        {
            buynum_txt.text = goodsUI.goodsnum_txt.text;
        }
        buynumicon_img.sprite  = goodsUI.copper_img.sprite;
        goodsproperty_txt.text = JsonMgr.GetSingleton().GetItemConfigByID(goods.goodsUIId).propertydes;
        goodsuse_txt.text      = JsonMgr.GetSingleton().GetItemConfigByID(goods.goodsUIId).usedes;
    }
Beispiel #4
0
 /// <summary>
 /// 关闭货物弹框
 /// </summary>
 public void CloseGoodsPop()
 {
     Goods_obj.SetActive(false);
 }
Beispiel #5
0
    /// <summary>
    /// 点击货物,对货物弹框赋值
    /// </summary>
    /// <param name="goods"></param>
    public void ClickGoods(GoodsUIView goods)
    {
        curtime = 0;
        if (curcg == null)
        {
            curcg = curtipbg_img.GetComponent <CanvasGroup>();
        }
        GoodsUIView goodsUI = null;

        for (int i = 0; i < goodsList.Count; i++)
        {
            if (goods.goodsUIId == goodsList[i].goodsUIId)
            {
                goodsUI = goodsList[i];
                //if (goodsList[i].Currency == 1)
                //{
                //    if (Role.Instance.Cash < int.Parse(goodsList[i].price_txt.text))
                //    {
                //        currencytips_obj.SetActive(true);
                //        currencytip_txt.text = "铜钱不足!";
                //        curcg.alpha = 1;
                //        CurrencyTip();
                //        return;
                //    }
                //}
                //else if (goodsList[i].Currency == 2)
                //{
                //    if (Role.Instance.Gold < int.Parse(goodsList[i].price_txt.text))
                //    {
                //        currencytips_obj.SetActive(true);
                //        currencytip_txt.text = "金锭不足,无法购买!";
                //        curcg.alpha = 1;
                //        CurrencyTip();
                //        return;
                //    }
                //}
            }
        }
        curGoodsId            = goodsUI.goodsUIId;
        goodslevel_img.sprite = goodsUI.GoodsLevel_img.sprite;
        goods_img.sprite      = goodsUI.Goods_img.sprite;
        int s = ShopMgr.Instance.GetItemIDByUIID((int)ShopMgr.Instance.shoptype, goodsUI.goodsUIId);

        if (s == -1)
        {
            return;
        }
        else
        {
            goodsnum_txt.text = ItemMgr.Instance.GetItemNum(s).ToString();
        }
        int textcolor = JsonMgr.GetSingleton().GetItemConfigByID(ShopMgr.Instance.GetItemIDByUIID((int)ShopMgr.Instance.shoptype, goodsUI.goodsUIId)).rare;

        switch (textcolor)
        {
        case (int)RareType.RareWhite:
            goodsname_txt.text = "<color=#FFFFFF>" + goodsUI.GoodsName_txt.text + "</color>";
            break;

        case (int)RareType.RareGreen:
            goodsname_txt.text = "<color=#00FF00>" + goodsUI.GoodsName_txt.text + "</color>";
            break;

        case (int)RareType.RareBlue:
            goodsname_txt.text = "<color=#00FFFF>" + goodsUI.GoodsName_txt.text + "</color>";
            break;

        case (int)RareType.RarePurple:
            goodsname_txt.text = "<color=#FF00FF>" + goodsUI.GoodsName_txt.text + "</color>";
            break;

        case (int)RareType.RareOrange:
            goodsname_txt.text = "<color=#FFFF00>" + goodsUI.GoodsName_txt.text + "</color>";
            break;

        default:
            goodsname_txt.text = "<color=#FF0000>" + goodsUI.GoodsName_txt.text + "</color>";
            break;
        }
        if (ItemMgr.Instance.GetItemNum(ShopMgr.Instance.GetItemIDByUIID((int)ShopMgr.Instance.shoptype, goodsUI.goodsUIId)) == 0)
        {
            goodsnum_txt.color = Color.red;
        }
        else
        {
            goodsnum_txt.color = Color.yellow;
        }
        buyprice_txt.text = goodsUI.price_txt.text;
        if (goodsUI.goodsnum_txt.text == "")
        {
            buynum_txt.text = "1";
        }
        else
        {
            buynum_txt.text = goodsUI.goodsnum_txt.text;
        }
        buynumicon_img.sprite = goodsUI.copper_img.sprite;
        int itemid = ShopMgr.Instance.GetItemID((int)ShopMgr.Instance.shoptype, goods.goodsUIId);

        goodsproperty_txt.text = JsonMgr.GetSingleton().GetItemConfigByID(itemid).propertydes;
        goodsuse_txt.text      = JsonMgr.GetSingleton().GetItemConfigByID(itemid).usedes;
        Goods_obj.SetActive(true);
    }
Beispiel #6
0
 /// <summary>
 /// 点击关闭货物弹框
 /// </summary>
 public void ClickGoodsClose()
 {
     Goods_obj.SetActive(false);
 }