Esempio n. 1
0
        void OnMonthSnapTargetFinished(LoopListView2 listView, LoopListViewItem2 item)
        {
            LoopListViewItem2 item0      = mLoopListViewDay.GetShownItemByIndex(0);
            ListItem7         itemScript = item0.GetComponent <ListItem7>();
            int index = itemScript.Value - 1;

            mLoopListViewDay.RefreshAllShownItemWithFirstIndex(index);
        }
Esempio n. 2
0
 void OnListViewSnapTargetChanged(LoopListView2 listView, int targetIndex)
 {
     for (int i = 0; i < listView.ShownItemCount; ++i)
     {
         LoopListViewItem2 item2      = listView.GetShownItemByIndex(i);
         ListItem7         itemScript = item2.GetComponent <ListItem7>();
         itemScript.OnListViewSnapTargetChanged(i == targetIndex);
     }
 }
Esempio n. 3
0
 void LateUpdate()
 {
     mLoopListViewHour.UpdateAllShownItemSnapData();
     for (int i = 0; i < mLoopListViewHour.ShownItemCount; ++i)
     {
         LoopListViewItem2 item       = mLoopListViewHour.GetShownItemByIndex(i);
         ListItem7         itemScript = item.GetComponent <ListItem7>();
         float             scale      = 1 - Mathf.Abs(item.DistanceWithViewPortSnapCenter) / 700f;
         scale = Mathf.Clamp(scale, 0.4f, 1);
         itemScript.SetScale(scale);
     }
 }
        void LateUpdate()
        {
            mLoopListView.UpdateAllShownItemSnapData();
            int count = mLoopListView.ShownItemCount;

            for (int i = 0; i < count; ++i)
            {
                LoopListViewItem2 item       = mLoopListView.GetShownItemByIndex(i);
                ListItem2         itemScript = item.GetComponent <ListItem2>();
                float             scale      = 1 - Mathf.Abs(item.DistanceWithViewPortSnapCenter) / 700f;
                scale = Mathf.Clamp(scale, 0.4f, 1);
                itemScript.mContentRootObj.GetComponent <CanvasGroup>().alpha = scale;
                itemScript.mContentRootObj.transform.localScale = new Vector3(scale, scale, 1);
            }
        }
Esempio n. 5
0
        private void LateUpdate()
        {
            m_view.UpdateAllShownItemSnapData();

            int count = m_view.ShownItemCount;

            for (int i = 0; i < count; ++i)
            {
                var itemObj = m_view.GetShownItemByIndex(i);
                var itemUI  = itemObj.GetComponent <ListItemUI>();
                var amount  = 1 - Mathf.Abs(itemObj.DistanceWithViewPortSnapCenter) / 720f;
                var scale   = Mathf.Clamp(amount, 0.4f, 1);

                itemUI.SetScale(scale);
            }
        }
Esempio n. 6
0
        private void OnListViewSnapTargetChanged(LoopListView2 listView, int targetIndex)
        {
            int shownItemCount = listView.ShownItemCount;

            for (int index = 0; index < shownItemCount; ++index)
            {
                ListItem7 component = (ListItem7)((Component)listView.GetShownItemByIndex(index)).GetComponent <ListItem7>();
                if (index == targetIndex)
                {
                    ((Graphic)component.mText).set_color(Color.get_red());
                }
                else
                {
                    ((Graphic)component.mText).set_color(Color.get_black());
                }
            }
        }
Esempio n. 7
0
        void OnListViewSnapTargetChanged(LoopListView2 listView, int targetIndex)
        {
            int count = listView.ShownItemCount;

            for (int i = 0; i < count; ++i)
            {
                LoopListViewItem2 item2      = listView.GetShownItemByIndex(i);
                ListItem7         itemScript = item2.GetComponent <ListItem7>();
                if (i == targetIndex)
                {
                    itemScript.mText.color = Color.red;
                }
                else
                {
                    itemScript.mText.color = Color.black;
                }
            }
        }
