public void Dispose() { for (int i = 0; i < m_itemList.Count; i++) { ScaleScrollItemBase ssi = m_itemList[i].GetComponent <ScaleScrollItemBase>(); ssi.Dispose(); GameObjectManager.DestroyGameObjectByPool(m_itemList[i]); } m_itemList.Clear(); }
public void SetData(string itemName, List <Dictionary <string, object> > dataList) { for (int i = 0; i < dataList.Count; i++) { GameObject item = GameObjectManager.CreateGameObjectByPool(itemName, m_rect.gameObject); m_itemList.Add(item); //设置数据 ScaleScrollItemBase ssi = item.GetComponent <ScaleScrollItemBase>(); ssi.Init(i); ssi.SetData(dataList[i]); //调整位置 item.transform.localPosition = new Vector3(i * m_itemSpace, 0, 0); } }