NoticeSProxy.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using System;
  2. using System.Collections.Generic;
  3. using ET;
  4. using GFGGame;
  5. namespace ET
  6. {
  7. public class NoticeSystemNoticeChanged : AMHandler<M2C_SystemNoticeChanged>
  8. {
  9. protected override async ETTask Run(Session session, M2C_SystemNoticeChanged response)
  10. {
  11. NoticeInfo noticeInfo = new NoticeInfo();
  12. noticeInfo.noticeId = response.Notice.NoticeId;
  13. noticeInfo.title = response.Notice.Title;
  14. noticeInfo.time = response.Notice.TimeSec;
  15. noticeInfo.readStatus = response.Notice.ReadStatus;
  16. noticeInfo.content = "";
  17. NoticeDataManager.Instance.UpdateNoticeIdList(noticeInfo);
  18. await ETTask.CompletedTask;
  19. }
  20. }
  21. public class NoticeSystemNoticeRemove : AMHandler<M2C_SystemNoticeRemoved>
  22. {
  23. protected override async ETTask Run(Session session, M2C_SystemNoticeRemoved response)
  24. {
  25. NoticeDataManager.Instance.UpdateSystemNoticeRemove(response.NoticeId);
  26. await ETTask.CompletedTask;
  27. }
  28. }
  29. }
  30. namespace GFGGame
  31. {
  32. public static class NoticeSProxy
  33. {
  34. public static async ETTask<bool> ReqSystemNoticeList()
  35. {
  36. M2C_GetSystemNoticeList response = null;
  37. response = (M2C_GetSystemNoticeList)await MessageHelper.SendToServer(new C2M_GetSystemNoticeList());
  38. if (response != null)
  39. {
  40. if (response.Error == ErrorCode.ERR_Success)
  41. {
  42. for (int i = 0; i < response.NoticeList.Count; i++)
  43. {
  44. NoticeInfo noticeInfo = new NoticeInfo();
  45. noticeInfo.noticeId = response.NoticeList[i].NoticeId;
  46. noticeInfo.title = response.NoticeList[i].Title;
  47. noticeInfo.time = response.NoticeList[i].TimeSec;
  48. noticeInfo.readStatus = response.NoticeList[i].ReadStatus;
  49. NoticeDataManager.Instance.UpdateNoticeIdList(noticeInfo);
  50. }
  51. return true;
  52. }
  53. }
  54. return false;
  55. }
  56. public static async ETTask<bool> ReqSystemNotice(int noticeId)
  57. {
  58. M2C_GetSystemNotice response = null;
  59. response = (M2C_GetSystemNotice)await MessageHelper.SendToServer(new C2M_GetSystemNotice() { NoticeId = noticeId });
  60. if (response != null)
  61. {
  62. if (response.Error == ErrorCode.ERR_Success)
  63. {
  64. NoticeDataManager.Instance.UpdateNoticeContent(response.NoticeId, response.Content);
  65. return true;
  66. }
  67. }
  68. return false;
  69. }
  70. }
  71. }