123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547 |
- using System;
- using System.Collections.Generic;
- using ET;
- using GFGGame;
- using Hutool;
- namespace GFGGame
- {
- public class NoticeTimeLimitLuckyBoxDropOutCount : AMHandler<S2C_NoticeTimeLimitLuckyBoxDropOutCount>
- {
- protected override async ETTask Run(Session session, S2C_NoticeTimeLimitLuckyBoxDropOutCount message)
- {
- var activityOpenCfg = ActivityOpenCfgArray.Instance.GetCfg(message.ActivityId);
- if (activityOpenCfg.type == ConstLimitTimeActivityType.ActLimitLuckyBox)
- {
- ActivityDataManager.Instance.allPlayTimes = message.AllPlayTimes;
- ActivityDataManager.Instance.lastDrawCount = message.Count;
- }
- else if (activityOpenCfg.type == ConstLimitTimeActivityType.ActLimitTsy)
- {
- ActivityDataManager.Instance.allTsyPlayTimes = message.AllPlayTimes;
- ActivityDataManager.Instance.lastTsyDrawCount = message.Count;
- }
- else if (activityOpenCfg.type == ConstLimitTimeActivityType.ActLimitStlyc)
- {
- ActivityDataManager.Instance.allLimitStlycTimes = message.AllPlayTimes;
- ActivityDataManager.Instance.lastStlycDrawCount = message.Count;
- }
- EventAgent.DispatchEvent(ConstMessage.ACTIVITY_LUCKY_BOX);
- await ETTask.CompletedTask;
- }
- }
- /**********************************************************七日登录*************************************************/
- public static class ActivitySProxy
- {
- public static async ETTask<bool> ReqSevenDayLoginInfos()
- {
- M2C_GetDailySignInBonusInfoList response = null;
- response = (M2C_GetDailySignInBonusInfoList)await MessageHelper.SendToServer(new C2M_GetDailySignInBonusInfoList());
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- ActivityDataManager.Instance.sevenDayLoginLoginIdList = response.KsBonusId;
- ActivityDataManager.Instance.sevenDayLoginBonusStatusList = response.VsBonusStatus;
- return true;
- }
- }
- return false;
- }
- public static async ETTask<bool> ReqSevenDayLoginRewards(int id)
- {
- M2C_GetDailySinInBonus response = null;
- response = (M2C_GetDailySinInBonus)await MessageHelper.SendToServer(new C2M_GetDailySinInBonus() { BonusId = id });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- ActivityDataManager.Instance.sevenDayLoginBonusStatusList[response.BonusId - 1] = response.BonusStatus;
- int[][] rewards = DailyLoginCfgArray.Instance.GetCfg(response.BonusId).rewardsArr;
- BonusController.TryShowBonusList(rewards);
- EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);
- return true;
- }
- }
- return false;
- }
- /*************************************************************首冲奖励*****************************************************/
- //领取首冲奖励
- public static async ETTask<bool> ReqFirstChargeBonusRewards()
- {
- S2C_GetFirstRechargeBonus response = null;
- response = (S2C_GetFirstRechargeBonus)await MessageHelper.SendToServer(new C2S_GetFirstRechargeBonus() { });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- BonusController.TryShowBonusList(GlobalCfgArray.globalCfg.firstChargeBonusArr);
- return true;
- }
- }
- return false;
- }
- /*************************************************************限时抽奖活动*****************************************************/
- //请求限时抽奖活动信息
- public static async ETTask<bool> ReqGetTimeLimitLuckyBoxInfo(int activityId)
- {
- S2C_GetTimeLimitLuckyBoxInfo response = null;
- response = (S2C_GetTimeLimitLuckyBoxInfo)await MessageHelper.SendToServer(new C2S_GetTimeLimitLuckyBoxInfo() { ActivityId = activityId });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- var activityCfg = ActivityOpenCfgArray.Instance.GetCfg(response.ActivityId);
- if (activityCfg.type == ConstLimitTimeActivityType.ActLimitLuckyBox)
- {
- if (ActivityDataManager.Instance.actLuckyBoxId != response.ActivityId)
- {
- ActivityDataManager.Instance.luckyBoxActBonusState.Clear();
- }
- ActivityDataManager.Instance.actLuckyBoxId = response.ActivityId;
- ActivityDataManager.Instance.allPlayTimes = response.AllPlayTimes;
- ActivityDataManager.Instance.lastDrawCount = response.Count;
- for (int i = 0; i < response.KsBonusState.Count; i++)
- {
- ActivityDataManager.Instance.luckyBoxActBonusState[response.KsBonusState[i]] = response.VsBonusState[i];
- }
- }
- else if (activityCfg.type == ConstLimitTimeActivityType.ActLimitTsy)
- {
- if (ActivityDataManager.Instance.actLimitTsyId != response.ActivityId)
- {
- ActivityDataManager.Instance.luckyActTsyBonusState.Clear();
- }
- ActivityDataManager.Instance.actLimitTsyId = response.ActivityId;
- ActivityDataManager.Instance.allTsyPlayTimes = response.AllPlayTimes;
- ActivityDataManager.Instance.lastTsyDrawCount = response.Count;
- for (int i = 0; i < response.KsBonusState.Count; i++)
- {
- ActivityDataManager.Instance.luckyActTsyBonusState[response.KsBonusState[i]] = response.VsBonusState[i];
- }
- }
- else if (activityCfg.type == ConstLimitTimeActivityType.ActLimitStlyc)
- {
- if (ActivityDataManager.Instance.actLimitStlycId != response.ActivityId)
- {
- ActivityDataManager.Instance.limitStlycActBonusState.Clear();
- }
- ActivityDataManager.Instance.actLimitStlycId = response.ActivityId;
- ActivityDataManager.Instance.allLimitStlycTimes = response.AllPlayTimes;
- ActivityDataManager.Instance.lastStlycDrawCount = response.Count;
- for (int i = 0; i < response.KsBonusState.Count; i++)
- {
- ActivityDataManager.Instance.limitStlycActBonusState[response.KsBonusState[i]] = response.VsBonusState[i];
- }
- }
- return true;
- }
- }
- return false;
- }
- /// <summary>
- /// 领取抽奖奖励
- /// </summary>
- /// <param name="activityId"></param>
- /// <param name="bonusKey">奖励key,这里对应抽奖次数</param>
- /// <returns></returns>
- public static async ETTask<bool> ReqGetTimeLimitLuckyBoxBonus(int activityId, int bonusKey)
- {
- S2C_GetTimeLimitLuckyBoxBonus response = null;
- response = (S2C_GetTimeLimitLuckyBoxBonus)await MessageHelper.SendToServer(new C2S_GetTimeLimitLuckyBoxBonus() { ActivityId = activityId, BonusKey = bonusKey });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- var activityCfg = ActivityOpenCfgArray.Instance.GetCfg(response.ActivityId);
- if (activityCfg.type == ConstLimitTimeActivityType.ActLimitLuckyBox)
- {
- if (ActivityDataManager.Instance.actLuckyBoxId != response.ActivityId)
- {
- return false;
- }
- ActivityDataManager.Instance.luckyBoxActBonusState[response.BonusKey] = response.BonusStatus;
- }
- else if (activityCfg.type == ConstLimitTimeActivityType.ActLimitTsy)
- {
- if (ActivityDataManager.Instance.actLimitTsyId != response.ActivityId)
- {
- return false;
- }
- ActivityDataManager.Instance.luckyActTsyBonusState[response.BonusKey] = response.BonusStatus;
- }
- else if (activityCfg.type == ConstLimitTimeActivityType.ActLimitStlyc)
- {
- if (ActivityDataManager.Instance.actLimitStlycId != response.ActivityId)
- {
- return false;
- }
- ActivityDataManager.Instance.limitStlycActBonusState[response.BonusKey] = response.BonusStatus;
- }
- // int[][] bonus = ActivityLuckybonusCfgArray.Instance.GetCfgByidAndnum(response.ActivityId, response.BonusKey).bonusArr;
- BonusController.TryShowBonusList(ItemUtil.CreateItemDataList(response.BonusList));
- EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);
- EventAgent.DispatchEvent(ConstMessage.LUCKY_BOX_ACTIVITY_REWARD);
- return true;
- }
- }
- return false;
- }
- /*************************************************************限时累充*****************************************************/
- // /// <summary>
- // /// 领取累充奖励
- // /// </summary>
- // /// <param name="activityId"></param>
- // /// <param name="bonusKey">奖励key,这里对应抽奖次数</param>
- // /// <returns></returns>
- // public static async ETTask<bool> ReqGetLimitChargeBonus(int activityId, int bonusKey)
- // {
- // S2C_GetTimeLimitLuckyBoxBonus response = null;
- // response = (S2C_GetTimeLimitLuckyBoxBonus)await MessageHelper.SendToServer(new C2S_GetTimeLimitLuckyBoxBonus() { ActivityId = activityId, BonusKey = bonusKey });
- // if (response != null)
- // {
- // if (response.Error == ErrorCode.ERR_Success)
- // {
- // if (ActivityDataManager.Instance.actLuckyBoxId != response.ActivityId)
- // {
- // return false;
- // }
- // ActivityDataManager.Instance.luckyBoxActBonusState[response.BonusKey] = response.BonusStatus;
- // int[][] bonus = ActivityLuckybonusCfgArray.Instance.GetCfgByidAndnum(response.ActivityId, response.BonusKey).bonusArr;
- // BonusController.TryShowBonusList(bonus);
- // return true;
- // }
- // }
- // return false;
- // }
- /*************************************************************活动弹窗*****************************************************/
- public static async ETTask<bool> ReqActivityTips(int type , int val)
- {
- S2C_UpLimitNumericValue response = null;
- response = (S2C_UpLimitNumericValue)await MessageHelper.SendToServer(new C2S_UpLimitNumericValue() { NumericType = type,NumericVal = val });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- GameGlobal.myNumericComponent.Set(response.NumericType, response.NumericVal);
- return true;
- }
- }
- return false;
- }
- //招财进宝活动
- public static async ETTask<bool> ReqActivityZCJBInfo(int id = 5006)
- {
- int activityID = ActivityDataManager.Instance.GetCurOpenActiveByType(17);
- if (activityID != 0)
- {
- ActivityDataManager.Instance.activityZCJBId = ActivityOpenCfgArray.Instance.GetCfg(activityID).paramsArr[0];
- }
- S2C_GetDressRewrdStatusList response = null;
- response = (S2C_GetDressRewrdStatusList)await MessageHelper.SendToServer(new C2S_GetDressRewrdStatusList() { ActivityId = activityID });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- ActivityDataManager.Instance.ActivityZCJBList = response.RewrdIds;
- return true;
- }
- }
- return false;
- }
- public static async ETTask<bool> ReqActivityZCJBReward(int id,int rewardId)
- {
- S2C_GetDressRewrd response = null;
- response = (S2C_GetDressRewrd)await MessageHelper.SendToServer(new C2S_GetDressRewrd() { ActivityId = id ,RewrdId = rewardId});
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- ActivityDataManager.Instance.ActivityZCJBList = response.RewrdIds;
- BonusController.TryShowBonusList(ItemUtil.CreateItemDataList(response.BonusList));
- return true;
- }
- }
- return false;
- }
- public static async ETTask SetOnceStatus(int k,long id,int type)
- {
- S2C_UpdateDataRecord response = (S2C_UpdateDataRecord)await MessageHelper.SendToServer(new C2S_UpdateDataRecord() { K = k, V = id ,ResetType = type });
- }
- public static async ETTask<bool> GetOnceStatus(long k)
- {
- S2C_GetDataRecord response = (S2C_GetDataRecord)await MessageHelper.SendToServer(new C2S_GetDataRecord() { });
- for (int i = 0; i < response.AllKs.Count; i++)
- {
- if (response.AllKs[i] == k)
- {
- if (response.AllVs[i] == 1)
- {
- GameGlobal.AutoZCJBTips = false;
- return true;
- }
- else
- {
- GameGlobal.AutoZCJBTips = true;
- return true;
- }
- }
- }
- GameGlobal.AutoZCJBTips = true;
- return true;
- }
- /**********************************************************新年签到*************************************************/
-
- public static async ETTask<bool> ReqGetActivitySignInfos()
- {
- int activityId = ActivityDataManager.Instance.GetCurOpenActiveByType(ActivityType.ShenDuChenYou);
- if (activityId < 0 || ActivitySignCfgArray.Instance.GetCfgsByactivityId(activityId).Count <= 0 )
- return false;
- S2C_GetActivitySignInfos response = null;
- response = (S2C_GetActivitySignInfos)await MessageHelper.SendToServer(new C2S_GetActivitySignInfos() { ActivityId = activityId });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- ActivityDataManager.Instance.NewYearLoginInfoDic.Clear();
- for(int i = 0;i< response.ksDay.Count; i++) {
- ActivityDataManager.Instance.NewYearLoginInfoDic.Add(response.ksDay[i], response.vsStatus[i]);
- }
- return true;
- }
- }
- return false;
- }
- public static async ETTask<bool> ReqGetAcitivitySignBonus(int activityId,int day)
- {
- S2C_ReqGetAcitivitySignBonus response = null;
- response = (S2C_ReqGetAcitivitySignBonus)await MessageHelper.SendToServer(new C2S_ReqGetAcitivitySignBonus() { ActivityId = activityId, Day = day });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- ActivityDataManager.Instance.NewYearLoginInfoDic[response.Day] = ConstBonusStatus.GOT;
- int[][] rewards = ActivitySignCfgArray.Instance.GetCfgByactivityIdAndday(activityId,response.Day).bonusArr;
- BonusController.TryShowBonusList(rewards);
- EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);
- return true;
- }
- }
- return false;
- }
- //**************************新人礼包领取
- public static async ETTask<bool> ReqGetNewPlayerBonus()
- {
- S2C_GetNewcomerRewards response = null;
- response = (S2C_GetNewcomerRewards)await MessageHelper.SendToServer(new C2S_GetNewcomerRewards() { });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- ActivityDataManager.Instance.IsGetNewPlayerReward = response.Status;
- BonusController.TryShowBonusList(ItemUtil.CreateItemDataList(response.BonusList));
- return true;
- }
- }
- return false;
- }
- //获取新人礼包状态
- public static async ETTask<bool> ReqGetNewPlayerBonusStatus()
- {
- S2C_GetNewcomerRewardStatus response = null;
- response = (S2C_GetNewcomerRewardStatus)await MessageHelper.SendToServer(new C2S_GetNewcomerRewardStatus() { });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- ActivityDataManager.Instance.IsGetNewPlayerReward = response.Status;
- GameGlobal.AutoNewPlayersTips = response.OpenStatus;
- return true;
- }
- }
- return false;
- }
- public static async ETTask SetNewPlayerOnceStatus(long id)
- {
- S2C_UpdateDataRecord response = (S2C_UpdateDataRecord)await MessageHelper.SendToServer(new C2S_UpdateDataRecord (){ K = 100001, V = id });
- }
- public static async ETTask<bool> GetNewPlayerOnceStatus()
- {
- S2C_GetDataRecord response = (S2C_GetDataRecord)await MessageHelper.SendToServer(new C2S_GetDataRecord() { });
- for (int i = 0; i < response.AllKs.Count; i++)
- {
- if (response.AllKs[i] == 100001)
- {
- if(response.AllVs[i] == 0)
- {
- GameGlobal.NewPlayerOnceTips = false;
- return true;
- }
- else
- {
- GameGlobal.NewPlayerOnceTips = true;
- return true;
- }
- }
- }
- GameGlobal.NewPlayerOnceTips = true;
- return true;
- }
- //弹窗状态设置
- public static async ETTask SetTipsStatus(long tips,long value,int type = 1)
- {
- S2C_UpdateDataRecord response = (S2C_UpdateDataRecord)await MessageHelper.SendToServer(new C2S_UpdateDataRecord() { K = tips,V = value, ResetType = type});
- }
- public static async ETTask GetTipsStatus()
- {
- S2C_GetDataRecord response = (S2C_GetDataRecord)await MessageHelper.SendToServer(new C2S_GetDataRecord() { });
- for (int i = 0; i < response.AllKs.Count; i++)
- {
- if(ActivityDataManager.Instance.TipsStatusDic.ContainsKey(response.AllKs[i]))
- {
- ActivityDataManager.Instance.TipsStatusDic[response.AllKs[i]] = response.AllVs[i];
- }
- else
- {
- ActivityDataManager.Instance.TipsStatusDic.Add(response.AllKs[i], response.AllVs[i]);
- }
- //
- }
- }
- //获取转盘活动信息
- public static async ETTask<bool> ReqGetTurnTableInfo()
- {
- S2C_GetWishingActivityInfo response = null;
- int id = ActivityDataManager.Instance.GetCurOpenActiveByType(ActivityDataManager.Instance.TurnTableActivityType);
- if (id == 0)
- {
- return false;
- }
- response = (S2C_GetWishingActivityInfo)await MessageHelper.SendToServer(new C2S_GetWishingActivityInfo() {AcitvityId = id });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- ActivityDataManager.Instance.TurnRewardStateDic.Clear();
- ActivityDataManager.Instance.TurnTableTimes = response.SpecialTotalNum;
- ActivityDataManager.Instance.StartDropId = response.ExtraIdDropId;
- ActivityDataManager.Instance.TipsDropId = response.ExtraIdDropId;
- for (int i = 0;i<response.RewardIds.Count;i++)
- {
- ActivityDataManager.Instance.TurnRewardStateDic.Add(response.RewardIds[i],response.RewardStatus[i]);
- }
- return true;
- }
- }
- return false;
- }
- public static async ETTask<bool> ReqTurnTableWish(int wishType)
- {
- S2C_WishingLuckyBox response = null;
- int id = ActivityDataManager.Instance.GetCurOpenActiveByType(ActivityDataManager.Instance.TurnTableActivityType);
- response = (S2C_WishingLuckyBox)await MessageHelper.SendToServer(new C2S_WishingLuckyBox() { AcitvityId = id,WishingType = wishType });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- ActivityDataManager.Instance.TurnRewardStateDic.Clear();
- ActivityDataManager.Instance.threeTurnResult.Clear();
- ActivityDataManager.Instance.TurnTableTimes = response.SpecialTotalNum;
- ActivityDataManager.Instance.TipsDropId = response.ExtraIdDropId;
- for (int i = 0; i < response.RewardIds.Count; i++)
- {
- ActivityDataManager.Instance.TurnRewardStateDic.Add(response.RewardIds[i], response.RewardStatus[i]);
- }
- if(response.RewardList.Count == 3)
- {
- ActivityDataManager.Instance.threeTurnResult.Add(0, response.RewardList);
- }
- else if(response.RewardList.Count == 9 )
- {
- List<ItemInfoProto> infoOneList = new List<ItemInfoProto>();
- List<ItemInfoProto> infoTwoList = new List<ItemInfoProto>();
- List<ItemInfoProto> infoThreeList = new List<ItemInfoProto>();
- for (int i = 0; i < response.RewardList.Count; i++)
- {
- if(i<3)
- {
- infoOneList.Add(response.RewardList[i]);
- }
- else if(i>=3 && i<6)
- {
- infoTwoList.Add(response.RewardList[i]);
- }
- else if(i >=6)
- {
- infoThreeList.Add(response.RewardList[i]);
- }
- }
- ActivityDataManager.Instance.threeTurnResult.Add(0, infoOneList);
- ActivityDataManager.Instance.threeTurnResult.Add(1, infoTwoList);
- ActivityDataManager.Instance.threeTurnResult.Add(2, infoThreeList);
- }
- ActivityDataManager.Instance.TurnRewardList = response.RewardList;
- ActivityDataManager.Instance.TurnSpecialRewardList = response.SpecialRewardList;
- return true;
- }
- }
- return false;
- }
- //获取领取转盘奖励
- public static async ETTask<bool> ReqGetTurnTableReward(int rewardId)
- {
- S2C_GetWishingRewards response = null;
- response = (S2C_GetWishingRewards)await MessageHelper.SendToServer(new C2S_GetWishingRewards() { RewardId = rewardId });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- ActivityDataManager.Instance.TurnRewardStateDic.Clear();
- for (int i = 0; i < response.RewardIds.Count; i++)
- {
- ActivityDataManager.Instance.TurnRewardStateDic.Add(response.RewardIds[i], response.RewardStatus[i]);
- }
- BonusController.TryShowBonusList(ItemUtil.CreateItemDataList(response.RewardList));
- EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);
- return true;
- }
- }
- return false;
- }
- }
- //新人活动开启状态推送
- public class NewPlayerOpenStatus : AMHandler<S2C_PushNewcomerRewardStatus>
- {
- protected override async ETTask Run(Session session, S2C_PushNewcomerRewardStatus message)
- {
- ActivityDataManager.Instance.IsGetNewPlayerReward = message.Status;
- GameGlobal.AutoNewPlayersTips = message.OpenStatus;
- await ETTask.CompletedTask;
- }
- }
- }
|