Пример #1
0
    /// <summary>
    /// 生成商店项目 并对UIShopItem赋值
    /// </summary>
    /// <returns></returns>
    IEnumerator InitItems()
    {
        int count = 0;
        int page  = 0;

        foreach (var kv in DataManager.Instance.ShopItems[this.shop.ID])
        {
            if (kv.Value.Status > 0)
            {
                GameObject go     = Instantiate(shopItem, itemRoot[page]);
                UIShopItem uiItem = go.GetComponent <UIShopItem>();
                uiItem.SetShopItem(kv.Key, kv.Value, this);
                //分页
                //count++;
                //if (count>=10)
                //{
                //    count = 0;
                //    page++;
                //    itemRoot[page].gameObject.SetActive(true);
                //}
            }
        }

        yield return(null);
    }
Пример #2
0
    IEnumerator InitItems()
    {
        int i = 0;

        foreach (var kv in DataManager.Instance.ShopItems[shop.ID])
        {
            if (kv.Value.Status > 0)
            {
                GameObject go = Instantiate(ShopItem, itemRoot[i / 22]);
                UIShopItem ui = go.GetComponent <UIShopItem>();
                ui.SetShopItem(kv.Key, kv.Value, this);
                i++;
            }
        }
        yield return(null);
    }