public void RefreshList(int TOTALCOUNT) { InitTrans(); mTotalDataCount = TOTALCOUNT; if (mTotalDataCount < 0) { mInfiniteList = null; return; } InitOriginData(); SetContentSizeDelta(); SetNormalize(); SetOriginPos(CURRENTINDEX); mInfiniteList = new LinkedList <GridItem>(); //Debug.Log("mNormalValue:" + mNormalValue); //Debug.Log("mBaseoffsetValue:" + mBaseoffsetValue); mStarIndex = GetStarIndex(mNormalValue); mEndIndex = mStarIndex - mMaxNum + 1; CURRENTINDEX = mStarIndex; mLayoutGroup.enabled = false; mObjList.Sort((T1, T2) => { if (!T1.activeSelf || !T2.activeSelf) { return(-1); } else if (T1.GetComponent <GridItem>().mCurrentIndex > T2.GetComponent <GridItem>().mCurrentIndex) { return(1); } else { return(-1); } }); for (int i = 0; i < mObjList.Count; i++) { if (i < mTotalDataCount) { mObjList[i].SetActive(true); } else { mObjList[i].SetActive(false); } } for (int i = 0; i < mMaxNum; i++) { GameObject obj = null; GridItem grid = null; if (i < mObjList.Count) { obj = mObjList[i]; grid = obj.GetComponent <GridItem>(); } else { obj = GameObject.Instantiate(mItemClone); obj.transform.SetParent(mContent.transform); obj.transform.localScale = Vector3.one; obj.SetActive(true); grid = obj.AddComponent <GridItem>(); //obj.transform.rectTransform().anchorMax = Vector2.one / 2; //obj.transform.rectTransform().anchorMin = Vector2.one / 2; //obj.transform.rectTransform().sizeDelta = mLayoutGroup.cellSize; mObjList.Add(obj); } var Pos = mStarIndex - i; grid.InitItem(this); grid.Refresh(Pos); } mScroll.onValueChanged.RemoveAllListeners(); mScroll.onValueChanged.AddListener((vec) => { UpdateView(vec); //Debug.Log(vec); }); }