12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- using ET;
- using GFGGame;
- namespace ET
- {
- public class S2C_NoticeLuckyBoxFreeTimeHandler : AMHandler<S2C_NoticeLuckyBoxFreeTime>
- {
- protected override async ETTask Run(Session session, S2C_NoticeLuckyBoxFreeTime message)
- {
- LuckyBoxDataManager.Instance.UpdateFreeTime(message.LuckyBoxId, message.FreeTime);
- await ETTask.CompletedTask;
- }
- }
- }
- namespace GFGGame
- {
- public class LuckyBoxSProxy
- {
- //抽奖
- public static async ETTask<bool> ReqGetBonus(int luckyBoxId, int times, bool free = false)
- {
- M2C_DrawLuckyBox response = null;
- response = (M2C_DrawLuckyBox)await MessageHelper.SendToServer(new C2M_DrawLuckyBox() { LuckyBoxId = luckyBoxId, Times = times, Free = free });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- ActivityOpenCfg activityOpenCfg = ActivityOpenCfgArray.Instance.GetCfg(ActivityDataManager.Instance.actLuckyBoxId);
- if (activityOpenCfg != null && activityOpenCfg.paramsArr[0] == luckyBoxId)
- {
- ActivityDataManager.Instance.allPlayTimes += response.Times;
- }
- LuckyBoxDataManager.Instance.times = response.Times;
- // LuckyBoxDataManager.Instance.luckyBoxIndex = response.LuckyBoxId;
- LuckyBoxDataManager.Instance.RewardList = ItemUtil.CreateItemDataList(response.bonusList);
- return true;
- }
- }
- return false;
- }
- //请求轮换抽奖活动信息
- public static async ETTask<int> ReqGetLuckyBoxRotatingInfo()
- {
- S2C_GetLuckyBoxRotatingInfo response = null;
- response = (S2C_GetLuckyBoxRotatingInfo)await MessageHelper.SendToServer(new C2S_GetLuckyBoxRotatingInfo() { });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- LuckyBoxDataManager.Instance.RotatingId = response.RotatingId;
- return response.RotatingId;
- }
- }
- return 0;
- }
- //请求抽奖初始信息
- public static async ETTask ReqGetLuckyBoxInfo()
- {
- S2C_GetLuckyBoxInfo response = null;
- response = (S2C_GetLuckyBoxInfo)await MessageHelper.SendToServer(new C2S_GetLuckyBoxInfo() { });
- if(response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- LuckyBoxDataManager.Instance.InitServerData(response);
- }
- }
- }
- }
- }
|