12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- 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 message)
- {
- NoticeDataManager.Instance.UpdateSystemNoticeChanged(message.NoticeId, message.Remove);
- await ETTask.CompletedTask;
- }
- }
- }
- namespace GFGGame
- {
- public static class NoticeSProxy
- {
- public static async ETTask<bool> ReqSystemNoticeList()
- {
- N2C_GetSystemNoticeList response = null;
- Session session = null;
- try
- {
- session = GameGlobal.zoneScene.GetComponent<NetKcpComponent>().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<NoticeInfo> noticeInfos = new List<NoticeInfo>();
- 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<bool> ReqSystemNotice(int noticeId)
- {
- N2C_GetSystemNotice response = null;
- Session session = null;
- try
- {
- session = GameGlobal.zoneScene.GetComponent<NetKcpComponent>().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;
- }
- }
- }
|