void InitItems() { UIItemShow itemShow = null; m_trans_itemRoot.parent.GetComponent <UIScrollView>().ResetPosition(); m_trans_itemRoot.DestroyChildren(); for (int i = 0; i < 5; i++) { itemShow = GetItem(); itemShow.transform.localPosition = new UnityEngine.Vector3(i * 90, 0, 0); } }
private void OnGridDataUpdate(UIGridBase gridData, int index) { if (m_lstRewardItemInfo != null && m_lstRewardItemInfo.Count > index) { UIItemShow grid = gridData as UIItemShow; if (gridData == null) { return; } grid.SetGridData(m_lstRewardItemInfo[index]); } }
UIItemShow GetItem() { UnityEngine.Object obj = UIManager.GetResGameObj(GridID.Uiitemshow); if (obj == null) { return(null); } GameObject go = NGUITools.AddChild(m_trans_itemRoot.gameObject, obj as GameObject); UIItemShow itemShow = go.AddComponent <UIItemShow>(); itemShow.gameObject.SetActive(false); m_lstItem.Add(itemShow); return(itemShow); }