/// <summary> /// 填充聊天记录 /// </summary> void FillInfo(ChatInfo _info) { //List<ChatInfo> infoList = GameCenter.chatMng.GetInfoList((int)ChatInfo.Type.All); //int chatCount = infoList.Count; //HideAllUI(); //if (chatCount < 1) // return; //if (!infoList[chatCount - 1].isVoice) //{ // chatContentUI.gameObject.SetActive(chatCount > 0); // chatContentUI.ShowContent(infoList[chatCount - 1]); //} //List<ChatInfo> infoList = GameCenter.chatMng.GetInfoList((int)ChatInfo.Type.All); //int chatCount = infoList.Count; //HideAllUI();//点击打开界面的时候,不隐藏此条信息 if (_info == null) { return; } if (!_info.isVoice && _info.chatTypeID != (int)ChatInfo.Type.Private) { chatContentUI.gameObject.SetActive(true); chatContentUI.ShowContent(_info); } }
/// <summary> /// 有新的聊天记录更新聊天内容 /// </summary> void ShowChatContent(ChatInfo _info) { ChatInfo.Type curChatType = GameCenter.chatMng.CurChatType; List <ChatInfo> infoList = GameCenter.chatMng.GetInfoList((int)curChatType); int chatCount = infoList.Count; int type = 1; if (chatUIList.Count < chatCount) { switch (_info.chatTypeID) { //case 5: type = 5; break; case 1: case 2: case 3: case 4: if (_info.senderID != GameCenter.mainPlayerMng.MainPlayerInfo.ServerInstanceID) { type = 4; } else { type = 2; } break; default: break; } ChatContentUI chatUI = InstantiateChatContentUI(type); if (type == 2 || type == 3 || type == 4) { chatUI.ShowPrivateContent(_info); } else { chatUI.ShowContent(_info); } chatUIList.Add(chatUI); } else { if (type != 4 && type != 3 && type != 2 && type != 1) { chatUIList[chatCount - 1].ShowContent(_info);// } else { chatUIList[chatCount - 1].ShowPrivateContent(_info); } chatUIList[chatCount - 1].gameObject.SetActive(true); } if (chatUIList.Count > 1) { AddNewChatContentUI(chatUIList.Count - 2); } // chatContentUIParent.Reposition(); view.ResetPosition(); if (view.shouldMoveVertically) { view.SetDragAmount(0.01f, 1.0f, false); } //BoxCollider box = chatContentUIParent.GetComponent<BoxCollider>(); //if (box != null) //{ // box.enabled = infoList.Count >= 5; // box.size = new Vector3(box.size.x, (float)83 * infoList.Count, box.size.z); // box.center = new Vector3(box.center.x, -41.5f * (infoList.Count - 1), box.center.z); //} }