Example #1
0
 public void DisableObj()
 {
     if (_slotObject != null)
     {
         _slotObject.Enable(false);
         _slotObject = null;
     }
 }
        private void UpdateElementVisibility()
        {
            for (int i = 0; i < _slotListCount; i++)
            {
                var slot = _slotList[i];

                //Max Top
                if (currentIndex - appendObjectNum > i)
                {
                    DisableObject(slot);
                    continue;
                }

                //Max Bottom
                if (i > currentIndex + retainObjectNum + appendObjectNum)
                {
                    DisableObject(slot);
                    continue;
                }

                if (!slot.isEnable)
                {
                    UltimateSlotObject createObj = ultimatePooling.GetObject(slot.slotStat._id);
                    visibleSize = new Vector2(_scrollViewport.rect.width, _scrollViewport.rect.height);

                    createObj.rectTransform.sizeDelta = GetObjectPhysicalSize(createObj.rectTransform.sizeDelta);

                    slot.SetObject(createObj);
                    createObj.Enable(true);

                    if (OnSlotCreateEvent != null)
                    {
                        OnSlotCreateEvent(slot);
                    }
                }
                else if (!slot.slotObject.isEnable)
                {
                    slot.slotObject.Enable(true);

                    slot.slotObject.rectTransform.sizeDelta = GetObjectPhysicalSize(slot.slotObject.rectTransform.sizeDelta);

                    if (OnSlotCreateEvent != null)
                    {
                        OnSlotCreateEvent(slot);
                    }
                }

                slot.slotObject.rectTransform.anchoredPosition = slot.Position;
            }
        }
Example #3
0
 public void RemoveObject(UltimateSlotObject p_object)
 {
     p_object.Enable(false);
 }