UDragEnhanceView.SetScrollView C# (CSharp) Method

SetScrollView() public method

public SetScrollView ( EnhanceScrollView, view ) : void
view EnhanceScrollView,
return void
    public void SetScrollView(EnhanceScrollView view)
    {
        enhanceScrollView = view;
    }

Usage Example

示例#1
0
    void Start()
    {
        canChangeItem = true;
        int count = listEnhanceItems.Count;

        dFactor      = (Mathf.RoundToInt((1f / count) * 10000f)) * 0.0001f;
        mCenterIndex = count / 2; //This is for any number of item
        if (count % 2 == 0)       //this is for when number is 6,8,10,... then mid would be 2,3,4,....
        {
            mCenterIndex = count / 2 - 1;
        }
        int index = 0;

        for (int i = count - 1; i >= 0; i--)
        {
            listEnhanceItems[i].CurveOffSetIndex = i;
            listEnhanceItems[i].CenterOffSet     = dFactor * (mCenterIndex - index);
            listEnhanceItems[i].SetSelectState(false);
            GameObject obj = listEnhanceItems[i].gameObject;

            if (inputType == InputSystemType.NGUIAndWorldInput)
            {
                #region hidden cause not using NGUI
                ///    DragEnhanceView script = obj.GetComponent<DragEnhanceView>();
                ////if (script != null)
                ////    script.SetScrollView(this);
                #endregion
            }
            else
            {
                UDragEnhanceView script = obj.GetComponent <UDragEnhanceView>();
                if (script != null)
                {
                    script.SetScrollView(this);
                }
            }
            index++;
        }

        // set the center item with startCenterIndex
        if (startCenterIndex < 0 || startCenterIndex >= count)
        {
            Debug.LogError("## startCenterIndex < 0 || startCenterIndex >= listEnhanceItems.Count  out of index ##");
            startCenterIndex = mCenterIndex;
        }

        // sorted items
        listSortedItems      = new List <EnhanceItem>(listEnhanceItems.ToArray());
        totalHorizontalWidth = cellWidth * count;
        curCenterItem        = listEnhanceItems[startCenterIndex];
        curHorizontalValue   = 0.5f - curCenterItem.CenterOffSet;
        LerpTweenToTarget(0f, curHorizontalValue, false);

        #region hidden cause not using NGUI
        //
        // enable the drag actions
        //
        ////  EnableDrag(true);
        #endregion
    }
All Usage Examples Of UDragEnhanceView::SetScrollView