/// <summary> /// 解锁新武学的时候添加一个武学图标 /// </summary> /// <param name="lineIndex">Line index.</param> /// <param name="index">Index.</param> /// <param name="parent">Parent.</param> public void AddItem(int lineIndex, int index, MartialItemListPanel_V2 parent) { MyParent = parent; GameObject item = NGUITools.AddChild(MartialItemPoint[index].gameObject, MartialItemPrefab); MartialItem martialItem = item.GetComponent <MartialItem>(); SingleButtonCallBack btnCB = item.GetComponent <SingleButtonCallBack>(); btnCB.SetCallBackFuntion(OnSelectItemCallback, ParentItemListPanel.MyMartialDataList[lineIndex * 4 + index].dwWuXueID); martialItem.Init(ParentItemListPanel.MyMartialDataList[lineIndex * 4 + index], ParentItemListPanel.ThisParent.GetComponent <QinglongMartialPanel>().OnItemClick); CurrentShowList.Add(martialItem); }
/// <summary> /// 显示初始化 /// </summary> /// <param name="lineIndex">Line index.</param> /// <param name="perLineCount">Per line count.</param> /// <param name="parent">Parent.</param> public void Init(int lineIndex, int perLineCount, MartialItemListPanel_V2 parent) { MyParent = parent; ParentItemListPanel = parent.GetComponent <MartialItemListPanel_V2>(); //LineIndex = lineIndex; for (int i = 0; i < perLineCount; i++) { GameObject item = NGUITools.AddChild(MartialItemPoint[i].gameObject, MartialItemPrefab); MartialItem martialItem = item.GetComponent <MartialItem>(); SingleButtonCallBack btnCB = item.GetComponent <SingleButtonCallBack>(); btnCB.SetCallBackFuntion(OnSelectItemCallback, parent.MyMartialDataList[lineIndex * 4 + i].dwWuXueID); martialItem.Init(parent.MyMartialDataList[lineIndex * 4 + i], parent.ThisParent.GetComponent <QinglongMartialPanel>().OnItemClick); CurrentShowList.Add(martialItem); if (lineIndex * 4 + i == 0) { ParentItemListPanel.ThisParent.GetComponent <QinglongMartialPanel>().OnItemClick(martialItem.MartialID); } } }