using vnxbqy.UI;
|
using System.Collections;
|
using UnityEngine;
|
using UnityEngine.UI;
|
namespace EnhancedUI.EnhancedScroller
|
{
|
public class ChatPlayerMineCell : ScrollerUI
|
{
|
[SerializeField] AvatarCell avatarCell;
|
[SerializeField] RectTransform m_avatarRect;
|
[SerializeField] Text m_VipLv;
|
[SerializeField] Text m_PlayerName;
|
[SerializeField] Text m_ChatTime;
|
[SerializeField] ChatBubbleBehaviour m_ChatBubble;
|
[SerializeField] float spacing = 5.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)
|
{
|
ChatData data = chatCenter.GetChatData(ChatCtrl.Inst.presentChatType, cell.index);
|
if (data == null)
|
{
|
return;
|
}
|
var chatUserData = data as ChatUeseData;
|
|
m_ChatBubble.DisplayContent(data.content);
|
int bubbleID = phantasmPavilionModel.GetNowChatBubbleID();
|
m_ChatBubble.DisplayBubble(bubbleID);
|
|
avatarCell.InitUI(AvatarHelper.GetMyAvatarModel());
|
avatarCell.button.SetListener(() =>
|
{
|
OnFunc(cell);
|
});
|
|
m_PlayerName.text = chatUserData.name;
|
m_ChatTime.text = data.createTime.ToString("dd-MM-yyyy HH:mm");
|
if (chatUserData.vipLv > 0)
|
{
|
m_VipLv.text = "VIP";//string.Format("V{0}", chatUserData.vipLv);
|
}
|
else
|
{
|
m_VipLv.text = string.Empty;
|
}
|
}
|
|
private void OnFunc(CellView cell)
|
{
|
int index = cell.index;
|
ChatData _data = chatCenter.GetChatData(ChatCtrl.Inst.presentChatType, index);
|
if (_data == null)
|
{
|
return;
|
}
|
ChatUeseData user = _data as ChatUeseData;
|
if (user.player == PlayerDatas.Instance.baseData.PlayerID)
|
{
|
return;
|
}
|
HrefAnalysis.Inst.ExcuteHrefEvent(string.Format("<a>showplayer={0}</a>", user.player));
|
}
|
|
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);
|
return (chatHeight > minHeight ? chatHeight : minHeight) + spacing;
|
}
|
}
|
}
|