Exemplo n.º 1
0
    //生成预设物
    private void Inatantite()
    {
        List <CommodityDataTable> commodity = ShopInit.Instance.GetShopCommodity(3);

        foreach (CommodityDataTable c in commodity)
        {    //有名字
            if ((c.id == 19) || (c.id == 20) || (c.id == 21) || (c.id == 28) || (c.id == 29) || (c.id == 30))
            {
                goodsName1.text    = c.name;                                            //更改名字
                price1.text        = c.selling.ToString();                              //更改价格
                goodsImage1.sprite = ShopInit.Instance.goodsimages[c.id - 1];           //更改图片

                GameObject go = Instantiate(Duihuan1, transform.GetChild(0).transform); //生成这预设物
                JinbiGoods j  = go.GetComponent <JinbiGoods>();
                if (j == null)
                {
                    j = go.AddComponent <JinbiGoods>();
                }

                j.Id(c.id, c.selling, c.shopId, c.vipLimitLv);
            }
            else
            {
                goodsImage2.sprite = ShopInit.Instance.goodsimages[c.id - 1];           //更改图片
                price2.text        = c.selling.ToString();                              //更改价格
                GameObject go = Instantiate(Duihuan2, transform.GetChild(0).transform); //生成这预设物
                JinbiGoods j  = go.GetComponent <JinbiGoods>();
                if (j == null)
                {
                    j = go.AddComponent <JinbiGoods>();
                }
                j.Id(c.id, c.selling, c.shopId, c.vipLimitLv);
            }
        }
    }
Exemplo n.º 2
0
    //生成五个预设物
    private void Inatantite()
    {
        List <CommodityDataTable> commodity = ShopInit.Instance.GetShopCommodity(5);

        foreach (CommodityDataTable c in commodity)
        {
            //每遍历一次就改变一次预设物的各项信息并且生成
            string Price;
            if (c.selling < 10000)
            {
                price.text = c.selling.ToString();//更改价格显示
            }
            if (c.selling >= 10000 && c.selling < 100000000)
            {
                Price      = ((int)c.selling / 10000) + "万";
                price.text = Price;                                      //更改价格显示
            }
            goodsName.text    = c.name;                                  //更改名字
            goodsImage.sprite = ShopInit.Instance.goodsimages[c.id - 1]; //更改图片
            if (c.vipLimitLv != 0)
            {
                //让VIP标显示出来
                vipBiao.gameObject.SetActive(true);
                //更换VIP标的图片
                vipBiao.sprite = VIPImages[c.vipLimitLv];
            }
            else
            {
                //让VIP标隐藏
                vipBiao.gameObject.SetActive(false);
            }
            //生成这预设物
            GameObject go = Instantiate(CarGoods, transform.GetChild(0).transform);
            //获取到预设物脚本,将物品参数传过去
            JinbiGoods j = go.GetComponent <JinbiGoods>();
            if (j == null)
            {
                j = go.AddComponent <JinbiGoods>();
            }
            j.Id(c.id, c.selling, c.shopId, c.vipLimitLv);
        }
    }
Exemplo n.º 3
0
    private void Inatantite()
    {
        List <CommodityDataTable> commodity = ShopInit.Instance.GetShopCommodity(2);

        foreach (CommodityDataTable c in commodity)
        {
            //每遍历一次就改变一次预设物的各项信息并且生成
            goodsName.text    = c.name;                                  //更改名字
            goodsImage.sprite = ShopInit.Instance.goodsimages[c.id - 1]; //更改图片
            //生成这预设物
            GameObject go = Instantiate(jinbiShangpin, transform.GetChild(0).transform);
            //获取到预设物脚本,将物品参数传过去
            JinbiGoods j = go.GetComponent <JinbiGoods>();
            if (j == null)
            {
                j = go.AddComponent <JinbiGoods>();
            }
            j.Id(c.id, c.selling, c.shopId, c.vipLimitLv);
        }
    }
Exemplo n.º 4
0
    //生成五个预设物
    private void Inatantite()
    {
        List <CommodityDataTable> commodity = ShopInit.Instance.GetShopCommodity(5);

        foreach (CommodityDataTable c in commodity)
        {
            //每遍历一次就改变一次预设物的各项信息并且生成
            string Price;
            if (c.selling < 10000)
            {
                price.text = c.selling.ToString();//更改价格显示
            }
            else if (c.selling >= 10000 && c.selling < 100000000)
            {
                Price      = ((int)c.selling / 10000) + "万";
                price.text = Price; //更改价格显示
            }
            else if (c.selling >= 100000000)
            {
                Price      = ((int)c.selling / 100000000) + "亿";
                price.text = Price;                                      //更改价格显示
            }
            goodsName.text      = c.name;                                //更改名字
            miaoshu.text        = c.describe;                            //更改描述
            moneyTypeIma.sprite = ShopInit.Instance.MoneyTypeImaList[2]; //更换自己货币图片并显示
            moneyTypeIma.gameObject.SetActive(true);
            goodsImage.sprite = ShopInit.Instance.goodsimages[c.id - 1]; //更改图片
            //生成这预设物
            GameObject go = Instantiate(jinbiShangpin, transform.GetChild(0).transform);
            //获取到预设物脚本,将物品参数传过去
            JinbiGoods j = go.GetComponent <JinbiGoods>();
            if (j == null)
            {
                j = go.AddComponent <JinbiGoods>();
            }
            j.Id(c.id, c.selling, c.shopId, c.vipLimitLv);
        }
    }