using UnityEngine; using System.Collections; using System.Collections.Generic; public class ChatFollow { public int userId; private List list; public ChatFollow() { list = new List (); } 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 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 ""; } }