public bool Init() { this.ActivityType = 114; this.FromDate = "-1"; this.ToDate = "-1"; this.AwardStartDate = "-1"; this.AwardEndDate = "-1"; string fileName = Global.GameResPath("Config\\HuiGuiStore.xml"); XElement xml = XElement.Load(fileName); if (null == xml) { LogManager.WriteLog(LogTypes.Fatal, string.Format("加载系统xml配置文件:{0}, 失败。没有找到相关XML配置文件!", fileName), null, true); } try { IEnumerable <XElement> xmlItems = xml.Elements(); foreach (XElement xmlItem in xmlItems) { RegressActiveStoreXML Regress = new RegressActiveStoreXML(); Regress.ID = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "ID")); Regress.HuoDongLevel = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "HuoDongLevel")); Regress.Day = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "Day")); Regress.OrigPrice = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "OrigPrice")); Regress.Price = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "Price")); Regress.SinglePurchase = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "SinglePurchase")); string goods = Global.GetSafeAttributeStr(xmlItem, "GoodsID"); if (!string.IsNullOrEmpty(goods)) { string[] fields = goods.Split(new char[] { '|' }); if (fields.Length > 0) { Regress.GoodsID = GoodsHelper.ParseGoodsDataList(fields, fileName); } } this.regressActiveStoreXML.Add(Regress.ID, Regress); } if (this.regressActiveStoreXML == null) { return(false); } base.PredealDateTime(); } catch (Exception ex) { LogManager.WriteException(ex.ToString()); } return(true); }
public bool initialize() { bool result; if (!this._Config.Load(Global.GameResPath(CoupleWishConsts.RankAwardCfgFile), Global.GameResPath(CoupleWishConsts.WishTypeCfgFile), Global.GameResPath(CoupleWishConsts.YanHuiCfgFile))) { result = false; } else { this.StatueMgr.SetWishConfig(this._Config); if (!this.StatueMgr.LoadConfig()) { result = false; } else { foreach (CoupleWishRankAwardConfig awardItem in this._Config.RankAwardCfgList) { List <GoodsData> goods1List = GoodsHelper.ParseGoodsDataList(((string)awardItem.GoodsOneTag).Split(new char[] { '|' }), CoupleWishConsts.RankAwardCfgFile); List <GoodsData> goods2List = GoodsHelper.ParseGoodsDataList(((string)awardItem.GoodsTwoTag).Split(new char[] { '|' }), CoupleWishConsts.RankAwardCfgFile); awardItem.GoodsOneTag = goods1List; awardItem.GoodsTwoTag = goods2List; } int[] nDayMax = GameManager.systemParamsList.GetParamValueIntArrayByName("WishEffectAwardMax", ','); this.WishEffectDayMaxAward[CoupleWishManager.EWishEffectAwardType.BangJin] = nDayMax[0]; this.WishEffectDayMaxAward[CoupleWishManager.EWishEffectAwardType.BangZuan] = nDayMax[1]; this.WishEffectDayMaxAward[CoupleWishManager.EWishEffectAwardType.Exp] = nDayMax[2]; int[] nCanGetAwardMap = GameManager.systemParamsList.GetParamValueIntArrayByName("WishEffectAwardMap", ','); if (nCanGetAwardMap != null) { foreach (int i in nCanGetAwardMap) { if (!this.CanEffectAwardMap.Contains(i)) { this.CanEffectAwardMap.Add(i); } } } ScheduleExecutor2.Instance.scheduleExecute(new NormalScheduleTask("CoupleWishManager.TimerProc", new EventHandler(this.TimerProc)), 20000, 10000); result = true; } } return(result); }
public bool initialize() { if (!_Config.Load(Global.GameResPath(CoupleWishConsts.RankAwardCfgFile), Global.GameResPath(CoupleWishConsts.WishTypeCfgFile), Global.GameResPath(CoupleWishConsts.YanHuiCfgFile))) { return(false); } StatueMgr.SetWishConfig(_Config); if (!StatueMgr.LoadConfig()) { return(false); } foreach (var awardItem in _Config.RankAwardCfgList) { List <GoodsData> goods1List = GoodsHelper.ParseGoodsDataList( ((string)awardItem.GoodsOneTag).Split('|'), CoupleWishConsts.RankAwardCfgFile); List <GoodsData> goods2List = GoodsHelper.ParseGoodsDataList( ((string)awardItem.GoodsTwoTag).Split('|'), CoupleWishConsts.RankAwardCfgFile); awardItem.GoodsOneTag = goods1List; awardItem.GoodsTwoTag = goods2List; } int[] nDayMax = GameManager.systemParamsList.GetParamValueIntArrayByName("WishEffectAwardMax"); WishEffectDayMaxAward[EWishEffectAwardType.BangJin] = nDayMax[0]; WishEffectDayMaxAward[EWishEffectAwardType.BangZuan] = nDayMax[1]; WishEffectDayMaxAward[EWishEffectAwardType.Exp] = nDayMax[2]; int[] nCanGetAwardMap = GameManager.systemParamsList.GetParamValueIntArrayByName("WishEffectAwardMap"); if (nCanGetAwardMap != null) { foreach (var m in nCanGetAwardMap) { if (!this.CanEffectAwardMap.Contains(m)) { CanEffectAwardMap.Add(m); } } } ScheduleExecutor2.Instance.scheduleExecute(new NormalScheduleTask("CoupleWishManager.TimerProc", TimerProc), 20000, 10000); return(true); }
private List <GoodsData> GetAwardList() { List <GoodsData> list = new List <GoodsData>(); string[] fields; string str = GameManager.systemParamsList.GetParamValueByName("App_BindPhoneAward"); if (string.IsNullOrEmpty(str)) { return(null); } fields = str.Split('|'); if (fields.Length > 0) { list = GoodsHelper.ParseGoodsDataList(fields, "SystemParams.xml"); } return(list); }
private List <GoodsData> GetAwardList() { List <GoodsData> list = new List <GoodsData>(); string str = GameManager.systemParamsList.GetParamValueByName("App_BindPhoneAward"); List <GoodsData> result; if (string.IsNullOrEmpty(str)) { result = null; } else { string[] fields = str.Split(new char[] { '|' }); if (fields.Length > 0) { list = GoodsHelper.ParseGoodsDataList(fields, "SystemParams.xml"); } result = list; } return(result); }
public static void InitConfig() { string fileName = Global.GameResPath("Config/JianFu.xml"); XElement xml = CheckHelper.LoadXml(fileName, true); if (null != xml) { try { List <TodayInfo> todayInfoList = new List <TodayInfo>(); IEnumerable <XElement> xmlItems = xml.Elements(); foreach (XElement xmlItem in xmlItems) { if (xmlItem != null) { TodayInfo info = new TodayInfo(); info.ID = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "ID", "0")); info.Type = info.ID / 100; info.Name = Global.GetDefAttributeStr(xmlItem, "Name", "0"); info.FuBenID = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "FuBenID", "0")); info.HuoDongID = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "HuoDongID", "0")); info.LevelMin = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "MinZhuanSheng", "0")) * 100 + Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "MinLevel", "0")); info.LevelMax = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "MaxZhuanSheng", "0")) * 100 + Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "MaxLevel", "0")); info.TaskMin = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "MinTasks", "0")); info.NumMax = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "Num", "0")); TodayAwardInfo awardInfo = new TodayAwardInfo(); awardInfo.Exp = (double)Convert.ToInt64(Global.GetDefAttributeStr(xmlItem, "Exp", "0")); awardInfo.GoldBind = (double)Convert.ToInt64(Global.GetDefAttributeStr(xmlItem, "BandJinBi", "0")); awardInfo.MoJing = (double)Convert.ToInt64(Global.GetDefAttributeStr(xmlItem, "MoJing", "0")); awardInfo.ChengJiu = (double)Convert.ToInt64(Global.GetDefAttributeStr(xmlItem, "ChengJiu", "0")); awardInfo.ShengWang = (double)Convert.ToInt64(Global.GetDefAttributeStr(xmlItem, "ShengWang", "0")); awardInfo.ZhanGong = (double)Convert.ToInt64(Global.GetDefAttributeStr(xmlItem, "ZhanGong", "0")); awardInfo.DiamondBind = (double)Convert.ToInt64(Global.GetDefAttributeStr(xmlItem, "BandZuanShi", "0")); awardInfo.XingHun = (double)Convert.ToInt64(Global.GetDefAttributeStr(xmlItem, "XingHun", "0")); awardInfo.YuanSuFenMo = (double)Convert.ToInt64(Global.GetDefAttributeStr(xmlItem, "YuanSuFenMo", "0")); awardInfo.ShouHuDianShu = (double)Convert.ToInt64(Global.GetDefAttributeStr(xmlItem, "ShouHuDianShu", "0")); awardInfo.ZaiZao = (double)Convert.ToInt64(Global.GetDefAttributeStr(xmlItem, "ZaiZao", "0")); awardInfo.LingJing = (double)Convert.ToInt64(Global.GetDefAttributeStr(xmlItem, "LingJing", "0")); awardInfo.RongYao = (double)Convert.ToInt64(Global.GetDefAttributeStr(xmlItem, "RongYao", "0")); awardInfo.ExtDiamondBind = (double)Convert.ToInt64(Global.GetDefAttributeStr(xmlItem, "ExtraBandZuanShi", "0")); string goods = Global.GetDefAttributeStr(xmlItem, "Goods", "0"); if (!string.IsNullOrEmpty(goods) && !goods.Equals("0")) { string[] fields = goods.Split(new char[] { '|' }); awardInfo.GoodsList = GoodsHelper.ParseGoodsDataList(fields, fileName); } info.AwardInfo = awardInfo; todayInfoList.Add(info); } } TodayManager._todayInfoList = todayInfoList; } catch (Exception ex) { LogManager.WriteLog(LogTypes.Fatal, string.Format("加载[{0}]时出错!!!", fileName), null, true); } } }
public bool initGiftCode() { bool success = true; string fileName = ""; lock (this._lockConfig) { try { GiftCodeNewManager._GiftCodeCfgAwards.Clear(); Dictionary <string, GiftCodeInfo> newDic = new Dictionary <string, GiftCodeInfo>(); fileName = Global.GameResPath("Config/GiftCodeNew.xml"); XElement xml = CheckHelper.LoadXml(fileName, true); if (null == xml) { return(false); } IEnumerable <XElement> xmlItems = xml.Elements(); foreach (XElement xmlItem in xmlItems) { if (xmlItem != null) { GiftCodeInfo info = new GiftCodeInfo(); info.GiftCodeTypeID = Global.GetDefAttributeStr(xmlItem, "TypeID", ""); info.GiftCodeName = Global.GetDefAttributeStr(xmlItem, "TypeName", ""); info.Description = Global.GetDefAttributeStr(xmlItem, "Description", ""); info.ChannelList.Clear(); string[] channel = Global.GetDefAttributeStr(xmlItem, "Channel", "").Split(new char[] { '|' }); foreach (string p in channel) { if (!string.IsNullOrEmpty(p)) { info.ChannelList.Add(p); } } info.PlatformList.Clear(); string[] platform = Global.GetDefAttributeStr(xmlItem, "Platform", "").Split(new char[] { '|' }); foreach (string p in platform) { if (!string.IsNullOrEmpty(p)) { info.PlatformList.Add(Global.SafeConvertToInt32(p)); } } string timeBegin = Global.GetDefAttributeStr(xmlItem, "TimeBegin", ""); string timeEnd = Global.GetDefAttributeStr(xmlItem, "TimeEnd", ""); if (!string.IsNullOrEmpty(timeBegin)) { info.TimeBegin = DateTime.Parse(timeBegin); } if (!string.IsNullOrEmpty(timeEnd)) { info.TimeEnd = DateTime.Parse(timeEnd); } info.ZoneList.Clear(); string[] zone = Global.GetDefAttributeStr(xmlItem, "Zone", "").Split(new char[] { '|' }); foreach (string p in zone) { if (!string.IsNullOrEmpty(p)) { info.ZoneList.Add(Global.SafeConvertToInt32(p)); } } info.UserType = (GiftCodeUserType)Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "UserType", "0")); info.UseCount = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "UseCount", "0")); string goods = Global.GetSafeAttributeStr(xmlItem, "GoodsOne"); if (!string.IsNullOrEmpty(goods)) { string[] fields = goods.Split(new char[] { '|' }); if (fields.Length > 0) { info.GoodsList = GoodsHelper.ParseGoodsDataList(fields, fileName); } } goods = Global.GetSafeAttributeStr(xmlItem, "GoodsTwo"); if (!string.IsNullOrEmpty(goods)) { string[] fields = goods.Split(new char[] { '|' }); if (fields.Length > 0) { info.ProGoodsList = GoodsHelper.ParseGoodsDataList(fields, fileName); } } newDic.Add(info.GiftCodeTypeID, info); } } GiftCodeNewManager._GiftCodeCfgAwards = newDic; } catch (Exception ex) { success = false; LogManager.WriteLog(LogTypes.Fatal, string.Format("[GiftCodeNew]加载xml配置文件:{0}, 失败。", fileName), ex, true); } } return(success); }
public static bool initConfig() { string fileName = Global.GameResPath("Config/TenAward.xml"); XElement xml = CheckHelper.LoadXml(fileName, true); bool result; if (null == xml) { result = false; } else { try { TenManager._tenAwardDic.Clear(); IEnumerable <XElement> xmlItems = xml.Elements(); foreach (XElement xmlItem in xmlItems) { if (xmlItem != null) { TenAwardData config = new TenAwardData(); config.AwardID = Convert.ToInt32(Global.GetSafeAttributeLong(xmlItem, "ID")); config.AwardName = Global.GetSafeAttributeStr(xmlItem, "Name"); config.DbKey = Global.GetSafeAttributeStr(xmlItem, "DbKey"); config.DayMaxNum = Convert.ToInt32(Global.GetSafeAttributeLong(xmlItem, "DayMaxNum")); config.OnlyNum = Convert.ToInt32(Global.GetSafeAttributeLong(xmlItem, "OnlyNum")); config.MailUser = GLang.GetLang(112, new object[0]); config.MailTitle = Global.GetSafeAttributeStr(xmlItem, "MailTitle"); config.MailContent = Global.GetSafeAttributeStr(xmlItem, "MailContent"); string beginTime = Global.GetDefAttributeStr(xmlItem, "BeginDate", ""); string endTime = Global.GetDefAttributeStr(xmlItem, "EndDate", ""); string roleLevel = Global.GetDefAttributeStr(xmlItem, "Level", "0,1"); if (string.IsNullOrEmpty(beginTime)) { config.BeginTime = DateTime.MinValue; } else { config.BeginTime = DateTime.Parse(beginTime); } if (string.IsNullOrEmpty(endTime)) { config.EndTime = DateTime.MaxValue; } else { config.EndTime = DateTime.Parse(endTime); } string[] arrLevel = roleLevel.Split(new char[] { ',' }); config.RoleLevel = int.Parse(arrLevel[0]) * 100 + int.Parse(arrLevel[1]); string awards = Global.GetSafeAttributeStr(xmlItem, "AwardGoods"); if (!string.IsNullOrEmpty(awards)) { string[] awardsArr = awards.Split(new char[] { '|' }); config.AwardGoods = GoodsHelper.ParseGoodsDataList(awardsArr, fileName); } TenManager._tenAwardDic.Add(config.AwardID, config); } } TenManager.initDb(); } catch (Exception) { LogManager.WriteLog(LogTypes.Error, "加载Config/TenAward.xml时文件出现异常!!!", null, true); Process.GetCurrentProcess().Kill(); return(false); } result = true; } return(result); }
private static bool InitConfig() { string fileName = ""; string[] fields; string goods = ""; try { #region ----------count _awardCountDic.Clear(); fileName = Global.IsolateResPath("Config/TuiGuang/TuiGuangYuanLeiJi.xml"); XElement xml = CheckHelper.LoadXml(fileName); if (null == xml) { return(false); } XElement args = xml.Element("GiftList"); if (null == args) { return(false); } IEnumerable <XElement> xmlItems = args.Elements(); foreach (var xmlItem in xmlItems) { if (xmlItem == null) { continue; } SpreadCountAwardInfo info = new SpreadCountAwardInfo(); info.Count = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "MinNum", "0")); goods = Global.GetSafeAttributeStr(xmlItem, "GoodsOne"); if (!string.IsNullOrEmpty(goods)) { fields = goods.Split('|'); if (fields.Length > 0) { info.DefaultGoodsList = GoodsHelper.ParseGoodsDataList(fields, fileName); } } goods = Global.GetSafeAttributeStr(xmlItem, "GoodsTwo"); if (!string.IsNullOrEmpty(goods)) { fields = goods.Split('|'); if (fields.Length > 0) { info.ProGoodsList = GoodsHelper.ParseGoodsDataList(fields, fileName); } } _awardCountDic.Add(info.Count, info); } #endregion #region ----------level _levelLimit = 0; _awardLevelInfo = new SpreadAwardInfo(); fileName = Global.IsolateResPath("Config/TuiGuang/TuiGuangYuanLevel.xml"); xml = CheckHelper.LoadXml(fileName); if (null == xml) { return(false); } args = xml.Element("TuiGuangYuanLevel"); if (null == args) { return(false); } int zhuanSheng = Convert.ToInt32(Global.GetDefAttributeStr(args, "MinZhuanSheng", "0")); int level = Convert.ToInt32(Global.GetDefAttributeStr(args, "MinLevel", "0")); _levelLimit = zhuanSheng * 100 + level; args = xml.Element("GiftList").Element("Award"); if (null == args) { return(false); } goods = Global.GetSafeAttributeStr(args, "GoodsOne"); if (!string.IsNullOrEmpty(goods)) { fields = goods.Split('|'); if (fields.Length > 0) { _awardLevelInfo.DefaultGoodsList = GoodsHelper.ParseGoodsDataList(fields, fileName); } } goods = Global.GetSafeAttributeStr(args, "GoodsTwo"); if (!string.IsNullOrEmpty(goods)) { fields = goods.Split('|'); if (fields.Length > 0) { _awardLevelInfo.ProGoodsList = GoodsHelper.ParseGoodsDataList(fields, fileName); } } #endregion #region ----------vip _vipLimit = 0; _awardVipInfo = new SpreadAwardInfo(); fileName = Global.IsolateResPath("Config/TuiGuang/TuiGuangYuanVip.xml"); xml = CheckHelper.LoadXml(fileName); if (null == xml) { return(false); } args = xml.Element("TuiGuangYuanVip"); if (null == args) { return(false); } _vipLimit = Convert.ToInt32(Global.GetDefAttributeStr(args, "VipLevel", "0")); args = xml.Element("GiftList").Element("Award"); if (null == args) { return(false); } goods = Global.GetSafeAttributeStr(args, "GoodsOne"); if (!string.IsNullOrEmpty(goods)) { fields = goods.Split('|'); if (fields.Length > 0) { _awardVipInfo.DefaultGoodsList = GoodsHelper.ParseGoodsDataList(fields, fileName); } } goods = Global.GetSafeAttributeStr(args, "GoodsTwo"); if (!string.IsNullOrEmpty(goods)) { fields = goods.Split('|'); if (fields.Length > 0) { _awardVipInfo.ProGoodsList = GoodsHelper.ParseGoodsDataList(fields, fileName); } } #endregion #region ----------verify _awardVerifyInfo = new SpreadAwardInfo(); fileName = Global.IsolateResPath("Config/TuiGuang/TuiGuangXinYongHu.xml"); xml = CheckHelper.LoadXml(fileName); if (null == xml) { return(false); } args = xml.Element("GiftList").Element("Award"); if (null == args) { return(false); } goods = Global.GetSafeAttributeStr(args, "GoodsOne"); if (!string.IsNullOrEmpty(goods)) { fields = goods.Split('|'); if (fields.Length > 0) { _awardVerifyInfo.DefaultGoodsList = GoodsHelper.ParseGoodsDataList(fields, fileName); } } goods = Global.GetSafeAttributeStr(args, "GoodsTwo"); if (!string.IsNullOrEmpty(goods)) { fields = goods.Split('|'); if (fields.Length > 0) { _awardVerifyInfo.ProGoodsList = GoodsHelper.ParseGoodsDataList(fields, fileName); } } #endregion string createDate = GameManager.systemParamsList.GetParamValueByName("TuiGuangCreatData"); _createDate = DateTime.Parse(createDate); _vipCountMax = (int)GameManager.systemParamsList.GetParamValueIntByName("TuiGuangVIPRewardNum", VIP_LEVEL_COUNT_MAX_DEFAULT); _levelCountMax = (int)GameManager.systemParamsList.GetParamValueIntByName("TuiGuangLevelRewardNum", VIP_LEVEL_COUNT_MAX_DEFAULT); } catch (System.Exception ex) { LogManager.WriteLog(LogTypes.Fatal, string.Format("加载xml配置文件:{0}, 失败。", fileName), ex); return(false); } return(true); }