Пример #1
0
            public SupportUI_SupportItemUI GetInstance()
            {
                SupportUI_SupportItemUI 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 <SupportUI_SupportItemUI>(m_SupportItemUI);
                }
                Transform t0 = m_SupportItemUI.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);
            }
Пример #2
0
        //刷新ShowScrollItem
        private void ShowScrollItem(int itemType)
        {
            SupportItemUI.gameObject.SetActive(false);
            if (!Global.gApp.gGameData.ItemTypeMapData.ContainsKey(itemType))
            {
                return;
            }

            for (int i = 0; i < Global.gApp.gGameData.ItemTypeMapData[itemType].Count; i++)
            {
                ItemItem itemConfig            = Global.gApp.gGameData.ItemTypeMapData[itemType][i];
                SupportUI_SupportItemUI itemUI = SupportItemUI.GetInstance();
                itemUI.Init(itemConfig);
                m_ShowItemList.Add(itemUI);
            }
        }
Пример #3
0
 public bool CacheInstance(SupportUI_SupportItemUI instance)
 {
     if (instance == null || instance.Equals(null))
     {
         return(false);
     }
     if (mCachedInstances == null)
     {
         mCachedInstances = new Queue <SupportUI_SupportItemUI>();
     }
     if (mCachedInstances.Contains(instance))
     {
         return(false);
     }
     instance.gameObject.SetActive(false);
     mCachedInstances.Enqueue(instance);
     return(true);
 }