12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- using System;
- using System.Collections.Generic;
- using ET;
- using GFGGame;
- namespace ET
- {
- public class NoticeSystemNoticeChanged : AMHandler<M2C_SystemNoticeChanged>
- {
- 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;
- noticeInfo.readStatus = response.Notice.ReadStatus;
- noticeInfo.content = "";
- NoticeDataManager.Instance.UpdateNoticeIdList(noticeInfo);
- EventAgent.DispatchEvent(ConstMessage.NOTICE_SYSTOM_ADD);
- await ETTask.CompletedTask;
- }
- }
- public class NoticeSystemNoticeRemove : AMHandler<M2C_SystemNoticeRemoved>
- {
- protected override async ETTask Run(Session session, M2C_SystemNoticeRemoved response)
- {
- NoticeDataManager.Instance.UpdateSystemNoticeRemove(response.NoticeId);
- EventAgent.DispatchEvent(ConstMessage.NOTICE_SYSTOM_REMOVE);
- await ETTask.CompletedTask;
- }
- }
- }
- namespace GFGGame
- {
- public static class NoticeSProxy
- {
- public static async ETTask<bool> 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;
- noticeInfo.readStatus = response.NoticeList[i].ReadStatus;
- NoticeDataManager.Instance.UpdateNoticeIdList(noticeInfo);
- }
- return true;
- }
- }
- return false;
- }
- public static async ETTask<bool> 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;
- }
- }
- }
|