using ET; using System.Collections.Generic; namespace GFGGame { public class ActivityDataManager : SingletonBase { public void Clear() { luckyBoxActBonusState.Clear(); allPlayTimes = 0; lastActLuckyBoxId = 0; lastActLimitChargeId = 0; luckyActTsyBonusState.Clear(); allTsyPlayTimes = 0; lastActLimitTsyId = 0; limitStlycActBonusState.Clear(); allLimitStlycTimes = 0; lastActLimitStlycId = 0; NewYearLoginInfoDic.Clear(); } /**********************************************************活动*************************************************/ /// /// 获取指定类型活动当前开启的活动id /// /// public int GetCurOpenActiveByType(int type) { ActivityInfo info = ActivityGlobalDataManager.Instance.GetActivityInfoOneByType(type); return (info == null) ? 0 : info.ActivityId; } /**********************************************************活动弹窗*************************************************/ public int todayActivityTips = 0; public int todayMonthlyCardTips = 0; /**********************************************************限时累充*************************************************/ public int lastActLimitChargeId = 0; private int _actLimitChargeId = 0; /**********************************************************限时累充*************************************************/ public bool IsGetNewPlayerReward = false; /// /// 当前限时累充活动id /// /// public int actLimitChargeId { get { return _actLimitChargeId; } set { _actLimitChargeId = value; } } /**********************************************************限时抽奖活动*********************************************/ public int lastActLuckyBoxId = 0; public int lastActLimitTsyId = 0; public int lastActLimitStlycId = 0; private int _actLuckyBoxId = 0; private int _actLuckyTsyId = 0; private int _actLimitStlycId = 0; /// /// 当前抽奖活动id /// /// public int actLuckyBoxId { get { return _actLuckyBoxId; } set { _actLuckyBoxId = value; } } /// /// 抽奖总次数 /// /// public long allPlayTimes { get; set; } /// /// 限时抽奖必掉次数 /// /// public int lastDrawCount { get; set; } /// /// /// 奖励key,这里对应抽奖次数 /// 值由ConstBonusStatus定义 /// public Dictionary luckyBoxActBonusState = new Dictionary(); /// /// 当前天市垣抽奖活动id /// /// public int actLimitTsyId { get { return _actLuckyTsyId; } set { _actLuckyTsyId = value; } } /// /// 天市垣抽奖总次数 /// /// public long allTsyPlayTimes { get; set; } /// /// 限时天市垣抽奖必掉次数 /// /// public int lastTsyDrawCount { get; set; } /// /// /// 奖励key,这里对应天市垣抽奖次数 /// 值由ConstBonusStatus定义 /// public Dictionary luckyActTsyBonusState = new Dictionary(); /// /// 当前隋唐洛阳城活动id /// /// public int actLimitStlycId { get { return _actLimitStlycId; } set { _actLimitStlycId = value; } } /// /// 开服活动抽奖总次数 /// /// public long allLimitStlycTimes { get; set; } /// /// 开服抽奖必掉次数 /// /// public int lastStlycDrawCount { get; set; } /// /// /// 奖励key,这里对应抽奖次数 /// 值由ConstBonusStatus定义 /// public Dictionary limitStlycActBonusState = new Dictionary(); public List SortActivityLuckybonusCfg(List list,int typeId) { list.Sort((ActivityLuckybonusCfg a, ActivityLuckybonusCfg b) => { long allPlayTimes = 0; int stateA = 0; int stateB = 0; if (typeId == ConstLimitTimeActivityType.ActLimitLuckyBox) { allPlayTimes = ActivityDataManager.Instance.allPlayTimes;// GameGlobal.myNumericComponent.GetAsInt(NumericType.TotalRechargeScore); stateA = ActivityDataManager.Instance.luckyBoxActBonusState.ContainsKey(a.num) ? 1 : -1; stateB = ActivityDataManager.Instance.luckyBoxActBonusState.ContainsKey(b.num) ? 1 : -1; } else if(typeId == ConstLimitTimeActivityType.ActLimitTsy) { allPlayTimes = ActivityDataManager.Instance.allTsyPlayTimes;// GameGlobal.myNumericComponent.GetAsInt(NumericType.TotalRechargeScore); stateA = ActivityDataManager.Instance.luckyActTsyBonusState.ContainsKey(a.num) ? 1 : -1; stateB = ActivityDataManager.Instance.luckyActTsyBonusState.ContainsKey(b.num) ? 1 : -1; } else if (typeId == ConstLimitTimeActivityType.ActLimitStlyc) { allPlayTimes = ActivityDataManager.Instance.allTsyPlayTimes;// GameGlobal.myNumericComponent.GetAsInt(NumericType.TotalRechargeScore); stateA = ActivityDataManager.Instance.luckyActTsyBonusState.ContainsKey(a.num) ? 1 : -1; stateB = ActivityDataManager.Instance.luckyActTsyBonusState.ContainsKey(b.num) ? 1 : -1; } if (allPlayTimes >= a.num && allPlayTimes < b.num && stateA < 0) return -1; if (allPlayTimes >= b.num && allPlayTimes < a.num && stateB < 0) return 1; if (stateA >= 0 && stateB < 0) return 1; if (stateB >= 0 && stateA < 0) return -1; return a.num - b.num; }); return list; } /**********************************************************每日登录*************************************************/ private int _sevenDayLoginLoginId = 1; /// /// 七日登录 当日奖励id /// /// public int sevenDayLoginLoginId { get { return _sevenDayLoginLoginId; } set { _sevenDayLoginLoginId = value; } } private int _sevenDayLoginBonusStatus = 0; /// /// 七日登录 当前奖励状态 /// /// public int sevenDayLoginBonusStatus { get { return _sevenDayLoginBonusStatus; } set { _sevenDayLoginBonusStatus = value; } } /******************************************************************************************************************/ /**********************************************************每日登录修改*************************************************/ public List sevenDayLoginLoginIdList = new List(); /// /// 七日登录 当日奖励id /// /// public List sevenDayLoginBonusStatusList = new List(); /// /// 七日登录 当前奖励状态 /// /// /// public bool CanGetSevenDayBonus() { foreach(int a in sevenDayLoginBonusStatusList) { if (a == 1) return true; } return false; } public bool AllSevenDayBonusGot() { foreach (int a in sevenDayLoginBonusStatusList) { if (a != 2) return false; } return true; } public bool HaveGetSevenDayBonus() { foreach (int a in sevenDayLoginBonusStatusList) { if (a == 0) return true; } return false; } //判断最后可领取的奖励索引 public int NowSevenDayBonusDay(bool day = false) { if(AllSevenDayBonusGot()) { return 8; } int a = 0; int flog = -1; if (day) { for (int j = 0; j < sevenDayLoginBonusStatusList.Count; j++) { a = sevenDayLoginBonusStatusList[j]; if (a == 1) { flog = j; return flog; } } } else { for (int j = 0; j < sevenDayLoginBonusStatusList.Count; j++) { a = sevenDayLoginBonusStatusList[j]; if (a == 2) flog = j; } } return flog; } /******************************************************************************************************************/ private int _firstChargeBonusStatus = 0; /// /// 首冲奖励 当前奖励状态,ConstBonusStatus 0不可领,1可领,2已领 /// /// public int firstChargeBonusStatus { get { var status = GameGlobal.myNumericComponent.GetAsInt(ET.NumericType.FirstRechargeBonusStatus); if (status == ConstBonusStatus.GOT) { return ConstBonusStatus.GOT; } if (GameGlobal.myNumericComponent.GetAsLong(ET.NumericType.FirstRechargeTotal) > 0) { return ConstBonusStatus.CAN_GET; } return ConstBonusStatus.CAN_NOT_GET; } } //招财进宝活动 public List ActivityZCJBList = new List(); public int activityZCJBId = 61101; public bool CheckZCJBRed() { ItemData numItem; long num; if(BagDataManager.Instance.GetBagData().TryGetValue(ActivityDressCfgArray.Instance.dataArray[0].comsumeArr[0][0], out numItem)) { num = numItem.num; } else { num = 0; } for (int i = 0; i < ActivityDressCfgArray.Instance.dataArray.Length - 1; i++) { if (i == ActivityDataManager.Instance.ActivityZCJBList.Count) { if (num >= ActivityDressCfgArray.Instance.dataArray[i].comsumeArr[0][1]) { return true; } } } return false; } /**********************************************************每日登录修改*************************************************/ /// /// 新年签到 登录第几天列表 奖励状态列表 /// /// public Dictionary NewYearLoginInfoDic = new Dictionary(); public bool CanGetNewYearLoginRed() { //foreach (var a in NewYearLoginInfoDic) //{ // if (a.Value == 1) return true; //} return false; } //返回直购时间内打折扣的套装id private int GetCheckDiscountSuitId() { return 0; } public Dictionary TipsStatusDic = new Dictionary(); //珍珠赠礼是否弹窗 public bool CheckPearRebateTips(int id) { bool flog = true; ActivityOpenCfg activityCfg = ActivityOpenCfgArray.Instance.GetCfg(id); for(int i =0;i< activityCfg.paramsArr.Length;i++) { ShopCfg shopCfg = ShopCfgArray.Instance.GetCfg(activityCfg.paramsArr[i]); int buyNum = ShopDataManager.Instance.GetGoodsBuyNumById(shopCfg.id); if (shopCfg.maxBuyNum == 0 || buyNum < shopCfg.maxBuyNum) { flog = false; } } if(!flog) { if (ActivityGlobalDataManager.Instance.IsActivityOpen(id)) { return true; } else { return false; } } else { return false; } } //根据创角时间判断活动是否开启 public bool CheckActivityByRoleTime(int id) { return ActivityGlobalDataManager.Instance.IsActivityOpen(id); //ActivityOpenCfg item = ActivityOpenCfgArray.Instance.GetCfg(id); //if (item == null || item.CreatTime == 0) //{ // return false; //} ////创角时间 //long time = GameGlobal.zoneScene.GetComponent().GetCurrentRole().CreateTime; //long laterTime = (TimeHelper.ServerNow() - time) / 1000 / 60; //if (laterTime >= item.CreatTime && laterTime < (item.CreatTime + item.OpenLastTime)) //{ // return true; //} //return false; } public long GetActivityTime(int id) { ActivityOpenCfg _activityCfg = ActivityOpenCfgArray.Instance.GetCfg(id); int endTime = (_activityCfg.AfterCreatRoleTime * 24 * 60) + _activityCfg.OpenLastTime; endTime = endTime * 60; long time = GameGlobal.zoneScene.GetComponent().GetCurrentRole().CreateTime; long laterTime = (TimeHelper.ServerNow() - time)/1000; long curTime = (endTime - laterTime)* 1000; return curTime; } public bool isExtendTime(int day) { ActivityOpenCfg activityCfg = ActivityOpenCfgArray.Instance.GetCfg(5006); long endTime = TimeUtil.DateTimeToTimestamp(activityCfg.endTime); long ExtendTime = (day * 24 * 60 * 60 * 1000); long currentTime = TimeHelper.ServerNow(); if(currentTime > endTime) { if((currentTime - endTime) <= ExtendTime) { return true; } } return false; } } }