123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- public class ChatFollow
- {
- public int userId;
- private List<ChatMsg> list;
- public ChatFollow()
- {
- list = new List<ChatMsg> ();
- }
- public void AddMsg(ChatMsg chatMsg)
- {
- list.Add (chatMsg);
- while(list.Count > ChatManager.MAX_FOLLOW)
- {
- list.RemoveAt (0);
- }
- Follower follower = null;
- if(chatMsg.receiver == Session.GetInstance().myUserData.id)
- follower = FollowManager.GetInstance().GetFollower(chatMsg.sender);
- else
- follower = FollowManager.GetInstance().GetFollower(chatMsg.receiver);
- if (follower == null)
- return;
- follower.AddMsg (chatMsg);
- }
- public List<ChatMsg> GetChatList()
- {
- return list;
- }
- public string GetLastMsg()
- {
- if(list.Count > 0)
- {
- return list [list.Count - 1].content;
- }
- return "";
- }
- public string GetLastMsgTime()
- {
- if(list.Count > 0)
- {
- return list [list.Count - 1].GetTimeStr();
- }
- return "";
- }
- }
|