123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using UnityEngine;
- using UnityEngine.UI;
- using System.Collections;
- public class ChatBarItem : ItemRenderer
- {
- public Text nameTxt;
- public Text contentTxt;
- public Text timeTxt;
- void Awake()
- {
-
- }
- public override object data {
- get {
- return base.data;
- }
- set {
- base.data = value;
- if(value is ChatMsg)
- {
- ChatMsg chatMsg = value as ChatMsg;
- nameTxt.text = UserCache.GetNick (chatMsg.sender);
- contentTxt.text = chatMsg.content;
- timeTxt.text = chatMsg.dateTime.ToString ();
- }
- else if(value is Follower)
- {
- Follower follower = value as Follower;
- nameTxt.text = UserCache.GetNick (follower.userId);
- contentTxt.text = follower.GetLastMsg ();
- timeTxt.text = follower.GetLastMsgTime ();
- }
- }
- }
- public void OnClick()
- {
- if (data == null)
- return;
- if(data is Follower)
- {
- Follower follower = data as Follower;
- ChatPanel.ShowChat (follower.userId);
- }
- }
- }
|