| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 | 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;        }    }    //活动开启服务端推送最新许愿记录    public class S2C_PushWishingPoolInfoHandler : AMHandler<S2C_PushWishingPoolInfo>    {        protected override async ETTask Run(Session session, S2C_PushWishingPoolInfo message)        {            LuckyBoxDataManager.Instance.KsActivityId = message.KsActivityId;            LuckyBoxDataManager.Instance.VsStatus = message.VsStatus;            await ETTask.CompletedTask;        }    }}namespace GFGGame{    public class LuckyBoxSProxy    {        //抽奖        public static async ETTask<bool> ReqGetBonus(int luckyBoxId, int times, bool free = false,int activityId = 0)        {            M2C_DrawLuckyBox response = null;            response = (M2C_DrawLuckyBox)await MessageHelper.SendToServer(new C2M_DrawLuckyBox() { LuckyBoxId = luckyBoxId, Times = times, Free = free, ActivityId = activityId });            if (response != null)            {                if (response.Error == ErrorCode.ERR_Success)                {                    ActivityOpenCfg activityOpenCfg = ActivityOpenCfgArray.Instance.GetCfg(response.ActivityId);                    if (activityOpenCfg != null && activityOpenCfg.paramsArr[0] == luckyBoxId)                    {                                                var activityCfg = ActivityOpenCfgArray.Instance.GetCfg(response.ActivityId);                        if (activityCfg.type == ConstLimitTimeActivityType.ActLimitLuckyBox)                            ActivityDataManager.Instance.allPlayTimes += response.Times;                        else if (activityCfg.type == ConstLimitTimeActivityType.ActLimitTsy)                            ActivityDataManager.Instance.allTsyPlayTimes += response.Times;                        else if (activityCfg.type == ConstLimitTimeActivityType.ActLimitStlyc)                        {                            if (ActivityDataManager.Instance.allLimitStlycTimes < 20 && (ActivityDataManager.Instance.allLimitStlycTimes + response.Times) >= 20)                            {                                LuckyBoxDataManager.Instance.OPEN_LUCKY_DISCONT = true;                            }                            ActivityDataManager.Instance.allLimitStlycTimes += 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);                }            }        }        //许愿池许愿记录        public static async ETTask<bool> ReqAddWishingPoolInfo(int suitId,int activityId)        {            S2C_AddWishingPoolInfo response = null;            response = (S2C_AddWishingPoolInfo)await MessageHelper.SendToServer(new C2S_AddWishingPoolInfo() { SuitId = suitId , ActivityId  = activityId });            if (response != null)            {                if (response.Error == ErrorCode.ERR_Success)                {                    int index = LuckyBoxDataManager.Instance.KsActivityId.IndexOf(response.ActivityId);                    LuckyBoxDataManager.Instance.VsStatus[index] = response.Status;                    return true;                }            }            return false;        }                ////获取许愿池许愿记录        public static async ETTask<bool> ReqGetWishingPoolInfo()        {            S2C_GetWishingPoolInfo response = null;            response = (S2C_GetWishingPoolInfo)await MessageHelper.SendToServer(new C2S_GetWishingPoolInfo() { });            if (response != null)            {                if (response.Error == ErrorCode.ERR_Success)                {                    LuckyBoxDataManager.Instance.KsActivityId = response.KsActivityId;                    LuckyBoxDataManager.Instance.VsStatus = response.VsStatus;                    return true;                }            }            return false;        }    }}
 |