Exemple #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);
     }
 }
Exemple #2
0
    public void GetAllItems()
    {
        var items = FrontEnd.World.Instance.TmallItems;

        foreach (var kv in items)
        {
            var cloned = GameObject.Instantiate(ShelfItem);
            cloned.transform.SetParent(this.transform, false);
            ShelfItemUI handler = cloned.GetComponent <ShelfItemUI>();
            //handler.SetInfo(kv.Key.name, kv.Key.icon, kv.Key.type, kv.Value);
            handler.SetInfo(kv.Key, kv.Value);
        }
        ShelfItem.SetActive(false);
    }
Exemple #3
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);
     }
 }
Exemple #4
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);
 }