ChatDataManager.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System.Collections.Generic;
  2. using ET;
  3. using UnityEngine;
  4. namespace GFGGame
  5. {
  6. public class ChatDataManager : SingletonBase<ChatDataManager>
  7. {
  8. public Dictionary<int, List<ChatData>> ChatDatas = new Dictionary<int, List<ChatData>>();//int:ChatType
  9. public Dictionary<long, List<ChatData>> PrivateChatDatas = new Dictionary<long, List<ChatData>>();//int:RoleId
  10. public void Clear()
  11. {
  12. ChatDatas.Clear();
  13. PrivateChatDatas.Clear();
  14. }
  15. public List<ChatData> GetChatDatas(long type)
  16. {
  17. if (type == ChatType.Private)
  18. {
  19. if (!PrivateChatDatas.ContainsKey(type))
  20. {
  21. PrivateChatDatas[type] = new List<ChatData>();
  22. }
  23. return PrivateChatDatas[type];
  24. }
  25. else
  26. {
  27. if (!ChatDatas.ContainsKey((int)type))
  28. {
  29. ChatDatas[(int)type] = new List<ChatData>();
  30. }
  31. return ChatDatas[(int)type];
  32. }
  33. }
  34. }
  35. }