Beispiel #1
0
        void RefreshGoods()
        {
            List <GoodsData> goods = GameManager.Instance.goodsList;

            //string jsonStr = File.ReadAllText("shopJson.txt");
            //Recv_Get_Shop shopData = JsonMapper.ToObject<Recv_Get_Shop>(jsonStr);
            //Debug.Log(jsonStr);
            if (goods != null)
            {
                int index = 0;
                foreach (var item in goods)
                {
                    GoodItem tempItem = goodsItem.Clone() as GoodItem;
                    if (tempItem)
                    {
                        tempItem.SetActive(true);
                        tempItem.OpenUI();
                        tempItem.SetItemInfo(item, index);

                        goodsList.Add(tempItem);
                    }

                    index++;
                }
            }
        }
Beispiel #2
0
        protected override void OnInit(object userData)
        {
            base.OnInit(userData);
            GUILink link = GetComponent <GUILink>();

            goodsItem = link.Get <GoodItem>("GoodInfo");
            goodsItem.SetActive(false);
            goodsList = new List <GoodItem>();

            link.SetEvent("ButtonClose", UIEventType.Click, OnClickExit);

            RefreshGoods();
        }