public void AddLiLianRunView(LiLianRunData r) { r.state = 0; GameObject obj = Instantiate(runPrefabe); obj.SetActive(true); LiLianRunView pop = obj.GetComponent<LiLianRunView>(); pop.InitData(r); r.view = obj.GetComponent<UILabel>(); pop.time.text = Comm.DateDiffHour(DateTime.Now,r.time); pop.transform.parent = timeTable.transform; pop.transform.localScale = Vector3.one; runViewList.Add(pop); timeTable.Reposition(); timeTable.repositionNow = true; }
public void SetLiLianRun(List<LiLianRunData> list) { while (timeTable.transform.childCount > 0) { DestroyImmediate(timeTable.transform.GetChild(0).gameObject); } runViewList = new List<LiLianRunView>(); for (int index = 0; index < list.Count; index++) { //设置格子 GameObject obj = Instantiate(runPrefabe); obj.SetActive(true); LiLianRunView pop = obj.GetComponent<LiLianRunView>(); pop.InitData(list[index]); list[index].view = obj.GetComponent<UILabel>(); pop.time.text = Comm.DateDiffHour(DateTime.Now, list[index].time); pop.transform.parent = timeTable.transform; pop.transform.localScale = Vector3.one; runViewList.Add(pop); } timeTable.Reposition(); timeScroll.ResetPosition(); timeTable.repositionNow = true; }