private void FillTheBookList(List <ItemBoookData> Lst, int col) { int num = col * 6; if (this.oldIndex == num) { return; } for (int i = this._bookItemLst.Count; i < num; i++) { if (Lst != null && i >= Lst.Count) { break; } if (i >= this._bookItemLst.Count) { GameObject gameObject = NGUITools.AddChild(this.BookList.gameObject, this._bottleBookItem.gameObject); gameObject.name = i.ToString(); BottleBookItem component = gameObject.GetComponent <BottleBookItem>(); this._bookItemLst.Add(this._bottleBookItem); gameObject.transform.localPosition = new Vector3((float)(i % 6) * this.itemOffX, (float)(-(float)i / 6) * this.itemOffY, 0f); component.ShowPic(Lst[i]); component.ShowName(Lst[i]._name, Lst[i]._bottleBookType); this.mChildren.Add(gameObject.transform); } } this.oldIndex = num; }
public override void Init() { base.Init(); this.m_Describe = this.transform.Find("Describe").GetComponent <UILabel>(); this.m_Num = this.transform.Find("Num").GetComponent <UILabel>(); this.m_Item = this.transform.Find("BookItems").GetComponent <BottleBookItem>(); this.m_BG = this.transform.Find("BG"); }
public override void Init() { this.BackBtn = this.transform.Find("TopAnchor/BackBtn"); this.m_scrollView = this.transform.Find("Scroll View").GetComponent <UIPanel>(); this.BookList = this.transform.Find("Scroll View/Grid"); this._bottleBookItem = Resources.Load <BottleBookItem>("Prefab/UI/Bottle/BookItems"); UIEventListener.Get(this.BackBtn.gameObject).onClick = new UIEventListener.VoidDelegate(this.CloseBottleBookView); this.m_scrollView.onClipMove = new UIPanel.OnClippingMoved(this.OnClipMove); }