/// <summary> /// 创建人员列表 /// </summary> public void CreateGrid(List <InspectionTrackHistory> date) { ClearItems(); int startIndex = currentPageNum * showCount; int num = showCount; if (startIndex + num > searchList.Count) { num = searchList.Count - startIndex; } if (date.Count == 0) { return; } List <InspectionTrackHistory> historyList = searchList.GetRange(startIndex, num); i = 0; foreach (InspectionTrackHistory w in historyList) { i = i + 1; int currentIndex = startIndex + i; MobileInspectionHistoryItem item = CreatePersonItem(w, currentIndex); item.gameObject.SetActive(true); if (i % 2 == 0) { item.transform.gameObject.GetComponent <Image>().sprite = DoubleLine; } else { item.transform.gameObject.GetComponent <Image>().sprite = Singleline; } } // SetPreviousAndNextPageBtn(); }
/// <summary> /// 创建人员列表项 /// </summary> public MobileInspectionHistoryItem CreatePersonItem(InspectionTrackHistory w, int currentIndex) { titleHistory = w.Code + "-" + w.Name; MobileInspectionHistoryItem item = Instantiate(itemPrefab); item.Init(w, currentIndex); item.transform.SetParent(grid.transform); item.transform.localScale = Vector3.one; item.transform.localPosition = Vector3.zero; //item.gameObject.SetActive(true); return(item); }