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; } /**********************************************************活动*************************************************/ /// /// 获取指定类型活动当前开启的活动id /// /// public int GetCurOpenActiveByType(int type) { List 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 lastActLimitChargeId = 0; private int _actLimitChargeId = 0; /// /// 当前限时累充活动id /// /// public int actLimitChargeId { get { return _actLimitChargeId; } set { _actLimitChargeId = value; } } /**********************************************************限时抽奖活动*********************************************/ public int lastActLuckyBoxId = 0; public int lastActLimitTsyId = 0; private int _actLuckyBoxId = 0; private int _actLuckyTsyId = 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(); 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; } 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; } /******************************************************************************************************************/ 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; } } } }