protected override LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index) { if (index < 0 || index >= DataManger.TotalItemCount) { return(null); } GridItemData itemData = DataManger.GetItemDataByIndex(index); if (itemData == null) { return(null); } LoopListViewItem2 item = listView.NewListViewItem(ItemName); for (int i = 0; i < row; i++) { int itemIndex = index * row + i; UIGameLevelItem itemScript = item.transform.GetChild(i).GetComponent <UIGameLevelItem>(); if (itemIndex >= DataManger.TotalDataCount) { itemScript.gameObject.SetActive(false); continue; } else { itemScript.gameObject.SetActive(true); } itemScript.Init(); m_TransferDataList[itemIndex].ActionOneIntCallBack = CallBack; m_TransferDataList[itemIndex].ObjArray = new object[] { itemScript }; itemScript.SetData(m_TransferDataList[itemIndex]); } return(item); }
private void CallBack(int itemIndex) { if (m_NowItem != null && m_NowItem.Index == itemIndex) { return; } m_GameLevelId = itemIndex + 1; m_GameLevelView.SetData(m_TransferDataList[itemIndex]); m_GameLevelView.BtnChallengeClickCallBack = OnBtnChallengeClick; if (m_NowItem != null) { m_LastItem = m_NowItem; m_LastItem.IsSelect(false); } m_NowItem = m_TransferDataList[itemIndex].ObjArray[0] as UIGameLevelItem; m_NowItem.IsSelect(true); m_Star2Time = m_TransferDataList[itemIndex].GetValue <int>(ConstDefine.Star2Time); m_Star3Time = m_TransferDataList[itemIndex].GetValue <int>(ConstDefine.Star3Time); }