|
@@ -1,25 +1,85 @@
|
|
|
+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> ClothingDecompose(List<int> itemIds, List<int> itemNums)
|
|
|
+
|
|
|
+ public static async ETTask<bool> ReqSystemNoticeList()
|
|
|
{
|
|
|
- M2C_ClothingDecompose response = null;
|
|
|
- response = (M2C_ClothingDecompose)await MessageHelper.SendToServer(new C2M_ClothingDecompose() { itemIds = itemIds, itemNums = itemNums });
|
|
|
- if (response != null)
|
|
|
+ N2C_GetSystemNoticeList response = null;
|
|
|
+ Session session = null;
|
|
|
+ try
|
|
|
{
|
|
|
- if (response.Error == ErrorCode.ERR_Success)
|
|
|
- {
|
|
|
- BonusController.TryShowBonusList(ItemUtil.CreateItemDataList(response.bonusList));
|
|
|
- return true;
|
|
|
- }
|
|
|
+ session = GameGlobal.zoneScene.GetComponent<NetKcpComponent>().Create(NetworkHelper.ToIPEndPoint(GameGlobal.noticeAddress));
|
|
|
+ response = (N2C_GetSystemNoticeList)await session.Call(new C2N_GetSystemNoticeList() { });
|
|
|
}
|
|
|
- return false;
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|