void OnLoadShouHuaItem(GameObject resItem) { if (null == resItem) { LogModule.ErrorLog("load LoverRankInfoItem fail"); return; } Utils.CleanGrid(ReceiveRoseRankGrid); int iCurCount = 0; foreach (PVPData.RankDataItem data in PVPData.RankDataList) { if (iCurCount < m_rankCount) { LoverRankInfoItem RankListItem = LoverRankInfoItem.CreateItem(ReceiveRoseRankGrid, resItem, iCurCount + 1, data.str1, data.str2, this); //LoverRankInfoItem RankListItem = LoverRankInfoItem.CreateItem(data.m_Guid,data.str1, data.str2, data.str3); iCurCount++; } } ReceiveRoseRankGrid.GetComponent <UIGrid>().Reposition(); }
public static LoverRankInfoItem CreateItem(GameObject grid, GameObject resItem, int count, string name, string num, LoverFlowerWindow parentWindow) { GameObject curItem = Utils.BindObjToParent(resItem, grid); if (null == curItem) { LogModule.ErrorLog("CreateItem, curItem error!"); } curItem.name = count.ToString(); LoverRankInfoItem curItemComponent = curItem.GetComponent <LoverRankInfoItem>(); if (null == curItemComponent) { LogModule.ErrorLog("relation list item error!"); ResourceManager.DestroyResource(ref curItem); return(null); } curItemComponent.SetData(parentWindow, count, name, num); return(curItemComponent); }