| | |
| | | using System.Collections; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using EnhancedUI.EnhancedScroller; |
| | | public class ChatPlayerMineCell : ScrollerUI |
| | | public class ChatPlayerMineCell : MonoBehaviour |
| | | { |
| | | // [SerializeField] AvatarCell avatarCell; |
| | | [SerializeField] AvatarCell avatarCell; |
| | | [SerializeField] RectTransform m_avatarRect; |
| | | [SerializeField] Text m_VipLv; |
| | | [SerializeField] OfficialTitleCell title; |
| | | [SerializeField] Text m_PlayerName; |
| | | [SerializeField] Text m_ChatTime; |
| | | [SerializeField] ChatBubbleBehaviour m_ChatBubble; |
| | | [SerializeField] float spacing = 5.0f; |
| | | |
| | | // PhantasmPavilionModel phantasmPavilionModel { get { return ModelCenter.Instance.GetModel<PhantasmPavilionModel>(); } } |
| | | public override void Refresh(CellView cell) |
| | | ChatManager manager { get { return ChatManager.Instance; } } |
| | | public void Refresh(CellView cell) |
| | | { |
| | | ChatData data = ChatCenter.Instance.GetChatData(ChatManager.Instance.presentChatType, cell.index); |
| | | if (data == null) |
| | | { |
| | | if (!manager.TryGetChatData(ChatManager.Instance.nowChatChannel, cell.index, out TalkData data)) |
| | | return; |
| | | } |
| | | var chatUserData = data as ChatUeseData; |
| | | |
| | | m_ChatBubble.DisplayContent(data.content); |
| | | m_ChatBubble.DisplayContent(data.Content); |
| | | |
| | | // TODO YYL |
| | | // int bubbleID = phantasmPavilionModel.GetNowChatBubbleID(); |
| | | // m_ChatBubble.DisplayBubble(bubbleID); |
| | | int bubbleID = ChatBubbleHelper.GetMyChatBubbleID(); |
| | | m_ChatBubble.DisplayBubble(bubbleID, (int)PlayerDatas.Instance.baseData.PlayerID); |
| | | |
| | | // avatarCell.InitUI(AvatarHelper.GetMyAvatarModel()); |
| | | // avatarCell.button.SetListener(() => |
| | | // { |
| | | // OnFunc(cell); |
| | | // }); |
| | | |
| | | m_PlayerName.text = chatUserData.name; |
| | | m_ChatTime.text = data.createTime.ToString("yyyy-MM-dd HH:mm"); |
| | | if (chatUserData.vipLv > 0) |
| | | avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)PlayerDatas.Instance.baseData.PlayerID, |
| | | PlayerDatas.Instance.baseData.face, |
| | | PlayerDatas.Instance.baseData.facePic)); |
| | | avatarCell.button.SetListener(() => |
| | | { |
| | | m_VipLv.text = "VIP";//string.Format("V{0}", chatUserData.vipLv); |
| | | |
| | | }); |
| | | |
| | | title.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID); |
| | | if (manager.nowChatTab == ChatTab.World) |
| | | { |
| | | string serverName = ServerListCenter.Instance.GetServerName(UIHelper.GetServerIDByAccount(PlayerDatas.Instance.baseData.AccID)); |
| | | m_PlayerName.text = Language.Get("Chat08", serverName, PlayerDatas.Instance.baseData.PlayerName); |
| | | } |
| | | else |
| | | { |
| | | m_VipLv.text = string.Empty; |
| | | int fmlv = PlayerDatas.Instance.fairyData.mine.FmLV; |
| | | m_PlayerName.text = Language.Get("Chat08", RichTextMsgReplaceConfig.GetRichReplace("FAMILY", fmlv), PlayerDatas.Instance.baseData.PlayerName); |
| | | } |
| | | } |
| | | |
| | | private void OnFunc(CellView cell) |
| | | { |
| | | int index = cell.index; |
| | | ChatData _data = ChatCenter.Instance.GetChatData(ChatManager.Instance.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) |