Esempio n. 8
0
 public void Handle_ScrollChanged(Vector2 offset)
 {
     if (Mathf.Abs(lastOffY - offset.y) > 0.01f)
     {
         lastOffY = offset.y;
         if (scrollViewer.ShownItemCount > 0)
         {
             int i   = 2;
             var val = scrollViewer.ScrollRect.verticalScrollbar.value;
             if (val > 0.99f)
             {
                 i = 0;
             }
             else if (val < 0.01f)
             {
                 i = scrollViewer.ShownItemCount - 1;
             }
             else
             {
                 if (i >= scrollViewer.ShownItemCount)
                 {
                     i = scrollViewer.ShownItemCount - 1;
                 }
             }
             var item = scrollViewer.GetShownItemByIndex(i);
             if (item == null)
             {
                 return;
             }
             var parts = item.GetComponent <TimeParts>();
             if (parts != null)
             {
                 var info = GetAffairInfo(parts.identify);
                 UpdateAnchorStep(info);
             }
         }
     }
 }
Esempio n. 9
0
        void UpdateStickeyHeadPos()
        {
            bool isHeadItemVisible = mStickeyHeadItem.gameObject.activeSelf;
            int  count             = mLoopListView.ShownItemCount;

            if (count == 0)
            {
                if (isHeadItemVisible)
                {
                    mStickeyHeadItem.gameObject.SetActive(false);
                }
                return;
            }
            LoopListViewItem2 item0   = mLoopListView.GetShownItemByIndex(0);
            Vector3           topPos0 = mLoopListView.GetItemCornerPosInViewPort(item0, ItemCornerEnum.LeftTop);

            LoopListViewItem2 targetItem = null;
            float             start      = topPos0.y;
            float             end        = start - item0.ItemSizeWithPadding;
            int targetItemShownIndex     = -1;

            if (start <= 0)
            {
                if (isHeadItemVisible)
                {
                    mStickeyHeadItem.gameObject.SetActive(false);
                }
                return;
            }
            if (end < 0)
            {
                targetItem           = item0;
                targetItemShownIndex = 0;
            }
            else
            {
                for (int i = 1; i < count; ++i)
                {
                    LoopListViewItem2 item = mLoopListView.GetShownItemByIndexWithoutCheck(i);
                    start = end;
                    end   = start - item.ItemSizeWithPadding;
                    if (start >= 0 && end <= 0)
                    {
                        targetItem           = item;
                        targetItemShownIndex = i;
                        break;
                    }
                }
            }
            if (targetItem == null)
            {
                if (isHeadItemVisible)
                {
                    mStickeyHeadItem.gameObject.SetActive(false);
                }
                return;
            }
            int itemIndex  = targetItem.UserIntData1;
            int childIndex = targetItem.UserIntData2;
            TreeViewItemCountData countData = mTreeItemCountMgr.GetTreeItem(itemIndex);

            if (countData == null)
            {
                if (isHeadItemVisible)
                {
                    mStickeyHeadItem.gameObject.SetActive(false);
                }
                return;
            }
            if (countData.mIsExpand == false || countData.mChildCount == 0)
            {
                if (isHeadItemVisible)
                {
                    mStickeyHeadItem.gameObject.SetActive(false);
                }
                return;
            }
            if (isHeadItemVisible == false)
            {
                mStickeyHeadItem.gameObject.SetActive(true);
            }
            if (mStickeyHeadItem.TreeItemIndex != itemIndex)
            {
                TreeViewItemData treeViewItemData = TreeViewDataSourceMgr.Get.GetItemDataByIndex(itemIndex);
                mStickeyHeadItem.mText.text = treeViewItemData.mName;
                mStickeyHeadItem.SetItemData(itemIndex, countData.mIsExpand);
            }
            mStickeyHeadItem.gameObject.transform.localPosition = Vector3.zero;
            float lastChildPosAbs = -end;
            float lastPadding     = targetItem.Padding;

            if (lastChildPosAbs - lastPadding >= mStickeyHeadItemHeight)
            {
                return;
            }
            for (int i = targetItemShownIndex + 1; i < count; ++i)
            {
                LoopListViewItem2 item = mLoopListView.GetShownItemByIndexWithoutCheck(i);
                if (item.UserIntData1 != itemIndex)
                {
                    break;
                }
                lastChildPosAbs += item.ItemSizeWithPadding;
                lastPadding      = item.Padding;
                if (lastChildPosAbs - lastPadding >= mStickeyHeadItemHeight)
                {
                    return;
                }
            }
            float y = mStickeyHeadItemHeight - (lastChildPosAbs - lastPadding);

            mStickeyHeadItemRf.anchoredPosition3D = new Vector3(0, y, 0);
        }