Exemplo n.º 1
0
            public CampRecycleUi_ExchangeItem GetInstance()
            {
                CampRecycleUi_ExchangeItem instance = null;

                if (mCachedInstances != null)
                {
                    while ((instance == null || instance.Equals(null)) && mCachedInstances.Count > 0)
                    {
                        instance = mCachedInstances.Dequeue();
                    }
                }
                if (instance == null || instance.Equals(null))
                {
                    instance = Instantiate <CampRecycleUi_ExchangeItem>(m_ExchangeItem);
                }
                Transform t0 = m_ExchangeItem.transform;
                Transform t1 = instance.transform;

                t1.SetParent(t0.parent);
                t1.localPosition = t0.localPosition;
                t1.localRotation = t0.localRotation;
                t1.localScale    = t0.localScale;
                t1.SetSiblingIndex(t0.GetSiblingIndex() + 1);
                return(instance);
            }
Exemplo n.º 2
0
 public bool CacheInstance(CampRecycleUi_ExchangeItem instance)
 {
     if (instance == null || instance.Equals(null))
     {
         return(false);
     }
     if (mCachedInstances == null)
     {
         mCachedInstances = new Queue <CampRecycleUi_ExchangeItem>();
     }
     if (mCachedInstances.Contains(instance))
     {
         return(false);
     }
     instance.gameObject.SetActive(false);
     mCachedInstances.Enqueue(instance);
     return(true);
 }
Exemplo n.º 3
0
        private void GeneratePartyRecycleMat()
        {
            int index = 0;

            foreach (KeyValuePair <int, double> keyValue in m_RecyclyMat)
            {
                int val = (int)keyValue.Value;
                if (val > 0)
                {
                    ItemItem item = Global.gApp.gGameData.ItemData.Get(keyValue.Key);
                    CampRecycleUi_ExchangeItem exchangeItem = ExchangeItem.GetInstance();
                    exchangeItem.transform.SetSiblingIndex(keyValue.Key);
                    exchangeItem.gameObject.SetActive(true);
                    exchangeItem.Icon.image.sprite = Resources.Load(item.image_grow, typeof(Sprite)) as Sprite;
                    exchangeItem.Count.text.text   = val.ToString();
                    index++;
                    if (index == 4)
                    {
                        break;
                    }
                }
            }
        }