using System; using System.Collections.Generic; using ET; using GFGGame; namespace ET { public class NoticeSystemNoticeChanged : AMHandler { protected override async ETTask Run(Session session, M2C_SystemNoticeChanged response) { NoticeInfo noticeInfo = new NoticeInfo(); noticeInfo.noticeId = response.Notice.NoticeId; noticeInfo.title = response.Notice.Title; noticeInfo.time = response.Notice.TimeSec * 1000; noticeInfo.readStatus = response.Notice.ReadStatus; noticeInfo.content = ""; NoticeDataManager.Instance.UpdateNoticeIdList(noticeInfo); EventAgent.DispatchEvent(ConstMessage.NOTICE_SYSTOM_ADD); EventAgent.DispatchEvent(ConstMessage.RED_CHANGE); await ETTask.CompletedTask; } } public class NoticeSystemNoticeRemove : AMHandler { protected override async ETTask Run(Session session, M2C_SystemNoticeRemoved response) { NoticeDataManager.Instance.UpdateSystemNoticeRemove(response.NoticeId); EventAgent.DispatchEvent(ConstMessage.NOTICE_SYSTOM_REMOVE); EventAgent.DispatchEvent(ConstMessage.RED_CHANGE); await ETTask.CompletedTask; } } } namespace GFGGame { public static class NoticeSProxy { public static async ETTask ReqSystemNoticeList() { M2C_GetSystemNoticeList response = null; response = (M2C_GetSystemNoticeList)await MessageHelper.SendToServer(new C2M_GetSystemNoticeList()); if (response != null) { if (response.Error == ErrorCode.ERR_Success) { for (int i = 0; i < response.NoticeList.Count; i++) { NoticeInfo noticeInfo = new NoticeInfo(); noticeInfo.noticeId = response.NoticeList[i].NoticeId; noticeInfo.title = response.NoticeList[i].Title; noticeInfo.time = response.NoticeList[i].TimeSec * 1000; noticeInfo.readStatus = response.NoticeList[i].ReadStatus; NoticeDataManager.Instance.UpdateNoticeIdList(noticeInfo); } return true; } } return false; } public static async ETTask ReqSystemNotice(int noticeId) { M2C_GetSystemNotice response = null; response = (M2C_GetSystemNotice)await MessageHelper.SendToServer(new C2M_GetSystemNotice() { NoticeId = noticeId }); if (response != null) { if (response.Error == ErrorCode.ERR_Success) { NoticeDataManager.Instance.UpdateNoticeContent(response.NoticeId, response.Content); return true; } } return false; } } }