public void showUI(bool updatePage, int startIndex) { //当前页 currentPage = pageIndex / onePageNumber + 1; m_Page.text = (pageIndex / onePageNumber + 1) + " / " + totalPage; for (int i = 0; i < list.Count; i++) { Destroy(GameObject.Find("ID" + list[i].ID)); } for (int i = pageIndex; i < list.Count && i < pageIndex + onePageNumber; i++) { Vector3 rotation = new Vector3(0, 0, 0); Vector3 position = new Vector3(-9.2f + (i % onePageRowNumber) * 9.0f, 4.0f, 8.0f); if (i < pageIndex + onePageRowNumber) { position.y = 4.0f; } else { position.y = -2.0f; } addThumbnail(i, position, rotation); } if (updatePage) { for (int i = 0; i < pageGameObj.Count; i++) { GameObject pageObj = pageGameObj[i]; if (pageObj != null) { TextMesh pageObjText = pageObj.GetComponentInChildren <TextMesh>(); pageObjText.text = (pageIndex / onePageNumber + 1 + i + startIndex).ToString(); TextInteractiveItem pageTI = pageObj.GetComponentInChildren <TextInteractiveItem>(); pageTI.name = "page_" + i + "_" + (int.Parse(pageObjText.text) - 1) * onePageNumber; } } } //默认是第一个 upatePageMaterial(pageSelectIndex); }
private void upateTypeMaterial() { for (int i = 0; i < listType.Count; i++) { GameObject gameObj = GameObject.Find("paratype" + i + "/type" + i); if (gameObj != null) { TextInteractiveItem gameTI = gameObj.GetComponentInChildren <TextInteractiveItem>(); if (i == Main.currentType) { gameObj.GetComponent <Renderer>().material = m_OverMaterial; gameTI.isSelected = true; } else { gameObj.GetComponent <Renderer>().material = m_NorMaterial; gameTI.isSelected = false; } } } }
private void upatePageMaterial(int selectId) { for (int i = 0; i < pageGameObj.Count; i++) { GameObject pageObj = pageGameObj[i]; if (pageObj != null) { TextInteractiveItem gameTI = pageObj.GetComponentInChildren <TextInteractiveItem>(); if (i == selectId) { gameTI.GetComponent <Renderer>().material = m_OverMaterial; gameTI.isSelected = true; } else { gameTI.GetComponent <Renderer>().material = m_NorMaterial; gameTI.isSelected = false; } } } }