Esempio n. 1
0
        //item是Unity侧的item对象,在这里创建相应的UI对象
        public static void AddItemViewComponent <T>(this UILoopGridView self, LoopGridViewItem item) where T : Entity, IAwake, IOnEnable
        {
            //保证名字不能相同 不然没法cache
            item.gameObject.name = item.gameObject.name + item.ItemId;
            T t = self.AddUIComponentNotCreate <T>(item.gameObject.name);

            t.AddUIComponent <UITransform, Transform>("", item.transform);
            UIEventSystem.Instance.OnCreate(t);
        }
Esempio n. 2
0
        public LoopGridViewItem GetItemByRow(int row)
        {
            LoopGridViewItem cur = mFirst;

            while (cur != null)
            {
                if (cur.Row == row)
                {
                    return(cur);
                }
                cur = cur.NextItem;
            }
            return(null);
        }
Esempio n. 3
0
        public LoopGridViewItem GetItemByColumn(int column)
        {
            LoopGridViewItem cur = mFirst;

            while (cur != null)
            {
                if (cur.Column == column)
                {
                    return(cur);
                }
                cur = cur.NextItem;
            }
            return(null);
        }
Esempio n. 4
0
        public void Clear()
        {
            LoopGridViewItem current = mFirst;

            while (current != null)
            {
                current.PrevItem = null;
                current.NextItem = null;
                current          = current.NextItem;
            }
            mFirst = null;
            mLast  = null;
            mCount = 0;
        }
Esempio n. 5
0
        public LoopGridViewItem RemoveLast()
        {
            LoopGridViewItem ret = mLast;

            if (mFirst == null)
            {
                return(ret);
            }
            if (mFirst == mLast)
            {
                mFirst = null;
                mLast  = null;
                --mCount;
                return(ret);
            }
            mLast          = mLast.PrevItem;
            mLast.NextItem = null;
            --mCount;
            return(ret);
        }
Esempio n. 6
0
 public void AddFirst(LoopGridViewItem newItem)
 {
     newItem.PrevItem = null;
     newItem.NextItem = null;
     if (mFirst == null)
     {
         mFirst          = newItem;
         mLast           = newItem;
         mFirst.PrevItem = null;
         mFirst.NextItem = null;
         mCount++;
     }
     else
     {
         mFirst.PrevItem  = newItem;
         newItem.PrevItem = null;
         newItem.NextItem = mFirst;
         mFirst           = newItem;
         mCount++;
     }
 }
Esempio n. 7
0
 public void ReplaceItem(LoopGridViewItem curItem, LoopGridViewItem newItem)
 {
     newItem.PrevItem = curItem.PrevItem;
     newItem.NextItem = curItem.NextItem;
     if (newItem.PrevItem != null)
     {
         newItem.PrevItem.NextItem = newItem;
     }
     if (newItem.NextItem != null)
     {
         newItem.NextItem.PrevItem = newItem;
     }
     if (mFirst == curItem)
     {
         mFirst = newItem;
     }
     if (mLast == curItem)
     {
         mLast = newItem;
     }
 }
Esempio n. 8
0
 //根据Unity侧item获取UI侧的item
 public static T GetUIItemView <T>(this UILoopGridView self, LoopGridViewItem item) where T : Entity, IAwake
 {
     return(self.GetUIComponent <T>(item.gameObject.name));
 }