public override void Show(ChatLog chatLog)
        {
            base.Show(chatLog);

            // Set GroupItem  //
            GroupItem groupItem = GlobalGroup.GetInstance().GetGroup(chatLog.chatID);
            if (groupItem != null)
            {
                if (_labelUserName)
                {
                    _labelUserName.text = groupItem.groupName;
                }
            }

            if (_imageHead != null)
            {
                int headCount = groupItem.memberUserId.Count > 9 ? 9 : groupItem.memberUserId.Count;
                UIManager.GetInstance().RefreshChildren(_imageHead.gameObject, EUIType.GroupMemberHeadIcon, headCount);

                for (int i = 0; i < headCount; i++)
                {
                    string userID = groupItem.memberUserId[i];
                    UserItem userItem = GlobalGroup.GetInstance().GetGroupMember(userID);
                    if (userItem == null)
                    {
                        userItem = new UserItem();
                    }

                    GameObject go = _imageHead.transform.GetChild(i).gameObject;
                    go.GetComponent<GroupMemberFrame>().Show(userItem);
                }
            }
        }
 private void ResetChtFrame(int index, ChatLog chatLog)
 {
     if (chatLog.targetType != _chatFrameList[index].GetTargetType())
     {
         int siblingIndex = _chatFrameList[index].transform.GetSiblingIndex();
         GameObject.Destroy(_chatFrameList[index].gameObject);
         GameObject newGo = AddChatFrame(chatLog);
         _chatFrameList[index] = newGo.GetComponent<ChatFrame>();
         newGo.transform.SetSiblingIndex(siblingIndex);
     }
 }
        private GameObject AddChatFrame(ChatLog chatLog)
        {
            if (chatLog.targetType == ChatDataItem.TargetType.INDIVIDUAL)
            {
                return UIManager.GetInstance().AddChild(_chatGrid.gameObject, EUIType.ChatFrame);

            }
            else
            {
                return UIManager.GetInstance().AddChild(_chatGrid.gameObject, EUIType.GroupChatFrame);
            }
        }
        public virtual void Show(ChatLog chatLog)
        {
            _chatLog = chatLog;

            // Set UserItem //

            UserItem userItem = GlobalContacts.GetInstance().GetUserItemById(chatLog.chatID);
            if (userItem != null && chatLog.targetType == ChatDataItem.TargetType.INDIVIDUAL)
            {
                if (_imageHead)
                {
                    UIManager.GetInstance().SetImage(_imageHead, EAtlasName.Head, "00" + userItem.headIndex);                    
                }

                if (_labelUserName)
                {
                    _labelUserName.text = userItem.userName;                    
                }
            }


            // Set ChatItem //
            if (_labelLastChat)
            {
                _labelLastChat.text = "";
                ChatDataItem lastChat = GlobalChat.GetInstance().GetLastChat(chatLog.chatID);
                if (lastChat != null)
                {
                    if (lastChat.chatType == ChatDataItem.ChatType.TEXT)
                    {
                        _labelLastChat.text = lastChat.chatBody;
                    }
                    else if (lastChat.chatType == ChatDataItem.ChatType.IMAGE)
                    {
                        _labelLastChat.text = "[表情]";
                    }
                }                
            }

            if (_labelDate)
            {
                _labelDate.text = DateFormatTool.GetChatFrameTimeStr(_chatLog.date);          
            }

            if (_imageUnRead)
            {
                int num = GlobalChat.GetInstance().GetUnReadNum(_chatLog.chatID);
                num = (num > 99) ? 99 : num;
                _imageUnRead.gameObject.SetActive(num != 0);
                _labelUnReadNum.text = num.ToString();
            }
        }
        public override void OnShow(object param = null)
        {
            base.OnShow(param);

            if (param != null)
            {
                _chatLog = param as ChatLog;
            }

            RefreshChatLog();

            MessageDispatcher.GetInstance().RegisterMessageHandler((uint)EUIMessage.UPDATE_RECEIVE_CHAT, OnUpdateReceiveChat);
            MessageDispatcher.GetInstance().RegisterMessageHandler((uint)EUIMessage.UPDATE_SEND_CHAT, OnUpdateSendChat);
            MessageDispatcher.GetInstance().RegisterMessageHandler((uint)EUIMessage.DELETE_CHAT_ITEM, OnDeleteChatItem);
        }