private void CacheChat() { InitPrefab(); m_fTotalHeight = 0; m_scrollview_ChatScrollView.ResetPosition(); int childNum = m_trans_ChatItemRoot.childCount; while (childNum > 0) { SingleChatItem item = m_trans_ChatItemRoot.GetChild(0).GetComponent <SingleChatItem>(); if (item != null) { m_lstChatItem.Add(item); item.Clear(); item.transform.parent = transform; item.gameObject.SetActive(false); item.name = "cacheItem" + childNum.ToString(); //Log.LogGroup(GameDefine.LogGroup.User_ZCX, "CacheObjs: " + item.name); } else { //查找好友的对象列表 Transform t = m_trans_ChatItemRoot.GetChild(0); t.parent = transform; GameObject.Destroy(t.gameObject); } childNum = m_trans_ChatItemRoot.childCount; } }
private void CacheChatItemObjs() { Log.LogGroup(GameDefine.LogGroup.User_ZCX, "CacheObjs: " + m_trans_chatroot.childCount); int childNum = m_trans_chatroot.childCount; while (childNum > 0) { SingleChatItem item = m_trans_chatroot.GetChild(0).GetComponent <SingleChatItem>(); if (item != null) { m_lstChatItem.Add(item); item.Clear(); item.transform.parent = transform; item.gameObject.SetActive(false); item.name = "cacheItem" + childNum.ToString(); //Log.LogGroup(GameDefine.LogGroup.User_ZCX, "CacheObjs: " + item.name); } else { //查找好友的对象列表 Transform t = m_trans_chatroot.GetChild(0); t.parent = transform; GameObject.Destroy(t.gameObject); } childNum = m_trans_chatroot.childCount; } }