Follower.cs 795 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. public class Follower
  5. {
  6. public int userId;
  7. public ChatMsgEvent OnMsgAdded;
  8. private string lastMsg = "";
  9. private System.DateTime dateTime;
  10. public int newMsgCount = 0;
  11. public Follower()
  12. {
  13. OnMsgAdded = new ChatMsgEvent ();
  14. }
  15. public List<ChatMsg> GetMsgList()
  16. {
  17. return ChatManager.GetInstance().GetFollowMsgList(userId);
  18. }
  19. public void AddMsg(ChatMsg chatMsg)
  20. {
  21. lastMsg = chatMsg.content;
  22. dateTime = chatMsg.dateTime;
  23. newMsgCount++;
  24. OnMsgAdded.Invoke (chatMsg);
  25. }
  26. public void ResetMsgCount()
  27. {
  28. newMsgCount = 0;
  29. }
  30. public string GetLastMsg()
  31. {
  32. return lastMsg;
  33. }
  34. public string GetLastMsgTime()
  35. {
  36. if(dateTime == null)
  37. return "";
  38. return dateTime.ToString();
  39. }
  40. }