public override void Awake() { base.Awake(); childDatas = new ChildData[NewBookView.columns]; for (int i = 0; i < NewBookView.columns; i++) { Transform child = transform.GetChild(i); childDatas[i] = new ChildData(child); } //Main.Logger.Log("WarehouseItem Awake " + childDatas.Length); }
private void SetCell(ItemCell itemCell, int index) { BookCell item = itemCell as BookCell; if (item == null) { Main.Logger.Log("WarehouseItem出错。。。"); return; } ChildData[] childDatas = item.childDatas; for (int i = 0; i < columns; i++) { int idx = (index - 1) * columns + i; if (i < childDatas.Length) { ChildData childData = childDatas[i]; if (idx < data.Length) { int bookId = data[idx]; GameObject go = childData.gameObject; if (!go.activeSelf) { go.SetActive(true); } childData.setBook.SetBookId(bookId); } else { GameObject go = childData.gameObject; if (go.activeSelf) { go.SetActive(false); } } } else { Main.Logger.Log("数据出错。。。"); } } }