示例#1
0
    public void DoMallProductRequest(Action callback)
    {
        PacketBase msg = new PacketBase()
        {
            packetType = PacketType.MallProductRequest
        };

        SocketNetTools.SendMsg(msg, PacketType.MallProductResponse, (data) =>
        {
            MallProductResponse response = NetSerilizer.DeSerialize <MallProductResponse>(data.data);
            Game.Instance.MallProduct    = response;
            callback();
        });
    }
示例#2
0
    private void SetupUI()
    {
        MallProductResponse resp = Game.Instance.MallProduct;

        if (null != resp)
        {
            PrefabUtils.ClearChild(detail.CardsGrid_GridLayoutGroup);
            PrefabUtils.ClearChild(detail.CoinsGrid_GridLayoutGroup);
            foreach (MallProductModel model in resp.products)
            {
                if (model.category == 1)
                {
                    GameObject  child = PrefabUtils.AddChild(detail.CardsGrid_GridLayoutGroup, detail.ShopCardSub_ShopCardSub);
                    ShopCardSub sub   = child.GetComponent <ShopCardSub>();
                    sub.SetValue(model);
                }
                else
                {
                    GameObject   child = PrefabUtils.AddChild(detail.CoinsGrid_GridLayoutGroup, detail.ShopCoinsSub_ShopCoinsSub);
                    ShopCoinsSub sub   = child.GetComponent <ShopCoinsSub>();
                    sub.SetValue(model);
                }
            }
        }
        //foreach (ConfigShop config in ConfigShop.datas)
        //{
        //    if(config.ShopType == 1)
        //    {
        //        GameObject child = PrefabUtils.AddChild(detail.CardsGrid_GridLayoutGroup, detail.ShopCardSub_ShopCardSub);
        //        ShopCardSub sub = child.GetComponent<ShopCardSub>();
        //        sub.SetValue(config);
        //    }else
        //    {
        //        GameObject child = PrefabUtils.AddChild(detail.CoinsGrid_GridLayoutGroup, detail.ShopCoinsSub_ShopCoinsSub);
        //        ShopCoinsSub sub = child.GetComponent<ShopCoinsSub>();
        //        sub.SetValue(config);
        //    }
        //}
    }