| using vnxbqy.UI;  | 
| using System.Collections;  | 
| using System.Collections.Generic;  | 
| using UnityEngine;  | 
| using UnityEngine.UI;  | 
|   | 
| namespace EnhancedUI.EnhancedScroller  | 
| {  | 
|     public class ChatMineVoiceCell : ScrollerUI  | 
|     {  | 
|         [SerializeField] AvatarCell avatarCell; | 
|         [SerializeField] RectTransform m_avatarRect;  | 
|         [SerializeField] Text m_VoiceTimes;  | 
|         [SerializeField] Button m_Voice;  | 
|         [SerializeField] ChatBubbleBehaviour m_ChatBubble;  | 
|         [SerializeField] Text m_VipLevel;  | 
|         [SerializeField] Text m_PlayerName;  | 
|         [SerializeField] Text m_ChatTime;  | 
|         [SerializeField] float spacing = 15.0f;  | 
|         ChatCenter m_ChatCenter;  | 
|         ChatCenter chatCenter  | 
|         {  | 
|             get  | 
|             {  | 
|                 return m_ChatCenter ?? (m_ChatCenter = ModelCenter.Instance.GetModel<ChatCenter>());  | 
|             }  | 
|         }  | 
|         PhantasmPavilionModel phantasmPavilionModel { get { return ModelCenter.Instance.GetModel<PhantasmPavilionModel>(); } }  | 
|   | 
|         public override void Refresh(CellView cell)  | 
|         {  | 
|             ChatUeseData _data = chatCenter.GetChatData(ChatCtrl.Inst.presentChatType, cell.index) as ChatUeseData;  | 
|             if (_data == null)  | 
|             {  | 
|                 return;  | 
|             }  | 
|             m_ChatBubble.DisplayContent(_data.content);  | 
|             int bubbleID = phantasmPavilionModel.GetNowChatBubbleID();  | 
|             m_ChatBubble.DisplayBubble(bubbleID);  | 
|   | 
|             avatarCell.InitUI(AvatarHelper.GetMyAvatarModel());  | 
|   | 
|             m_PlayerName.text = _data.name;  | 
|             m_ChatTime.text = _data.createTime.ToString("dd-MM-yyyy HH:mm"); | 
|             if (_data.vipLv > 0)  | 
|             {  | 
|                 m_VipLevel.text = "VIP";//string.Format("V{0}", _data.vipLv);  | 
|             }  | 
|             else  | 
|             {  | 
|                 m_VipLevel.text = string.Empty;  | 
|             }  | 
|             m_Voice.onClick.RemoveAllListeners();  | 
|             m_VoiceTimes.text = _data.soundLength.ToString("0.0");  | 
|             m_Voice.onClick.AddListener(() =>  | 
|             {  | 
|                 OnVoiceClick(_data, Mathf.Min(8.0f, _data.soundLength));  | 
|             });  | 
|         }  | 
|   | 
|         private void OnVoiceClick(ChatUeseData _chat, float _length)  | 
|         {  | 
|             if (_chat != null)  | 
|             {  | 
|                 chatCenter.PlaySpeech(_chat.player, _chat.soundTick, _length);  | 
|             }  | 
|         }  | 
|   | 
|         public float GetHeight(string content, ArrayList list)  | 
|         {  | 
|             var minHeight = m_avatarRect.sizeDelta.y;  | 
|             var chatHeight = m_ChatBubble.GetBubbleHeight(content, list) + Mathf.Abs(m_ChatBubble.transform.localPosition.y);  | 
|             if (string.IsNullOrEmpty(content))  | 
|             {  | 
|                 chatHeight = 0;  | 
|             }  | 
|             return (chatHeight > minHeight ? chatHeight : minHeight) + spacing;  | 
|         }  | 
|     }  | 
| }  | 
|   |