| | |
| | | using System.Collections; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using EnhancedUI.EnhancedScroller; |
| | | |
| | | public class ChatPlayerOtherCell : ScrollerUI |
| | | public class ChatPlayerOtherCell : 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) |
| | | { |
| | | var 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; |
| | | |
| | | |
| | | // AvatarModel avatarModel = AvatarHelper.GetOtherAvatarModel(chatUserData.face, chatUserData.facePic, chatUserData.job); |
| | | // avatarCell.InitUI(avatarModel); |
| | | // 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)data.PlayerID, (int)data.Face, (int)data.PlayerID, data.Job)); |
| | | avatarCell.button.SetListener(() => |
| | | { |
| | | m_VipLv.text = "VIP";//string.Format("V{0}", chatUserData.vipLv); |
| | | |
| | | }); |
| | | title.InitUI(data.RealmLV, (int)data.TitleID); |
| | | |
| | | |
| | | |
| | | m_ChatBubble.DisplayContent(data.Content, true); |
| | | |
| | | int bubbleID = ChatBubbleHelper.GetOtherChatBubbleID(data.Job, (int)data.BubbleBox); |
| | | m_ChatBubble.DisplayBubble(bubbleID, (int)data.PlayerID); |
| | | |
| | | if (manager.nowChatTab == ChatTab.World) |
| | | { |
| | | string serverName = ServerListCenter.Instance.GetServerName((int)data.ServerID); |
| | | m_PlayerName.text = Language.Get("Chat08", serverName, data.Name); |
| | | } |
| | | else |
| | | { |
| | | m_VipLv.text = string.Empty; |
| | | } |
| | | m_ChatBubble.DisplayContent(data.content, true); |
| | | // int bubbleID = phantasmPavilionModel.GetNowOtherChatBubbleID(chatUserData.bubbleId); |
| | | // m_ChatBubble.DisplayBubble(bubbleID); |
| | | } |
| | | |
| | | private void OnFunc(CellView cell) |
| | | FairyMember fairyMember = PlayerDatas.Instance.fairyData.GetMember((int)data.PlayerID); |
| | | int fmlv = 0; |
| | | if (fairyMember != null) |
| | | { |
| | | int index = cell.index; |
| | | ChatData _data = ChatCenter.Instance.GetChatData(ChatManager.Instance.presentChatType, index); |
| | | if (_data == null) |
| | | { |
| | | return; |
| | | fmlv = fairyMember.FmLV; |
| | | } |
| | | ChatUeseData user = _data as ChatUeseData; |
| | | if (user.player == PlayerDatas.Instance.baseData.PlayerID) |
| | | { |
| | | return; |
| | | } |
| | | if (user.serverGroupId == 0 || user.serverGroupId == PlayerDatas.Instance.baseData.ServerGroupId) |
| | | { |
| | | // TODO YYL |
| | | // PlayerDetails.ShowPlayerDetails(user.player, null); |
| | | } |
| | | else |
| | | { |
| | | // TODO YYL |
| | | // PlayerDetails.ShowCrossServerChatPlayer(user); |
| | | m_PlayerName.text = Language.Get("Chat08", RichTextMsgReplaceConfig.GetRichReplace("FAMILY", fmlv), data.Name); |
| | | } |
| | | } |
| | | |