123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286 |
- using System.Collections.Generic;
- namespace GFGGame
- {
- public class ActivityDataManager : SingletonBase<ActivityDataManager>
- {
- public void Clear()
- {
- luckyBoxActBonusState.Clear();
- allPlayTimes = 0;
- lastActLuckyBoxId = 0;
- lastActLimitChargeId = 0;
- luckyActTsyBonusState.Clear();
- allTsyPlayTimes = 0;
- lastActLimitTsyId = 0;
- limitStlycActBonusState.Clear();
- allLimitStlycTimes = 0;
- lastActLimitStlycId = 0;
- }
- /**********************************************************活动*************************************************/
- /// <summary>
- /// 获取指定类型活动当前开启的活动id
- /// </summary>
- /// <returns></returns>
- public int GetCurOpenActiveByType(int type)
- {
- List<ActivityOpenCfg> activityOpenCfgs = ActivityOpenCfgArray.Instance.GetCfgsBytype(type);
- for (int i = 0; i < activityOpenCfgs.Count; i++)
- {
- if (TimeUtil.IsBeforeCurTime(activityOpenCfgs[i].openTime) && TimeUtil.IsLaterCurTime(activityOpenCfgs[i].endTime))
- {
- return activityOpenCfgs[i].id;
- }
- }
- return 0;
- }
- /**********************************************************活动弹窗*************************************************/
- public int todayActivityTips = 0;
- public int todayMonthlyCardTips = 0;
- /**********************************************************限时累充*************************************************/
- public int lastActLimitChargeId = 0;
- private int _actLimitChargeId = 0;
- /// <summary>
- /// 当前限时累充活动id
- /// </summary>
- /// <value></value>
- 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;
- /// <summary>
- /// 当前抽奖活动id
- /// </summary>
- /// <value></value>
- public int actLuckyBoxId { get { return _actLuckyBoxId; } set { _actLuckyBoxId = value; } }
- /// <summary>
- /// 抽奖总次数
- /// </summary>
- /// <value></value>
- public long allPlayTimes { get; set; }
- /// <summary>
- /// 限时抽奖必掉次数
- /// </summary>
- /// <value></value>
- public int lastDrawCount { get; set; }
- /// <summary>
- /// </summary>
- /// <typeparam name="int">奖励key,这里对应抽奖次数</typeparam>
- /// <typeparam name="int">值由ConstBonusStatus定义</typeparam>
- /// <returns></returns>
- public Dictionary<int, int> luckyBoxActBonusState = new Dictionary<int, int>();
- /// <summary>
- /// 当前天市垣抽奖活动id
- /// </summary>
- /// <value></value>
- public int actLimitTsyId { get { return _actLuckyTsyId; } set { _actLuckyTsyId = value; } }
- /// <summary>
- /// 天市垣抽奖总次数
- /// </summary>
- /// <value></value>
- public long allTsyPlayTimes { get; set; }
- /// <summary>
- /// 限时天市垣抽奖必掉次数
- /// </summary>
- /// <value></value>
- public int lastTsyDrawCount { get; set; }
- /// <summary>
- /// </summary>
- /// <typeparam name="int">奖励key,这里对应天市垣抽奖次数</typeparam>
- /// <typeparam name="int">值由ConstBonusStatus定义</typeparam>
- /// <returns></returns>
- public Dictionary<int, int> luckyActTsyBonusState = new Dictionary<int, int>();
- /// <summary>
- /// 当前隋唐洛阳城活动id
- /// </summary>
- /// <value></value>
- public int actLimitStlycId { get { return _actLimitStlycId; } set { _actLimitStlycId = value; } }
- /// <summary>
- /// 开服活动抽奖总次数
- /// </summary>
- /// <value></value>
- public long allLimitStlycTimes { get; set; }
- /// <summary>
- /// 开服抽奖必掉次数
- /// </summary>
- /// <value></value>
- public int lastStlycDrawCount { get; set; }
- /// <summary>
- /// </summary>
- /// <typeparam name="int">奖励key,这里对应抽奖次数</typeparam>
- /// <typeparam name="int">值由ConstBonusStatus定义</typeparam>
- /// <returns></returns>
- public Dictionary<int, int> limitStlycActBonusState = new Dictionary<int, int>();
- public List<ActivityLuckybonusCfg> SortActivityLuckybonusCfg(List<ActivityLuckybonusCfg> 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;
- /// <summary>
- /// 七日登录 当日奖励id
- /// </summary>
- /// <value></value>
- public int sevenDayLoginLoginId
- {
- get { return _sevenDayLoginLoginId; }
- set { _sevenDayLoginLoginId = value; }
- }
- private int _sevenDayLoginBonusStatus = 0;
- /// <summary>
- /// 七日登录 当前奖励状态
- /// </summary>
- /// <value></value>
- public int sevenDayLoginBonusStatus
- {
- get { return _sevenDayLoginBonusStatus; }
- set { _sevenDayLoginBonusStatus = value; }
- }
- /******************************************************************************************************************/
- /**********************************************************每日登录修改*************************************************/
- public List<int> sevenDayLoginLoginIdList = new List<int>();
- /// <summary>
- /// 七日登录 当日奖励id
- /// </summary>
- /// <value></value>
- public List<int> sevenDayLoginBonusStatusList = new List<int>();
- /// <summary>
- /// 七日登录 当前奖励状态
- /// </summary>
- /// <value></value>
- ///
- 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;
- }
- /******************************************************************************************************************/
- private int _firstChargeBonusStatus = 0;
- /// <summary>
- /// 首冲奖励 当前奖励状态,ConstBonusStatus 0不可领,1可领,2已领
- /// </summary>
- /// <value></value>
- 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<int> ActivityZCJBList = new List<int>();
- public bool CheckZCJBRed()
- {
- ItemData numItem;
- long num;
- if(BagDataManager.Instance.GetBagData().TryGetValue(3000023, 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;
- }
- /**********************************************************每日登录修改*************************************************/
- /// <summary>
- /// 新年签到 登录第几天列表 奖励状态列表
- /// </summary>
- /// <value></value>
- public Dictionary<int,int> NewYearLoginInfoDic = new Dictionary<int, int>();
- public bool CanGetNewYearLoginRed()
- {
- foreach (var a in NewYearLoginInfoDic)
- {
- if (a.Value == 1) return true;
- }
- return false;
- }
- }
- }
|