Пример #1
0
 private IEnumerator ShowItems()
 {
     while (Client.Instance.market == null)
     {
         yield return(new WaitForSecondsRealtime(0.1f));
     }
     foreach (var item in Client.Instance.market)
     {
         string     key    = item.name;
         GameObject cloned = GameObject.Instantiate(ShelfItem);
         if (cloned == null)
         {
             continue;
         }
         cloned.SetActive(true);
         cloned.transform.SetParent(this.transform, false);
         ShelfItemUI handler = cloned.GetComponent <ShelfItemUI>();
         if (handler == null)
         {
             continue;
         }
         handler.Init(item);
         market.Add(item.id, cloned);
     }
 }
Пример #2
0
 private void OnEnable()
 {
     foreach (KeyValuePair <string, TreasureMall> goods in TreasureInfo.treasureMall)
     {
         string     key    = goods.Key;
         GameObject cloned = GameObject.Instantiate(ShelfItem);
         if (cloned == null)
         {
             continue;
         }
         cloned.SetActive(true);
         cloned.transform.SetParent(this.transform, false);
         ShelfItemUI handler = cloned.GetComponent <ShelfItemUI>();
         if (handler == null)
         {
             continue;
         }
         handler.Init(key, goods.Value.price, goods.Value.isGold);
         //MessageBox.Show("mall: " + key);
     }
 }
Пример #3
0
 // Use this for initialization
 void Start()
 {
     foreach (KeyValuePair <string, Sprite> kv in GetAllIcons.icons)
     {
         string     key    = kv.Key;
         GameObject cloned = GameObject.Instantiate(ShelfItem);
         if (cloned == null)
         {
             continue;
         }
         cloned.SetActive(true);
         cloned.transform.SetParent(this.transform, false);
         ShelfItemUI handler = cloned.GetComponent <ShelfItemUI>();
         if (handler == null)
         {
             continue;
         }
         handler.Init(key);
     }
     ShelfItem.SetActive(false);
 }