void FindFriendOk(COM_ContactInfo req) { GameObject objCell = null; if (_findFriendCellList.Count > 0) { foreach (GameObject i in _findFriendCellList) { recomGrid.RemoveChild(i.transform); i.gameObject.transform.parent = null; i.gameObject.SetActive(false); _findFriendCellPool.Add(i); } _findFriendCellList.Clear(); } if (_findFriendCellPool.Count > 0) { objCell = _findFriendCellPool[0]; objCell.SetActive(true); FriendRecommendCell cellUI = objCell.GetComponent <FriendRecommendCell>(); _findFriendCellPool.Remove(objCell); } else { objCell = Object.Instantiate(recomCell.gameObject) as GameObject; objCell.SetActive(true); } if (objCell != null) { FriendRecommendCell cellUI1 = objCell.GetComponent <FriendRecommendCell>(); cellUI1.ContactInfo = req; cellUI1.level_.text = req.level_.ToString(); //cellUI1.icon.spriteName = req if (findPane.gameObject.activeSelf) { recomGrid.AddChild(objCell.transform); objCell.transform.parent = recomGrid.transform; cellUI1.callBack = OnAddFriendList; recomGrid.gameObject.SetActive(false); recomGrid.gameObject.SetActive(true); recomGrid.repositionNow = true; } else if (blackPane.gameObject.activeSelf) { findBlackGrid.AddChild(objCell.transform); objCell.transform.parent = findBlackGrid.transform; cellUI1.callBack = OnAddBlackList; findBlackGrid.gameObject.SetActive(false); findBlackGrid.gameObject.SetActive(true); findBlackGrid.repositionNow = true; } objCell.transform.localScale = Vector3.one; _findFriendCellList.Add(objCell); } }
void OnRecommendEvent(int id) { if (_findFriendCellList.Count > 0) { foreach (GameObject i in _findFriendCellList) { recomGrid.RemoveChild(i.transform); i.gameObject.transform.parent = null; i.gameObject.SetActive(false); _findFriendCellPool.Add(i); } _findFriendCellList.Clear(); } COM_ContactInfo[] rcmfriends = FriendSystem.Instance().RecommendFriends; foreach (COM_ContactInfo req in rcmfriends) { GameObject objCell = null; if (_findFriendCellPool.Count > 0) { objCell = _findFriendCellPool[0]; //objCell.SetActive(true); FriendRecommendCell cellUI = objCell.GetComponent <FriendRecommendCell>(); _findFriendCellPool.Remove(objCell); } else { objCell = Object.Instantiate(recomCell.gameObject) as GameObject; } if (objCell != null) { FriendRecommendCell cellUI1 = objCell.GetComponent <FriendRecommendCell>(); cellUI1.ContactInfo = req; cellUI1.level_.text = req.level_.ToString(); //cellUI1.icon.spriteName = req //recomGrid.AddChild(objCell.transform); objCell.transform.parent = recomGrid.transform; objCell.SetActive(true); cellUI1.callBack = OnAddFriendList; objCell.transform.localScale = Vector3.one; _findFriendCellList.Add(objCell); } } recomGrid.Reposition(); }