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 message) { NoticeDataManager.Instance.UpdateSystemNoticeChanged(message.NoticeId, message.Remove); await ETTask.CompletedTask; } } } namespace GFGGame { public static class NoticeSProxy { public static async ETTask ReqSystemNoticeList() { N2C_GetSystemNoticeList response = null; Session session = null; try { session = GameGlobal.zoneScene.GetComponent().Create(NetworkHelper.ToIPEndPoint(GameGlobal.noticeAddress)); response = (N2C_GetSystemNoticeList)await session.Call(new C2N_GetSystemNoticeList() { }); } catch (Exception e) { Log.Error(e.ToString()); return false; } finally { session?.Dispose(); } if (response.Error != ErrorCode.ERR_Success) { return false; } List noticeInfos = new List(); for (int i = 0; i < response.NoticeIdList.Count; i++) { NoticeInfo noticeInfo = new NoticeInfo(); noticeInfos.Add(noticeInfo); } // NoticeDataManager.Instance.UpdateNoticeIdList(noticeInfos); return true; } public static async ETTask ReqSystemNotice(int noticeId) { N2C_GetSystemNotice response = null; Session session = null; try { session = GameGlobal.zoneScene.GetComponent().Create(NetworkHelper.ToIPEndPoint(GameGlobal.noticeAddress)); response = (N2C_GetSystemNotice)await session.Call(new C2N_GetSystemNotice() { NoticeId = noticeId }); } catch (Exception e) { Log.Error(e.ToString()); return false; } finally { session?.Dispose(); } if (response.Error != ErrorCode.ERR_Success) { return false; } NoticeDataManager.Instance.noticeInfo.noticeId = response.NoticeId; NoticeDataManager.Instance.noticeInfo.title = response.Title; NoticeDataManager.Instance.noticeInfo.time = response.TimeSec; NoticeDataManager.Instance.noticeInfo.context = response.Content; return true; } } }