Ejemplo n.º 1
0
            public FightLose_ResIcon GetInstance()
            {
                FightLose_ResIcon 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 <FightLose_ResIcon>(m_ResIcon);
                }
                Transform t0 = m_ResIcon.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);
            }
Ejemplo n.º 2
0
 public bool CacheInstance(FightLose_ResIcon instance)
 {
     if (instance == null || instance.Equals(null))
     {
         return(false);
     }
     if (mCachedInstances == null)
     {
         mCachedInstances = new Queue <FightLose_ResIcon>();
     }
     if (mCachedInstances.Contains(instance))
     {
         return(false);
     }
     instance.gameObject.SetActive(false);
     mCachedInstances.Enqueue(instance);
     return(true);
 }
Ejemplo n.º 3
0
 private int AddResIcon(ref int[] itemArray, int index)
 {
     foreach (int itemId in itemArray)
     {
         ItemItem itemItem  = Global.gApp.gGameData.ItemData.Get(itemId);
         string   itemName  = itemItem.name;
         int      itemCount = Global.gApp.CurScene.GetMainPlayerComp().GetPlayerData().GetDropResCount(itemName);
         if (itemCount > 0)
         {
             float delayTime = index * m_DtDelayTime + m_StartDelayTime;
             index++;
             FightLose_ResIcon itemUI = ResIcon.GetInstance();
             itemUI.transform.SetAsLastSibling();
             itemUI.gameObject.SetActive(true);
             itemUI.Init(delayTime, itemCount, itemItem);
             m_FightWinIcons.Add(itemUI);
         }
     }
     return(index);
 }