ChatBarChatItem.cs 662 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using System.Collections;
  4. public class ChatBarChatItem : ItemRenderer
  5. {
  6. public Text nameTxt;
  7. public Text contentTxt;
  8. public Text timeTxt;
  9. public override object data {
  10. get {
  11. return base.data;
  12. }
  13. set {
  14. base.data = value;
  15. if(value is Follower)
  16. {
  17. Follower follower = value as Follower;
  18. nameTxt.text = UserCache.GetNick (follower.userId);
  19. contentTxt.text = follower.GetLastMsg ();
  20. timeTxt.text = follower.GetLastMsgTime ();
  21. }
  22. }
  23. }
  24. public void OnClick()
  25. {
  26. if(data is Follower)
  27. {
  28. Follower follower = data as Follower;
  29. ChatPanel.ShowChat (follower.userId);
  30. }
  31. }
  32. }