NoticeSProxy.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. NoticeDataManager.Instance.UpdateNoticeIdList(noticeInfo);
  49. }
  50. return true;
  51. }
  52. }
  53. return false;
  54. }
  55. public static async ETTask<bool> ReqSystemNotice(int noticeId)
  56. {
  57. M2C_GetSystemNotice response = null;
  58. response = (M2C_GetSystemNotice)await MessageHelper.SendToServer(new C2M_GetSystemNotice() { NoticeId = noticeId });
  59. if (response != null)
  60. {
  61. if (response.Error == ErrorCode.ERR_Success)
  62. {
  63. NoticeDataManager.Instance.UpdateNoticeContent(response.NoticeId, response.Content);
  64. return true;
  65. }
  66. }
  67. return false;
  68. }
  69. }
  70. }