|
@@ -28,6 +28,7 @@ namespace ET
|
|
|
await ETTask.CompletedTask;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
namespace GFGGame
|
|
@@ -37,65 +38,40 @@ namespace GFGGame
|
|
|
|
|
|
public static async ETTask<bool> ReqSystemNoticeList()
|
|
|
{
|
|
|
- N2C_GetSystemNoticeList response = null;
|
|
|
- Session session = null;
|
|
|
- try
|
|
|
- {
|
|
|
- AccountInfoComponent accountInfoComponent = GameGlobal.zoneScene.GetComponent<AccountInfoComponent>();
|
|
|
- session = GameGlobal.zoneScene.GetComponent<NetKcpComponent>().Create(NetworkHelper.ToIPEndPoint(accountInfoComponent.NoticeAddress));
|
|
|
- response = (N2C_GetSystemNoticeList)await session.Call(new C2N_GetSystemNoticeList() { AccountId = (int)accountInfoComponent.AccountId });
|
|
|
- }
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
- Log.Error(e.ToString());
|
|
|
- return false;
|
|
|
- }
|
|
|
- finally
|
|
|
- {
|
|
|
- session?.Dispose();
|
|
|
- }
|
|
|
- if (response.Error != ErrorCode.ERR_Success)
|
|
|
- {
|
|
|
- return false;
|
|
|
- }
|
|
|
- for (int i = 0; i < response.NoticeList.Count; i++)
|
|
|
+ M2C_GetSystemNoticeList response = null;
|
|
|
+ response = (M2C_GetSystemNoticeList)await MessageHelper.SendToServer(new C2M_GetSystemNoticeList());
|
|
|
+ if (response != null)
|
|
|
{
|
|
|
- NoticeInfo noticeInfo = new NoticeInfo();
|
|
|
- noticeInfo.noticeId = response.NoticeList[i].NoticeId;
|
|
|
- noticeInfo.title = response.NoticeList[i].Title;
|
|
|
- noticeInfo.time = response.NoticeList[i].TimeSec;
|
|
|
+ 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;
|
|
|
|
|
|
- NoticeDataManager.Instance.UpdateNoticeIdList(noticeInfo);
|
|
|
+ NoticeDataManager.Instance.UpdateNoticeIdList(noticeInfo);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|
|
|
- return true;
|
|
|
+ return false;
|
|
|
}
|
|
|
+
|
|
|
public static async ETTask<bool> ReqSystemNotice(int noticeId)
|
|
|
{
|
|
|
- N2C_GetSystemNotice response = null;
|
|
|
- Session session = null;
|
|
|
- try
|
|
|
+ M2C_GetSystemNotice response = null;
|
|
|
+ response = (M2C_GetSystemNotice)await MessageHelper.SendToServer(new C2M_GetSystemNotice() { NoticeId = noticeId });
|
|
|
+ if (response != null)
|
|
|
{
|
|
|
- AccountInfoComponent accountInfoComponent = GameGlobal.zoneScene.GetComponent<AccountInfoComponent>();
|
|
|
-
|
|
|
- session = GameGlobal.zoneScene.GetComponent<NetKcpComponent>().Create(NetworkHelper.ToIPEndPoint(accountInfoComponent.NoticeAddress));
|
|
|
- response = (N2C_GetSystemNotice)await session.Call(new C2N_GetSystemNotice() { NoticeId = noticeId });
|
|
|
+ if (response.Error == ErrorCode.ERR_Success)
|
|
|
+ {
|
|
|
+ NoticeDataManager.Instance.UpdateNoticeContent(response.NoticeId, response.Content);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
- Log.Error(e.ToString());
|
|
|
- return false;
|
|
|
- }
|
|
|
- finally
|
|
|
- {
|
|
|
- session?.Dispose();
|
|
|
- }
|
|
|
- if (response.Error != ErrorCode.ERR_Success)
|
|
|
- {
|
|
|
- return false;
|
|
|
- }
|
|
|
- NoticeDataManager.Instance.UpdateNoticeContent(response.NoticeId, response.Content);
|
|
|
-
|
|
|
- return true;
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
}
|