public void ChangesH() { //transform.FindChild ("Scroll View 1").transform.localPosition = transform.FindChild ("Scroll View").transform.localPosition; //transform.FindChild ("Scroll View 1").GetComponent<UIPanel> ().clipOffset = transform.FindChild ("Scroll View").GetComponent<UIPanel> ().clipOffset; transform.FindChild("Scroll View 1").gameObject.SetActive(true); transform.FindChild("Scroll View 1").GetComponent <UIScrollView> ().ResetPosition(); transform.FindChild("Scroll View").gameObject.SetActive(false); T1.GetComponent <UIButton> ().isEnabled = true; T2.GetComponent <UIButton> ().isEnabled = false; T11.GetComponent <UIButton> ().isEnabled = true; T22.GetComponent <UIButton> ().isEnabled = false; }
public void ChangesA() { //transform.FindChild ("Scroll View").transform.localPosition = transform.FindChild ("Scroll View 1").transform.localPosition; //transform.FindChild ("Scroll View").GetComponent<UIPanel> ().clipOffset = transform.FindChild ("Scroll View 1").GetComponent<UIPanel> ().clipOffset; transform.FindChild("Scroll View").gameObject.SetActive(true); transform.FindChild("Scroll View").GetComponent <UIScrollView> ().ResetPosition(); transform.FindChild("Scroll View 1").gameObject.SetActive(false); T1.GetComponent <UIButton> ().isEnabled = false; T2.GetComponent <UIButton> ().isEnabled = true; T11.GetComponent <UIButton> ().isEnabled = false; T22.GetComponent <UIButton> ().isEnabled = true; // T1.GetComponent<UILabel>().color = new Color(147f/255f,147f/255f,147f/255f); // T2.GetComponent<UILabel>().color = new Color(37f/255f,170f/255f,225f/255f); // T11.GetComponent<UILabel>().color = new Color(147f/255f,147f/255f,147f/255f); // T22.GetComponent<UILabel>().color = new Color(37f/255f,170f/255f,225f/255f); // }
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); }); }