public UserDailyRestrain() : base(AccessLevel.ReadWrite) { UserExtend = new DailyUserExtend(); FunPlot = new CacheList<FunPlot>(); PlainPlotList = new CacheList<FunPlot>(); }
/// <summary> /// 增加刷新次数 /// </summary> /// <param name="userID"></param> /// <param name="cityID"></param> /// <returns></returns> public static void HeroRefreshNum(string userID, int cityID) { var cacheSet = new GameDataCacheSet<UserDailyRestrain>(); UserDailyRestrain dailyRestrain = cacheSet.FindKey(userID); if (dailyRestrain != null) { DailyUserExtend userExtend = new DailyUserExtend(); List<HeroPlot> heroList = new List<HeroPlot>(); if (dailyRestrain.UserExtend != null) { userExtend = dailyRestrain.UserExtend; if (dailyRestrain.UserExtend.HeroPlot.Count > 0) { heroList = dailyRestrain.UserExtend.HeroPlot; } } HeroPlot plot = heroList.Find(m => m.CityID.Equals(cityID)); if (plot != null) { plot.HeroNum = MathUtils.Addition(plot.HeroNum, 1); } else { heroList.Add(new HeroPlot() { CityID = cityID, HeroNum = 1, HeroList = new List<FunPlot>() }); } userExtend.HeroPlot = heroList; dailyRestrain.UserExtend = userExtend; } cacheSet.Update(); }
/// <summary> /// 英雄副本副本增加挑战次数 /// </summary> /// <param name="userID"></param> /// <param name="plotID"></param> /// <param name="_cityID"></param> public static void HeroDailyRestrain(string userID, int plotID, int _cityID) { var cacheSet = new GameDataCacheSet<UserDailyRestrain>(); UserDailyRestrain userRestrain = cacheSet.FindKey(userID); if (userRestrain != null) { DailyUserExtend userExtend = new DailyUserExtend(); List<HeroPlot> heroList = new List<HeroPlot>(); if (userRestrain.UserExtend != null) { userExtend = userRestrain.UserExtend; if (userRestrain.UserExtend.HeroPlot.Count > 0) { heroList = userRestrain.UserExtend.HeroPlot; } } HeroPlot plot = heroList.Find(m => m.CityID.Equals(_cityID)); if (plot != null) { plot.HeroList.Add(new FunPlot() { PlotID = plotID }); } else { FunPlot funPlot = new FunPlot(); funPlot.PlotID = plotID; List<FunPlot> funPlotsList = new List<FunPlot>(); funPlotsList.Add(funPlot); heroList.Add(new HeroPlot() { CityID = _cityID, HeroNum = 0, HeroList = funPlotsList }); } userExtend.HeroPlot = heroList; userRestrain.UserExtend = userExtend; cacheSet.Update(); } }
protected override object this[string index] { get { #region switch (index) { case "UserID": return UserID; case "RefreshDate": return RefreshDate; case "Funtion1": return Funtion1; case "Funtion2": return Funtion2; case "Funtion3": return Funtion3; case "Funtion4": return Funtion4; case "Funtion5": return Funtion5; case "Funtion6": return Funtion6; case "Funtion7": return Funtion7; case "Funtion8": return Funtion8; case "Funtion9": return Funtion9; case "FunPlot": return FunPlot; case "Funtion10": return Funtion10; case "Funtion11": return Funtion11; case "Funtion12": return Funtion12; case "Funtion13": return Funtion13; case "Funtion14": return Funtion14; case "Funtion15": return Funtion15; case "UserExtend": return UserExtend; case "PlainPlotList": return PlainPlotList; default: throw new ArgumentException(string.Format("UserDailyRestrain index[{0}] isn't exist.", index)); } #endregion } set { #region switch (index) { case "UserID": _UserID = value.ToNotNullString(); break; case "RefreshDate": _RefreshDate = value.ToDateTime(); break; case "Funtion1": _Funtion1 = value.ToInt(); break; case "Funtion2": _Funtion2 = value.ToInt(); break; case "Funtion3": _Funtion3 = value.ToInt(); break; case "Funtion4": _Funtion4 = value.ToInt(); break; case "Funtion5": _Funtion5 = value.ToInt(); break; case "Funtion6": _Funtion6 = value.ToInt(); break; case "Funtion7": _Funtion7 = value.ToInt(); break; case "Funtion8": _Funtion8 = value.ToInt(); break; case "Funtion9": _Funtion9 = value.ToInt(); break; case "FunPlot": _FunPlot =ConvertCustomField<CacheList<FunPlot>>(value, index); break; case "Funtion10": _Funtion10 = value.ToInt(); break; case "Funtion11": _Funtion11 = value.ToDateTime(); break; case "Funtion12": _Funtion12 = value.ToNotNullString(); break; case "Funtion13": _Funtion13 = value.ToInt(); break; case "Funtion14": _Funtion14 = value.ToInt(); break; case "Funtion15": _Funtion15 = value.ToDateTime(); break; case "UserExtend": _UserExtend = ConvertCustomField<DailyUserExtend>(value, index); break; case "PlainPlotList": _PlainPlotList = ConvertCustomField<CacheList<FunPlot>>(value, index); break; default: throw new ArgumentException(string.Format("UserDailyRestrain index[{0}] isn't exist.", index)); } #endregion } }