| | |
| | | { |
| | | public class ChatPlayerMineCell : ScrollerUI |
| | | { |
| | | [SerializeField] Image chatIcon; |
| | | [SerializeField] Text vipText; |
| | | [SerializeField] Text playerNameText; |
| | | [SerializeField] RichText chatText; |
| | | [SerializeField] Image m_ChatIcon; |
| | | [SerializeField] Text m_VipLv; |
| | | [SerializeField] Text m_PlayerName; |
| | | [SerializeField] Text m_ChatTime; |
| | | [SerializeField] RichText m_Chat; |
| | | [SerializeField] ImageFitterText m_Fitter; |
| | | [SerializeField] Button m_Func; |
| | | |
| | | ChatCenter m_ChatCenter; |
| | | ChatCenter chatCenter |
| | |
| | | } |
| | | public override void Refresh(CellView cell) |
| | | { |
| | | ChatData _data = chatCenter.GetChatData(ChatCtrl.Inst.presentChatType, cell.index); |
| | | if (_data == null) |
| | | ChatData data = chatCenter.GetChatData(ChatCtrl.Inst.presentChatType, cell.index); |
| | | if (data == null) |
| | | { |
| | | return; |
| | | } |
| | | }
|
| | | var chatUserData = data as ChatUeseData; |
| | | |
| | | #region 更新高度 |
| | | chatText.AutoNewLine = false; |
| | | chatText.text = _data.content; |
| | | m_Chat.AutoNewLine = false; |
| | | m_Chat.text = data.content; |
| | | if (type == ScrollerDataType.Header) |
| | | { |
| | | if (chatText.preferredWidth > chatText.rectTransform.rect.width) |
| | | if (m_Chat.preferredWidth > m_Chat.rectTransform.rect.width) |
| | | { |
| | | chatText.alignment = TextAnchor.UpperLeft; |
| | | m_Chat.alignment = TextAnchor.UpperLeft; |
| | | } |
| | | else |
| | | { |
| | | chatText.alignment = TextAnchor.UpperRight; |
| | | m_Chat.alignment = TextAnchor.UpperRight; |
| | | } |
| | | m_Fitter.FiterRealTxtWidth = chatText.alignment == TextAnchor.UpperRight; |
| | | m_Fitter.FiterRealTxtWidth = m_Chat.alignment == TextAnchor.UpperRight; |
| | | } |
| | | chatText.AutoNewLine = true; |
| | | chatIcon.SetSprite(GeneralDefine.GetJobHeadPortrait((_data as ChatUeseData).job, 0)); |
| | | m_Chat.AutoNewLine = true; |
| | | m_ChatIcon.SetSprite(GeneralDefine.GetJobHeadPortrait(chatUserData.job, 0)); |
| | | #endregion |
| | | Button headBtn = chatIcon.GetComponent<Button>(); |
| | | headBtn.onClick.RemoveAllListeners(); |
| | | headBtn.onClick.AddListener(() => |
| | | |
| | | m_Func.onClick.RemoveAllListeners(); |
| | | m_Func.onClick.AddListener(() => |
| | | { |
| | | OnHeadIconClick(cell); |
| | | OnFunc(cell); |
| | | }); |
| | | playerNameText.text = (_data as ChatUeseData).name; |
| | | if ((_data as ChatUeseData).vipLv > 0) |
| | | m_PlayerName.text = chatUserData.name;
|
| | | m_ChatTime.text = data.createTime.ToString("yyyy-MM-dd HH:mm"); |
| | | if (chatUserData.vipLv > 0) |
| | | { |
| | | vipText.text = string.Format("V{0}", (_data as ChatUeseData).vipLv); |
| | | m_VipLv.text = string.Format("V{0}", chatUserData.vipLv); |
| | | } |
| | | else |
| | | { |
| | | vipText.text = string.Empty; |
| | | m_VipLv.text = string.Empty; |
| | | } |
| | | } |
| | | |
| | | private void OnHeadIconClick(CellView cell) |
| | | private void OnFunc(CellView cell) |
| | | { |
| | | int index = cell.index; |
| | | ChatData _data = chatCenter.GetChatData(ChatCtrl.Inst.presentChatType, index); |
| | |
| | | return; |
| | | } |
| | | ChatUeseData user = _data as ChatUeseData; |
| | | if (user.player == PlayerDatas.Instance.baseData.PlayerID) return; |
| | | if (user.player == PlayerDatas.Instance.baseData.PlayerID)
|
| | | {
|
| | | return;
|
| | | } |
| | | HrefAnalysis.Inst.ExcuteHrefEvent(string.Format("showplayer={0}", user.player)); |
| | | } |
| | | } |