Exemplo n.º 1
0
        /// <summary>
        /// 创建人员列表
        /// </summary>
        public void CreateGrid(List <WorkTicketHistory> date)
        {
            ClearItems();

            int startIndex = currentPageNum * showCount;
            int num        = showCount;

            if (startIndex + num > date.Count)
            {
                num = date.Count - startIndex;
            }
            if (date.Count == 0)
            {
                return;
            }
            List <WorkTicketHistory> workTicketHistoryT = date.GetRange(startIndex, num);

            foreach (WorkTicketHistory w in workTicketHistoryT)
            {
                i = i + 1;

                WorkTicketHistoryItem item = CreatePersonItem(w);
                item.gameObject.SetActive(true);
                if (i % 2 == 0)
                {
                    item.transform.gameObject.GetComponent <Image>().sprite = DoubleLine;
                }
                else
                {
                    item.transform.gameObject.GetComponent <Image>().sprite = Singleline;
                }
            }
            //   SetPreviousAndNextPageBtn();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 创建人员列表项
        /// </summary>
        public WorkTicketHistoryItem CreatePersonItem(WorkTicketHistory w)
        {
            WorkTicketHistoryItem item = Instantiate(itemPrefab);

            item.Init(w);
            item.transform.SetParent(grid.transform);
            item.transform.localScale    = Vector3.one;
            item.transform.localPosition = Vector3.zero;
            //item.gameObject.SetActive(true);
            return(item);
        }