Example #1
0
 public bool Init()
 {
     try
     {
         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(this.CfgFile));
         XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(this.CfgFile));
         if (null == xml)
         {
             return(false);
         }
         XElement args = xml.Element("Activities");
         if (null != args)
         {
             this.FromDate       = Global.GetSafeAttributeStr(args, "FromDate");
             this.ToDate         = Global.GetSafeAttributeStr(args, "ToDate");
             this.ActivityType   = (int)Global.GetSafeAttributeLong(args, "ActivityType");
             this.AwardStartDate = Global.GetSafeAttributeStr(args, "AwardStartDate");
             this.AwardEndDate   = Global.GetSafeAttributeStr(args, "AwardEndDate");
         }
         args = xml.Element("GiftList");
         if (null != args)
         {
             IEnumerable <XElement> xmlItems = args.Elements();
             foreach (XElement xmlItem in xmlItems)
             {
                 if (null != xmlItem)
                 {
                     JieriPlatChargeKing.ChargeItem ci = new JieriPlatChargeKing.ChargeItem();
                     ci.Rank         = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                     ci.NeedChargeYB = (int)Global.GetSafeAttributeLong(xmlItem, "MinYuanBao");
                     this.chargeItemList.Add(ci);
                 }
             }
             this.chargeItemList.Sort(delegate(JieriPlatChargeKing.ChargeItem left, JieriPlatChargeKing.ChargeItem right)
             {
                 int result;
                 if (left.Rank < right.Rank)
                 {
                     result = -1;
                 }
                 else if (left.Rank > right.Rank)
                 {
                     result = 1;
                 }
                 else
                 {
                     result = 0;
                 }
                 return(result);
             });
         }
         base.PredealDateTime();
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", this.CfgFile, ex.Message), null, true);
         return(false);
     }
     return(true);
 }
Example #2
0
        public static void LoadConfig()
        {
            GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(YueKaManager.YUE_KA_GOODS_FILE));
            XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(YueKaManager.YUE_KA_GOODS_FILE));

            if (xml == null)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时出错!!!文件不存在", YueKaManager.YUE_KA_GOODS_FILE), null, true);
            }
            else
            {
                try
                {
                    IEnumerable <XElement> xmlItems = xml.Elements();
                    foreach (XElement xmlItem in xmlItems)
                    {
                        if (null != xmlItem)
                        {
                            YueKaAward award = new YueKaAward();
                            award.Init(xmlItem);
                            YueKaManager.AllGoodsDict[award.Day] = award;
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时异常{1}", YueKaManager.YUE_KA_GOODS_FILE, ex), null, true);
                }
            }
        }
 public bool Init()
 {
     try
     {
         string fileName = "Config/JieRiGifts/JieRiChongZhiQiangGou.xml";
         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
         XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
         if (null == xml)
         {
             return(false);
         }
         XElement args = xml.Element("Activities");
         if (null != args)
         {
             this.FromDate       = Global.GetSafeAttributeStr(args, "FromDate");
             this.ToDate         = Global.GetSafeAttributeStr(args, "ToDate");
             this.ActivityType   = (int)Global.GetSafeAttributeLong(args, "ActivityType");
             this.AwardStartDate = Global.GetSafeAttributeStr(args, "AwardStartDate");
             this.AwardEndDate   = Global.GetSafeAttributeStr(args, "AwardEndDate");
         }
         args = xml.Element("GiftList");
         if (null != args)
         {
             IEnumerable <XElement> xmlItems = args.Elements();
             foreach (XElement xmlItem in xmlItems)
             {
                 JieriCZQGConfigData item = new JieriCZQGConfigData();
                 item.ID             = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                 item.ZhiGouID       = (int)Global.GetSafeAttributeLong(xmlItem, "ZhiGouID");
                 item.SinglePurchase = (int)Global.GetSafeAttributeLong(xmlItem, "SinglePurchase");
                 string GoodsOne = Global.GetSafeAttributeStr(xmlItem, "GoodsOne");
                 string GoodsTwo = Global.GetSafeAttributeStr(xmlItem, "GoodsTwo");
                 UserMoneyMgr.getInstance().CheckChargeItemConfigLogic(item.ZhiGouID, item.SinglePurchase, GoodsOne, GoodsTwo, string.Format("充值抢购 ID={0}", item.ID));
                 string   DayString = Global.GetSafeAttributeStr(xmlItem, "Day");
                 string[] DayFiled  = DayString.Split(new char[]
                 {
                     ','
                 });
                 if (DayFiled.Length == 2)
                 {
                     int      SpanFromDay = Global.SafeConvertToInt32(DayFiled[0]) - 1;
                     int      SpanToDay   = Global.SafeConvertToInt32(DayFiled[1]);
                     DateTime startTime   = DateTime.Parse(this.FromDate);
                     item.FromDate = Global.GetAddDaysDataTime(startTime, SpanFromDay, true);
                     item.ToDate   = Global.GetAddDaysDataTime(startTime, SpanToDay, true);
                 }
                 this.CZQGConfigDict[item.ID] = item;
                 this.CZQGZhiGouIDSet.Add(item.ZhiGouID);
             }
         }
         base.PredealDateTime();
         GlobalEventSource.getInstance().registerListener(36, this);
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", "Config/JieRiGifts/JieRiChongZhiQiangGou.xml", ex.Message), null, true);
         return(false);
     }
     return(true);
 }
 public bool Init()
 {
     try
     {
         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath("Config/JieRiGifts/JieRiQuanMinHongBao.xml"));
         XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath("Config/JieRiGifts/JieRiQuanMinHongBao.xml"));
         if (null == xml)
         {
             return(false);
         }
         lock (this.Mutex)
         {
             this.RedPacketsQuanMinMessage = GameManager.systemParamsList.GetParamValueByName("RedPacketsQuanMinMessage");
             this.HongBaoDict.Clear();
             XElement args = xml.Element("Activities");
             if (null != args)
             {
                 this.FromDate       = Global.GetSafeAttributeStr(args, "FromDate");
                 this.ToDate         = Global.GetSafeAttributeStr(args, "ToDate");
                 this.ActivityType   = (int)Global.GetSafeAttributeLong(args, "ActivityType");
                 this.AwardStartDate = Global.GetSafeAttributeStr(args, "AwardStartDate");
                 this.AwardEndDate   = Global.GetSafeAttributeStr(args, "AwardEndDate");
             }
             base.PredealDateTime();
             args = xml.Element("GiftList");
             if (null != args)
             {
                 IEnumerable <XElement> xmlItems = args.Elements();
                 foreach (XElement xmlItem in xmlItems)
                 {
                     if (null != xmlItem)
                     {
                         RedPacketPeopleItem item = new RedPacketPeopleItem();
                         item.ID            = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                         item.Day           = (int)Global.GetSafeAttributeLong(xmlItem, "Day");
                         item.Time          = TimeSpan.Parse(Global.GetSafeAttributeStr(xmlItem, "Time"));
                         item.RedPacketSize = (int)Global.GetSafeAttributeLong(xmlItem, "RedPacketSize");
                         item.Interval      = Global.GetSafeAttributeIntArray(xmlItem, "Interval", -1, ',');
                         item.DurationTime  = (int)Global.GetSafeAttributeLong(xmlItem, "DurationTime");
                         item.SendTime      = this.StartTime.AddDays((double)(item.Day - 1)).Add(item.Time);
                         this.HongBaoDict.Add(item.ID, item);
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", "Config/JieRiGifts/JieRiQuanMinHongBao.xml", ex.Message), null, true);
         return(false);
     }
     return(true);
 }
 public bool Init()
 {
     try
     {
         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath("Config/JieRiGifts/JieRiChongZhiHongBao.xml"));
         XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath("Config/JieRiGifts/JieRiChongZhiHongBao.xml"));
         if (null == xml)
         {
             return(false);
         }
         lock (this.Mutex)
         {
             this.HongBaoDict.Clear();
             XElement args = xml.Element("Activities");
             if (null != args)
             {
                 this.FromDate       = Global.GetSafeAttributeStr(args, "FromDate");
                 this.ToDate         = Global.GetSafeAttributeStr(args, "ToDate");
                 this.ActivityType   = (int)Global.GetSafeAttributeLong(args, "ActivityType");
                 this.AwardStartDate = Global.GetSafeAttributeStr(args, "AwardStartDate");
                 this.AwardEndDate   = Global.GetSafeAttributeStr(args, "AwardEndDate");
             }
             args = xml.Element("GiftList");
             if (null != args)
             {
                 IEnumerable <XElement> xmlItems = args.Elements();
                 foreach (XElement xmlItem in xmlItems)
                 {
                     if (null != xmlItem)
                     {
                         JieRiChongZhiHongBaoInfo item = new JieRiChongZhiHongBaoInfo();
                         item.ID = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                         item.RechargeDifference = (int)Global.GetSafeAttributeLong(xmlItem, "RechargeDifference");
                         item.PlatformID         = Global.GetSafeAttributeStr(xmlItem, "PlatformID");
                         item.RedPacketSize      = (int)Global.GetSafeAttributeLong(xmlItem, "RedPacketSize");
                         item.Interval           = Global.GetSafeAttributeIntArray(xmlItem, "Interval", -1, ',');
                         item.DurationTime       = (int)Global.GetSafeAttributeLong(xmlItem, "DurationTime");
                         this.HongBaoDict.Add(item.ID, item);
                     }
                 }
             }
             base.PredealDateTime();
             this.ActivityKeyStr = string.Format("{0}_{1}", this.FromDate.Replace(':', '$'), this.ToDate.Replace(':', '$'));
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", "Config/JieRiGifts/JieRiChongZhiHongBao.xml", ex.Message), null, true);
         return(false);
     }
     return(true);
 }
Example #6
0
 public bool Init()
 {
     try
     {
         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath("Config/ThemeActivityZhiGou.xml"));
         XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath("Config/ThemeActivityZhiGou.xml"));
         if (null == xml)
         {
             return(false);
         }
         this.ActivityType   = 150;
         this.FromDate       = "-1";
         this.ToDate         = "-1";
         this.AwardStartDate = "-1";
         this.AwardEndDate   = "-1";
         IEnumerable <XElement> xmlItems = xml.Elements();
         foreach (XElement xmlItem in xmlItems)
         {
             if (null != xmlItem)
             {
                 ThemeZhiGouConfig config = new ThemeZhiGouConfig();
                 config.ID             = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                 config.ZhiGouID       = (int)Global.GetSafeAttributeLong(xmlItem, "ZhiGouID");
                 config.SinglePurchase = (int)Global.GetSafeAttributeLong(xmlItem, "SinglePurchase");
                 int[] dayFromEnd = Global.GetSafeAttributeIntArray(xmlItem, "Day", -1, ',');
                 if (dayFromEnd.Length == 2)
                 {
                     config.FromDate = Global.GetKaiFuTime().AddDays((double)(dayFromEnd[0] - 1));
                     config.ToDate   = Global.GetKaiFuTime().AddDays((double)dayFromEnd[1]);
                 }
                 string GoodsOne = Global.GetSafeAttributeStr(xmlItem, "GoodsOne");
                 string GoodsTwo = Global.GetSafeAttributeStr(xmlItem, "GoodsTwo");
                 this.ThemeZhiGouConfigData[config.ID] = config;
                 UserMoneyMgr.getInstance().CheckChargeItemConfigLogic(config.ZhiGouID, config.SinglePurchase, GoodsOne, GoodsTwo, string.Format("主题服直购 ID={0}", config.ID));
             }
         }
         base.PredealDateTime();
         GlobalEventSource.getInstance().registerListener(36, this);
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", "Config/OneDollarBuy.xml", ex.Message), null, true);
         return(false);
     }
     return(true);
 }
Example #7
0
 public bool Init()
 {
     try
     {
         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath("Config/SanZhouNian_ChongZhiFanLi.xml"));
         XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath("Config/SanZhouNian_ChongZhiFanLi.xml"));
         if (null == xml)
         {
             return(false);
         }
         this.ActivityType = 48;
         XElement args = xml.Element("SanZhouNian_ChongZhiFanLi");
         if (null != args)
         {
             this.FromDate       = Global.GetSafeAttributeStr(args, "HuoDongKaiQi");
             this.ToDate         = Global.GetSafeAttributeStr(args, "HuoDongGuanBi");
             this.AwardStartDate = this.FromDate;
             this.AwardEndDate   = this.ToDate;
             this.InputFanLiNewData.ChongZhiJinEList    = Global.GetSafeAttributeIntArray(args, "ChongZhiJinE", -1, ',');
             this.InputFanLiNewData.FanZuanShuLiangList = Global.GetSafeAttributeIntArray(args, "FanZuanShuLiang", -1, ',');
             this.InputFanLiNewData.XiaoFeiZuanShiList  = Global.GetSafeAttributeIntArray(args, "XiaoFeiZuanShi", -1, ',');
             this.OpenStateVavle = (((int)Global.GetSafeAttributeLong(args, "HuoDongKaiGuan") > 0) ? 1 : 0);
             if (this.InputFanLiNewData.ChongZhiJinEList == null || this.InputFanLiNewData.FanZuanShuLiangList == null || null == this.InputFanLiNewData.XiaoFeiZuanShiList)
             {
                 LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常", "Config/SanZhouNian_ChongZhiFanLi.xml"), null, true);
                 return(false);
             }
             bool lengthCheck = this.InputFanLiNewData.ChongZhiJinEList.Length == this.InputFanLiNewData.FanZuanShuLiangList.Length;
             if (!(lengthCheck & this.InputFanLiNewData.ChongZhiJinEList.Length == this.InputFanLiNewData.XiaoFeiZuanShiList.Length))
             {
                 LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常", "Config/SanZhouNian_ChongZhiFanLi.xml"), null, true);
                 return(false);
             }
         }
         base.PredealDateTime();
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", "Config/SanZhouNian_ChongZhiFanLi.xml", ex.Message), null, true);
         return(false);
     }
     return(true);
 }
Example #8
0
        /// <summary>
        /// 加载声望勋章额外信息
        /// </summary>
        public static bool LoadPrestigeMedalSpecialData()
        {
            string fileName = "Config/ShengWangSpecialAttribute.xml";

            GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));

            XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));

            if (null == xml)
            {
                LogManager.WriteLog(LogTypes.Fatal, "加载Config/ShengWangSpecialAttribute.xml时出错!!!文件不存在");
                return(false);
            }

            try
            {
                _prestigeMedalSpecialList.Clear();

                IEnumerable <XElement> xmlItems = xml.Elements();
                foreach (var xmlItem in xmlItems)
                {
                    if (xmlItem == null)
                    {
                        continue;
                    }

                    PrestigeMedalSpecialData config = new PrestigeMedalSpecialData();
                    config.SpecialID    = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "ID", "0"));
                    config.MedalID      = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "NeedFuWen", "0"));
                    config.DoubleAttack = Convert.ToDouble(Global.GetDefAttributeStr(xmlItem, "ZhiMingYiJi", "0"));
                    config.DiDouble     = Convert.ToDouble(Global.GetDefAttributeStr(xmlItem, "DiKangZhiMingYiJi", "0"));
                    _prestigeMedalSpecialList.Add(config.MedalID, config);
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Fatal, "加载Config/ShengWangSpecialAttribute.xml时出现异常!!!", ex);
                return(false);
            }

            return(true);
        }
Example #9
0
        /// <summary>
        /// 加载声望勋章基本信息
        /// </summary>
        public static bool LoadPrestigeMedalBasicData()
        {
            string fileName = "Config/ShengWangXunZhang.xml";

            GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));

            XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));

            if (null == xml)
            {
                LogManager.WriteLog(LogTypes.Fatal, "加载Config/ShengWangXunZhang.xml时出错!!!文件不存在");
                return(false);
            }

            try
            {
                _prestigeMedalBasicList.Clear();

                IEnumerable <XElement> xmlItems = xml.Elements();
                foreach (var xmlItem in xmlItems)
                {
                    if (xmlItem == null)
                    {
                        continue;
                    }

                    PrestigeMedalBasicData config = new PrestigeMedalBasicData();
                    config.MedalID      = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "ID", "0"));
                    config.MedalName    = Convert.ToString(Global.GetDefAttributeStr(xmlItem, "Name", ""));
                    config.LifeMax      = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "LifeV", "0"));
                    config.AttackMax    = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "AddAttack", "0"));
                    config.DefenseMax   = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "AddDefense", "0"));
                    config.HitMax       = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "HitV", "0"));
                    config.PrestigeCost = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "CostShengWang", "0"));

                    string addString = Convert.ToString(Global.GetDefAttributeStr(xmlItem, "QiangHua", ""));
                    if (addString.Length > 0)
                    {
                        config.RateList   = new List <int>();
                        config.AddNumList = new List <int[]>();

                        string[] addArr = addString.Split('|');
                        foreach (string str in addArr)
                        {
                            string[] oneArr = str.Split(',');

                            float rate = float.Parse(oneArr[0]);
                            config.RateList.Add((int)(rate * 100));

                            List <int> numList = new List <int>();
                            for (int i = 1; i < oneArr.Length; i++)
                            {
                                numList.Add(int.Parse(oneArr[i]));
                            }

                            config.AddNumList.Add(numList.ToArray());
                        }
                    }

                    _prestigeMedalBasicList.Add(config.MedalID, config);
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Fatal, "加载Config/ShengWangXunZhang.xml时文件出现异常!!!", ex);
                return(false);
            }

            return(true);
        }
Example #10
0
 public bool Init()
 {
     try
     {
         this.allAwardDict.Clear();
         this.occAwardDict.Clear();
         this.timeAwardDict.Clear();
         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath("Config/JieRiGifts/JieRiHongBaoBang.xml"));
         XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath("Config/JieRiGifts/JieRiHongBaoBang.xml"));
         if (null == xml)
         {
             return(false);
         }
         XElement args = xml.Element("Activities");
         if (null != args)
         {
             this.FromDate       = Global.GetSafeAttributeStr(args, "FromDate");
             this.ToDate         = Global.GetSafeAttributeStr(args, "ToDate");
             this.ActivityType   = (int)Global.GetSafeAttributeLong(args, "ActivityType");
             this.AwardStartDate = Global.GetSafeAttributeStr(args, "AwardStartDate");
             this.AwardEndDate   = Global.GetSafeAttributeStr(args, "AwardEndDate");
         }
         args = xml.Element("GiftList");
         if (null != args)
         {
             IEnumerable <XElement> xmlItems = args.Elements();
             foreach (XElement xmlItem in xmlItems)
             {
                 if (null != xmlItem)
                 {
                     AwardItem           myAwardItem   = new AwardItem();
                     AwardItem           myAwardItem2  = new AwardItem();
                     AwardEffectTimeItem timeAwardItem = new AwardEffectTimeItem();
                     myAwardItem.MinAwardCondionValue = Global.GMax(0, (int)Global.GetSafeAttributeLong(xmlItem, "Threshold"));
                     myAwardItem.AwardYuanBao         = 0;
                     string goodsIDs = Global.GetSafeAttributeStr(xmlItem, "GoodsOne");
                     if (string.IsNullOrEmpty(goodsIDs))
                     {
                         LogManager.WriteLog(LogTypes.Warning, string.Format("读取{0}配置文件中的物品配置项失败", "Config/JieRiGifts/JieRiHongBaoBang.xml"), null, true);
                     }
                     else
                     {
                         string[] fields = goodsIDs.Split(new char[]
                         {
                             '|'
                         });
                         if (fields.Length <= 0)
                         {
                             LogManager.WriteLog(LogTypes.Warning, string.Format("读取{0}配置文件中的物品配置项失败", "Config/JieRiGifts/JieRiHongBaoBang.xml"), null, true);
                         }
                         else
                         {
                             myAwardItem.GoodsDataList = HuodongCachingMgr.ParseGoodsDataList(fields, "大型节日赠送王活动配置");
                         }
                     }
                     goodsIDs = Global.GetSafeAttributeStr(xmlItem, "GoodsTwo");
                     if (!string.IsNullOrEmpty(goodsIDs))
                     {
                         string[] fields = goodsIDs.Split(new char[]
                         {
                             '|'
                         });
                         if (fields.Length <= 0)
                         {
                             LogManager.WriteLog(LogTypes.Warning, string.Format("读取{0}配置文件中的物品配置项失败", "Config/JieRiGifts/JieRiHongBaoBang.xml"), null, true);
                         }
                         else
                         {
                             myAwardItem2.GoodsDataList = HuodongCachingMgr.ParseGoodsDataList(fields, "大型节日赠送王活动配置");
                         }
                     }
                     string timeGoods = Global.GetSafeAttributeStr(xmlItem, "GoodsThr");
                     string timeList  = Global.GetSafeAttributeStr(xmlItem, "EffectiveTime");
                     timeAwardItem.Init(timeGoods, timeList, "大型节日赠送王时效性物品活动配置");
                     string   rankings = Global.GetSafeAttributeStr(xmlItem, "Ranking");
                     string[] paiHangs = rankings.Split(new char[]
                     {
                         '-'
                     });
                     if (paiHangs.Length > 0)
                     {
                         int min = Global.SafeConvertToInt32(paiHangs[0]);
                         int max = Global.SafeConvertToInt32(paiHangs[paiHangs.Length - 1]);
                         for (int paiHang = min; paiHang <= max; paiHang++)
                         {
                             this.allAwardDict.Add(paiHang, myAwardItem);
                             this.occAwardDict.Add(paiHang, myAwardItem2);
                             this.timeAwardDict.Add(paiHang, timeAwardItem);
                         }
                     }
                 }
             }
         }
         base.PredealDateTime();
         this.ActivityKeyStr = string.Format("{0}_{1}", this.FromDate.Replace(':', '$'), this.ToDate.Replace(':', '$'));
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", "Config/JieRiGifts/JieRiHongBaoBang.xml", ex.Message), null, true);
         return(false);
     }
     return(true);
 }
 public bool Init()
 {
     try
     {
         Dictionary <int, int> OpenStateDict = new Dictionary <int, int>();
         string strPlatformOpen = GameManager.systemParamsList.GetParamValueByName("YiYuanChongZhiOpen");
         if (!string.IsNullOrEmpty(strPlatformOpen))
         {
             string[] Fields = strPlatformOpen.Split(new char[]
             {
                 '|'
             });
             foreach (string dat in Fields)
             {
                 string[] State = dat.Split(new char[]
                 {
                     ','
                 });
                 if (State.Length == 2)
                 {
                     OpenStateDict[Global.SafeConvertToInt32(State[0])] = Global.SafeConvertToInt32(State[1]);
                 }
             }
         }
         OpenStateDict.TryGetValue(UserMoneyMgr.getInstance().GetActivityPlatformType(), out this.PlatformOpenStateVavle);
         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath("Config/YiYuanChongZhi.xml"));
         XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath("Config/YiYuanChongZhi.xml"));
         if (null == xml)
         {
             return(false);
         }
         XElement args = xml.Element("YiYuanChongZhi");
         if (null != args)
         {
             this.FromDate                 = Global.GetSafeAttributeStr(args, "BeginTime");
             this.ToDate                   = Global.GetSafeAttributeStr(args, "FinishTime");
             this.ActivityType             = 46;
             this.AwardStartDate           = this.FromDate;
             this.AwardEndDate             = this.ToDate;
             this.OneDollarChongZhiData.ID = (int)Global.GetSafeAttributeLong(args, "ID");
             DateTime.TryParse(this.FromDate, out this.OneDollarChongZhiData.FromDate);
             DateTime.TryParse(this.ToDate, out this.OneDollarChongZhiData.ToDate);
             this.OneDollarChongZhiData.MinZuanShi   = (int)Global.GetSafeAttributeLong(args, "MinZhuanShi");
             this.OneDollarChongZhiData.UserListFile = Global.GetSafeAttributeStr(args, "UserList");
             if (!string.IsNullOrEmpty(this.OneDollarChongZhiData.UserListFile))
             {
                 string filedir = string.Format("Config/{0}", this.OneDollarChongZhiData.UserListFile);
                 filedir = Global.GameResPath(filedir);
                 if (File.Exists(filedir))
                 {
                     string[] allUserIds = File.ReadAllLines(filedir);
                     foreach (string userid in allUserIds)
                     {
                         if (!string.IsNullOrEmpty(userid))
                         {
                             this.OneDollarChongZhiData.UserListSet.Add(userid.ToLower());
                         }
                     }
                 }
             }
             string   GoodsOne = Global.GetSafeAttributeStr(args, "GoodsID1");
             string[] fields   = GoodsOne.Split(new char[]
             {
                 '|'
             });
             if (fields.Length <= 0)
             {
                 LogManager.WriteLog(LogTypes.Warning, string.Format("解析1元充值活动配置文件中的物品配置项1失败", new object[0]), null, true);
             }
             else
             {
                 this.OneDollarChongZhiData.GoodsDataListOne = HuodongCachingMgr.ParseGoodsDataList(fields, "1元充值活动配置1");
             }
             string GoodsTwo = Global.GetSafeAttributeStr(args, "GoodsID2");
             if (!string.IsNullOrEmpty(GoodsTwo))
             {
                 fields = GoodsTwo.Split(new char[]
                 {
                     '|'
                 });
                 this.OneDollarChongZhiData.GoodsDataListTwo = HuodongCachingMgr.ParseGoodsDataList(fields, "1元充值活动配置2");
             }
         }
         base.PredealDateTime();
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", "Config/YiYuanChongZhi.xml", ex.Message), null, true);
         return(false);
     }
     return(true);
 }
        public static void LoadConfig()
        {
            string fileName = "Config/ZhuLingType.xml";

            GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
            XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));

            if (xml == null)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时出错!!!文件不存在", fileName), null, true);
            }
            else
            {
                XElement xml2 = xml.Element("Types");
                if (xml2 == null)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时出错!!!文件不存在", fileName), null, true);
                }
                else
                {
                    IEnumerable <XElement> xmlItems = xml2.Elements();
                    foreach (XElement xmlItem in xmlItems)
                    {
                        int      id        = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "ID"));
                        string   strGoods  = Global.GetSafeAttributeStr(xmlItem, "GoodsID");
                        int      bindJinBi = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "CostBandJinBi"));
                        string[] goods     = strGoods.Split(new char[]
                        {
                            ','
                        });
                        if (goods.Length != 2)
                        {
                            LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时出错!!! ID={1} 消耗物品配置错误", fileName, id), null, true);
                        }
                        else
                        {
                            int goodsID  = Convert.ToInt32(goods[0]);
                            int goodsNum = Convert.ToInt32(goods[1]);
                            if (id == 1)
                            {
                                ZhuLingZhuHunManager.ZhuLingCostGoodsID  = goodsID;
                                ZhuLingZhuHunManager.ZhuLingCostGoodsNum = goodsNum;
                                ZhuLingZhuHunManager.ZhuLingCostJinBi    = bindJinBi;
                            }
                            else if (id == 2)
                            {
                                ZhuLingZhuHunManager.ZhuHunCostGoodsID  = goodsID;
                                ZhuLingZhuHunManager.ZhuHunCostGoodsNum = goodsNum;
                                ZhuLingZhuHunManager.ZhuHunCostJinBi    = bindJinBi;
                            }
                        }
                    }
                }
            }
            fileName = "Config/MaxWinZhuLing.xml";
            GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
            xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
            if (xml == null)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时出错!!!文件不存在", fileName), null, true);
            }
            else
            {
                IEnumerable <XElement> xmlItems = xml.Elements();
                foreach (XElement xmlItem in xmlItems)
                {
                    ZhuLingZhuHunLimit i = new ZhuLingZhuHunLimit();
                    i.SuitID       = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "SuitID"));
                    i.ZhuLingLimit = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "PlainZhuLing"));
                    i.ZhuHunLimit  = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "SeniorZhuLing"));
                    ZhuLingZhuHunManager.Limit.Add(i);
                }
            }
            fileName = "Config/WinZhuLing.xml";
            GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
            xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
            if (xml == null)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时出错!!!文件不存在", fileName), null, true);
            }
            else
            {
                for (int j = 0; j < 6; j++)
                {
                    ZhuLingZhuHunManager.Effect.Add(new ZhuLingZhuHunEffect());
                }
                IEnumerable <XElement> xmlItems = xml.Elements();
                foreach (XElement xmlItem in xmlItems)
                {
                    int type       = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "TypeID"));
                    int occupation = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "Occupation"));
                    if (occupation < 0 || occupation >= ZhuLingZhuHunManager.Effect.Count <ZhuLingZhuHunEffect>())
                    {
                        LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时出错!!! 职业配置有问题", fileName), null, true);
                    }
                    else
                    {
                        ZhuLingZhuHunManager.Effect[occupation].Occupation = occupation;
                        if (type == 1)
                        {
                            ZhuLingZhuHunManager.Effect[occupation].MaxAttackV   = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "MaxAttackV"));
                            ZhuLingZhuHunManager.Effect[occupation].MaxMAttackV  = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "MaxMAttackV"));
                            ZhuLingZhuHunManager.Effect[occupation].MaxDefenseV  = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "MaxDefenseV"));
                            ZhuLingZhuHunManager.Effect[occupation].MaxMDefenseV = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "MaxMDefenseV"));
                            ZhuLingZhuHunManager.Effect[occupation].LifeV        = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "LifeV"));
                            ZhuLingZhuHunManager.Effect[occupation].HitV         = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "HitV"));
                            ZhuLingZhuHunManager.Effect[occupation].DodgeV       = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "DodgeV"));
                        }
                        else if (type == 2)
                        {
                            ZhuLingZhuHunManager.Effect[occupation].AllAttribute = Global.GetSafeAttributeDouble(xmlItem, "AllAttribute");
                        }
                    }
                }
            }
        }
Example #13
0
        // 初始化活动,读取配置文件
        public bool Init()
        {
            string CfgFile = GetConfigFile();

            try
            {
                GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(CfgFile));
                XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(CfgFile));
                if (null == xml)
                {
                    return(false);
                }

                XElement args = xml.Element("Activities");
                if (null != args)
                {
                    FromDate     = Global.GetSafeAttributeStr(args, "FromDate");
                    ToDate       = Global.GetSafeAttributeStr(args, "ToDate");
                    ActivityType = (int)Global.GetSafeAttributeLong(args, "ActivityType");

                    AwardStartDate = Global.GetSafeAttributeStr(args, "AwardStartDate");
                    AwardEndDate   = Global.GetSafeAttributeStr(args, "AwardEndDate");
                }

                args = xml.Element("GiftList");
                if (null != args)
                {
                    IEnumerable <XElement> xmlItems = args.Elements();
                    foreach (var xmlItem in xmlItems)
                    {
                        if (null != xmlItem)
                        {
                            AwardItem           myAwardItem   = new AwardItem();
                            AwardItem           myAwardItem2  = new AwardItem();
                            AwardEffectTimeItem timeAwardItem = new AwardEffectTimeItem();

                            myAwardItem.MinAwardCondionValue  = Global.GMax(0, (int)Global.GetSafeAttributeLong(xmlItem, "Num"));
                            myAwardItem.MinAwardCondionValue2 = Global.GMax(0, (int)Global.GetSafeAttributeLong(xmlItem, "Goods"));
                            myAwardItem.AwardYuanBao          = 0;

                            string goodsIDs = Global.GetSafeAttributeStr(xmlItem, "GoodsOne");
                            if (string.IsNullOrEmpty(goodsIDs))
                            {
                                LogManager.WriteLog(LogTypes.Warning, string.Format("读取{0}配置文件中的物品配置项1失败", CfgFile));
                            }
                            else
                            {
                                string[] fields = goodsIDs.Split('|');
                                if (fields.Length <= 0)
                                {
                                    LogManager.WriteLog(LogTypes.Warning, string.Format("读取{0}活动配置文件中的物品配置项失败", CfgFile));
                                }
                                else
                                {
                                    myAwardItem.GoodsDataList = HuodongCachingMgr.ParseGoodsDataList(fields, CfgFile);
                                }
                            }

                            goodsIDs = Global.GetSafeAttributeStr(xmlItem, "GoodsTwo");
                            if (string.IsNullOrEmpty(goodsIDs))
                            {
                                //LogManager.WriteLog(LogTypes.Warning, string.Format("读取{0}配置文件中的物品配置项2失败", CfgFile));
                            }
                            else
                            {
                                string[] fields = goodsIDs.Split('|');
                                if (fields.Length <= 0)
                                {
                                    LogManager.WriteLog(LogTypes.Warning, CfgFile);
                                }
                                else
                                {
                                    myAwardItem2.GoodsDataList = HuodongCachingMgr.ParseGoodsDataList(fields, CfgFile);
                                }
                            }

                            string timeGoods = Global.GetSafeAttributeStr(xmlItem, "GoodsThr");
                            string timeList  = Global.GetSafeAttributeStr(xmlItem, "EffectiveTime");
                            timeAwardItem.Init(timeGoods, timeList, CfgFile + " 时效性物品");

                            string strID = Global.GetSafeAttributeStr(xmlItem, "ID");
                            int    id    = Convert.ToInt32(strID);
                            allAwardDict.Add(id, myAwardItem);
                            occAwardDict.Add(id, myAwardItem2);
                            timeAwardDict.Add(id, timeAwardItem);
                        }
                    }
                }

                PredealDateTime();
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", CfgFile, ex.Message));
                return(false);
            }

            return(true);
        }
 public bool Init()
 {
     try
     {
         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(this.CfgFile));
         XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(this.CfgFile));
         if (null == xml)
         {
             return(false);
         }
         XElement args = xml.Element("Activities");
         if (null != args)
         {
             this.FromDate       = Global.GetSafeAttributeStr(args, "FromDate");
             this.ToDate         = Global.GetSafeAttributeStr(args, "ToDate");
             this.ActivityType   = (int)Global.GetSafeAttributeLong(args, "ActivityType");
             this.AwardStartDate = Global.GetSafeAttributeStr(args, "AwardStartDate");
             this.AwardEndDate   = Global.GetSafeAttributeStr(args, "AwardEndDate");
         }
         args = xml.Element("GiftList");
         Dictionary <int, JieriLianXuChargeActivity._ChargeLvl> awardId2ChargeLvl = new Dictionary <int, JieriLianXuChargeActivity._ChargeLvl>();
         if (null != args)
         {
             IEnumerable <XElement> xmlItems = args.Elements();
             foreach (XElement xmlItem in xmlItems)
             {
                 if (null != xmlItem)
                 {
                     int awardId    = (int)Global.GetSafeAttributeLong(xmlItem, "Group");
                     int needCharge = (int)Global.GetSafeAttributeLong(xmlItem, "NeedZuanShi");
                     JieriLianXuChargeActivity._ChargeLvl chargeLvl = null;
                     if (!awardId2ChargeLvl.TryGetValue(awardId, out chargeLvl))
                     {
                         chargeLvl                  = new JieriLianXuChargeActivity._ChargeLvl();
                         chargeLvl.Id               = awardId;
                         chargeLvl.NeedCharge       = needCharge;
                         awardId2ChargeLvl[awardId] = chargeLvl;
                     }
                     JieriLianXuChargeActivity._DayAward dayAward = new JieriLianXuChargeActivity._DayAward();
                     dayAward.LianXuDay = (int)Global.GetSafeAttributeLong(xmlItem, "Day");
                     string goodsIDs = Global.GetSafeAttributeStr(xmlItem, "GoodsOne");
                     if (string.IsNullOrEmpty(goodsIDs))
                     {
                         LogManager.WriteLog(LogTypes.Warning, string.Format("读取{0}配置文件中的物品配置项为空", this.CfgFile), null, true);
                     }
                     else
                     {
                         string[] fields = goodsIDs.Split(new char[]
                         {
                             '|'
                         });
                         if (fields.Length <= 0)
                         {
                             LogManager.WriteLog(LogTypes.Warning, string.Format("读取{0}配置文件中的物品配置项失败", this.CfgFile), null, true);
                         }
                         else
                         {
                             dayAward.AwardGoods.GoodsDataList.AddRange(HuodongCachingMgr.ParseGoodsDataList(fields, "连续充值活动goods1配置"));
                         }
                     }
                     goodsIDs = Global.GetSafeAttributeStr(xmlItem, "GoodsTwo");
                     if (!string.IsNullOrEmpty(goodsIDs))
                     {
                         string[] fields = goodsIDs.Split(new char[]
                         {
                             '|'
                         });
                         if (fields.Length <= 0)
                         {
                             LogManager.WriteLog(LogTypes.Warning, string.Format("读取{0}配置文件中的物品配置项失败", this.CfgFile), null, true);
                         }
                         else
                         {
                             dayAward.AwardGoods.GoodsDataList.AddRange(HuodongCachingMgr.ParseGoodsDataList(fields, "连续充值活动goods2配置"));
                         }
                     }
                     chargeLvl.AwardList.Add(dayAward);
                 }
             }
             this.chargeLvlList.AddRange(awardId2ChargeLvl.Values.ToList <JieriLianXuChargeActivity._ChargeLvl>());
             base.PredealDateTime();
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", this.CfgFile, ex.Message), null, true);
         return(false);
     }
     return(true);
 }
Example #15
0
 public void InitItemChargeConfigData()
 {
     try
     {
         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath("Config/ZhiGou.xml"));
         XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath("Config/ZhiGou.xml"));
         if (xml != null)
         {
             Dictionary <int, ChargeItemData> ChargeItemDict = new Dictionary <int, ChargeItemData>();
             IEnumerable <XElement>           xmlItems       = xml.Elements();
             foreach (XElement xmlItem in xmlItems)
             {
                 if (null != xmlItem)
                 {
                     ChargeItemData chargeItem = new ChargeItemData();
                     chargeItem.ChargeItemID   = (int)Global.GetSafeAttributeLong(xmlItem, "ZhiGouID");
                     chargeItem.ChargeDangID   = (int)Global.GetSafeAttributeLong(xmlItem, "ChongZhiID");
                     chargeItem.SinglePurchase = (int)Global.GetSafeAttributeLong(xmlItem, "SinglePurchase");
                     chargeItem.DayPurchase    = (int)Global.GetSafeAttributeLong(xmlItem, "EverydayPurchase");
                     string ThemePurchase = Global.GetDefAttributeStr(xmlItem, "ThemePurchase", "");
                     chargeItem.ThemePurchase = Global.SafeConvertToInt32(ThemePurchase);
                     chargeItem.FromDate      = Global.GetSafeAttributeStr(xmlItem, "FromDate");
                     chargeItem.ToDate        = Global.GetSafeAttributeStr(xmlItem, "ToDate");
                     if (0 == chargeItem.FromDate.CompareTo("-1"))
                     {
                         chargeItem.FromDate = "2008-08-08 08:08:08";
                     }
                     if (0 == chargeItem.ToDate.CompareTo("-1"))
                     {
                         chargeItem.ToDate = "2028-08-08 08:08:08";
                     }
                     chargeItem.GoodsStringOne = Global.GetSafeAttributeStr(xmlItem, "GoodsOne");
                     if (!string.IsNullOrEmpty(chargeItem.GoodsStringOne))
                     {
                         string[] fields = chargeItem.GoodsStringOne.Split(new char[]
                         {
                             '|'
                         });
                         chargeItem.GoodsDataOne = HuodongCachingMgr.ParseGoodsDataList(fields, "ZhiGou.xml励配置文件1");
                     }
                     chargeItem.GoodsStringTwo = Global.GetSafeAttributeStr(xmlItem, "GoodsTwo");
                     if (!string.IsNullOrEmpty(chargeItem.GoodsStringTwo))
                     {
                         string[] fields = chargeItem.GoodsStringTwo.Split(new char[]
                         {
                             '|'
                         });
                         chargeItem.GoodsDataTwo = HuodongCachingMgr.ParseGoodsDataList(fields, "ZhiGou.xml励配置文件1");
                     }
                     ChargeItemDict[chargeItem.ChargeItemID] = chargeItem;
                 }
             }
             Data.ChargeItemDict = ChargeItemDict;
         }
         else
         {
             LogManager.WriteLog(LogTypes.Fatal, string.Format("丢失充值直购配置文件{0}", "Config/ZhiGou.xml"), null, true);
         }
     }
     catch (Exception e)
     {
         LogManager.WriteLog(LogTypes.Fatal, "读取Config/ZhiGou.xml错误:" + e.ToString(), e, true);
     }
 }
Example #16
0
 public bool Init()
 {
     try
     {
         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath("Config/JieRiGifts/VIPYouHuiLiBao.xml"));
         XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath("Config/JieRiGifts/VIPYouHuiLiBao.xml"));
         if (null == xml)
         {
             return(false);
         }
         XElement args = xml.Element("Activities");
         if (null != args)
         {
             this.FromDate       = Global.GetSafeAttributeStr(args, "FromDate");
             this.ToDate         = Global.GetSafeAttributeStr(args, "ToDate");
             this.ActivityType   = (int)Global.GetSafeAttributeLong(args, "ActivityType");
             this.AwardStartDate = Global.GetSafeAttributeStr(args, "AwardStartDate");
             this.AwardEndDate   = Global.GetSafeAttributeStr(args, "AwardEndDate");
         }
         args = xml.Element("GiftList");
         if (null != args)
         {
             IEnumerable <XElement> xmlItems = args.Elements();
             foreach (XElement xmlItem in xmlItems)
             {
                 if (null != xmlItem)
                 {
                     JieriVIPYouHuiActivityConfig myConfigItem = new JieriVIPYouHuiActivityConfig();
                     myConfigItem.ID             = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                     myConfigItem.MinVIPLev      = (int)Global.GetSafeAttributeLong(xmlItem, "VIPLevel");
                     myConfigItem.Price          = (int)Global.GetSafeAttributeLong(xmlItem, "Price");
                     myConfigItem.SinglePurchase = (int)Global.GetSafeAttributeLong(xmlItem, "SinglePurchase");
                     myConfigItem.FullPurchase   = (int)Global.GetSafeAttributeLong(xmlItem, "FullPurchase");
                     string   goodsIDsOne = Global.GetSafeAttributeStr(xmlItem, "GoodsOne");
                     string[] fields      = goodsIDsOne.Split(new char[]
                     {
                         '|'
                     });
                     if (fields.Length <= 0)
                     {
                         LogManager.WriteLog(LogTypes.Warning, string.Format("解析节日活动VIP优惠配置文件中的物品配置项1失败", new object[0]), null, true);
                     }
                     else
                     {
                         myConfigItem.GoodsDataListOne = HuodongCachingMgr.ParseGoodsDataList(fields, "节日活动VIP优惠配置1");
                     }
                     string goodsIDsTwo = Global.GetSafeAttributeStr(xmlItem, "GoodsTwo");
                     if (!string.IsNullOrEmpty(goodsIDsTwo))
                     {
                         fields = goodsIDsTwo.Split(new char[]
                         {
                             '|'
                         });
                         myConfigItem.GoodsDataListTwo = HuodongCachingMgr.ParseGoodsDataList(fields, "节日活动VIP优惠配置2");
                     }
                     string goodsIDsThr = Global.GetSafeAttributeStr(xmlItem, "GoodsThr");
                     myConfigItem.GoodsDataListThr.Init(goodsIDsThr, Global.GetSafeAttributeStr(xmlItem, "EffectiveTime"), "节日活动VIP优惠配置3");
                     this.VIPYouHuiCofigDict[myConfigItem.ID] = myConfigItem;
                 }
             }
         }
         base.PredealDateTime();
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", "Config/JieRiGifts/ChongZhiDuiHuan.xml", ex.Message), null, true);
         return(false);
     }
     return(true);
 }
 public bool Init()
 {
     try
     {
         Dictionary <int, int> OpenStateDict = new Dictionary <int, int>();
         string strPlatformOpen = GameManager.systemParamsList.GetParamValueByName("OneDollarBuyOpen");
         if (!string.IsNullOrEmpty(strPlatformOpen))
         {
             string[] Fields = strPlatformOpen.Split(new char[]
             {
                 '|'
             });
             foreach (string dat in Fields)
             {
                 string[] State = dat.Split(new char[]
                 {
                     ','
                 });
                 if (State.Length == 2)
                 {
                     OpenStateDict[Global.SafeConvertToInt32(State[0])] = Global.SafeConvertToInt32(State[1]);
                 }
             }
         }
         OpenStateDict.TryGetValue(UserMoneyMgr.getInstance().GetActivityPlatformType(), out this.PlatformOpenStateVavle);
         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath("Config/OneDollarBuy.xml"));
         XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath("Config/OneDollarBuy.xml"));
         if (null == xml)
         {
             return(false);
         }
         XElement args = xml.Element("OneDollarBuy");
         if (null != args)
         {
             this.FromDate                  = Global.GetSafeAttributeStr(args, "BeginTime");
             this.ToDate                    = Global.GetSafeAttributeStr(args, "FinishTime");
             this.ActivityType              = 45;
             this.AwardStartDate            = this.FromDate;
             this.AwardEndDate              = this.ToDate;
             this.OneDollarBuyConfigData.ID = (int)Global.GetSafeAttributeLong(args, "ID");
             DateTime.TryParse(this.FromDate, out this.OneDollarBuyConfigData.FromDate);
             DateTime.TryParse(this.ToDate, out this.OneDollarBuyConfigData.ToDate);
             this.OneDollarBuyConfigData.ZhiGouID       = (int)Global.GetSafeAttributeLong(args, "ZhiGouID");
             this.OneDollarBuyConfigData.SinglePurchase = (int)Global.GetSafeAttributeLong(args, "SinglePurchase");
             string GoodsOne = Global.GetSafeAttributeStr(args, "GoodsID1");
             string GoodsTwo = Global.GetSafeAttributeStr(args, "GoodsID2");
             UserMoneyMgr.getInstance().CheckChargeItemConfigLogic(this.OneDollarBuyConfigData.ZhiGouID, this.OneDollarBuyConfigData.SinglePurchase, GoodsOne, GoodsTwo, string.Format("1元直购 ID={0}", this.OneDollarBuyConfigData.ID));
         }
         base.PredealDateTime();
         if (!this.InActivityTime())
         {
             GameManager.ClientMgr.NotifyAllActivityState(8, 0, "", "", 0);
         }
         else
         {
             GameManager.ClientMgr.NotifyAllActivityState(8, this.PlatformOpenStateVavle, "", "", 0);
         }
         GlobalEventSource.getInstance().registerListener(36, this);
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", "Config/OneDollarBuy.xml", ex.Message), null, true);
         return(false);
     }
     return(true);
 }
Example #18
0
        public static void LoadConfig()
        {
            XElement xml      = null;
            string   fileName = null;

            #region 加载注灵注魂消耗 ZhuLingType.xml

            fileName = "Config/ZhuLingType.xml";
            GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
            xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
            if (xml == null)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时出错!!!文件不存在", fileName));
            }
            else
            {
                XElement xml1 = xml.Element("Types");
                if (xml1 == null)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时出错!!!文件不存在", fileName));
                }
                else
                {
                    IEnumerable <XElement> xmlItems = xml1.Elements();
                    foreach (XElement xmlItem in xmlItems)
                    {
                        int      id        = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "ID"));
                        string   strGoods  = Global.GetSafeAttributeStr(xmlItem, "GoodsID");
                        int      bindJinBi = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "CostBandJinBi"));
                        string[] goods     = strGoods.Split(',');
                        if (goods.Length != 2)
                        {
                            LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时出错!!! ID={1} 消耗物品配置错误", fileName, id));
                            continue;
                        }
                        int goodsID  = Convert.ToInt32(goods[0]);
                        int goodsNum = Convert.ToInt32(goods[1]);

                        if (id == 1)
                        {
                            ZhuLingZhuHunManager.ZhuLingCostGoodsID  = goodsID;
                            ZhuLingZhuHunManager.ZhuLingCostGoodsNum = goodsNum;
                            ZhuLingZhuHunManager.ZhuLingCostJinBi    = bindJinBi;
                        }
                        else if (id == 2)
                        {
                            ZhuLingZhuHunManager.ZhuHunCostGoodsID  = goodsID;
                            ZhuLingZhuHunManager.ZhuHunCostGoodsNum = goodsNum;
                            ZhuLingZhuHunManager.ZhuHunCostJinBi    = bindJinBi;
                        }
                    }
                }
            }

            #endregion

            #region 加载注灵注魂限制 MaxWinZhuLing.xml

            xml      = null;
            fileName = "Config/MaxWinZhuLing.xml";
            GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
            xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
            if (xml == null)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时出错!!!文件不存在", fileName));
            }
            else
            {
                IEnumerable <XElement> xmlItems = xml.Elements();
                foreach (XElement xmlItem in xmlItems)
                {
                    ZhuLingZhuHunLimit l = new ZhuLingZhuHunLimit();
                    l.SuitID       = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "SuitID"));
                    l.ZhuLingLimit = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "PlainZhuLing"));
                    l.ZhuHunLimit  = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "SeniorZhuLing"));
                    ZhuLingZhuHunManager.Limit.Add(l);
                }
            }
            #endregion

            #region 加载注灵注魂属性加成 WinZhuLing.xml

            xml      = null;
            fileName = "Config/WinZhuLing.xml";
            GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
            xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
            if (xml == null)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时出错!!!文件不存在", fileName));
            }
            else
            {
                for (int i = (int)EOccupationType.EOT_Warrior; i < (int)EOccupationType.EOT_MAX; ++i)
                {
                    ZhuLingZhuHunManager.Effect.Add(new ZhuLingZhuHunEffect());
                }

                IEnumerable <XElement> xmlItems = xml.Elements();
                foreach (XElement xmlItem in xmlItems)
                {
                    int type       = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "TypeID"));     //1=注灵 2=注魂
                    int occupation = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "Occupation")); //0=战士 1=法师 2=弓箭手 3=魔剑士
                    if (occupation < 0 || occupation >= ZhuLingZhuHunManager.Effect.Count())
                    {
                        LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时出错!!! 职业配置有问题", fileName));
                        continue;
                    }
                    ZhuLingZhuHunManager.Effect[occupation].Occupation = occupation;
                    if (type == 1)
                    {
                        ZhuLingZhuHunManager.Effect[occupation].MaxAttackV   = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "MaxAttackV"));
                        ZhuLingZhuHunManager.Effect[occupation].MaxMAttackV  = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "MaxMAttackV"));
                        ZhuLingZhuHunManager.Effect[occupation].MaxDefenseV  = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "MaxDefenseV"));
                        ZhuLingZhuHunManager.Effect[occupation].MaxMDefenseV = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "MaxMDefenseV"));
                        ZhuLingZhuHunManager.Effect[occupation].LifeV        = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "LifeV"));
                        ZhuLingZhuHunManager.Effect[occupation].HitV         = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "HitV"));
                        ZhuLingZhuHunManager.Effect[occupation].DodgeV       = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "DodgeV"));
                    }
                    else if (type == 2)
                    {
                        ZhuLingZhuHunManager.Effect[occupation].AllAttribute = Global.GetSafeAttributeDouble(xmlItem, "AllAttribute");
                    }
                }
            }
            #endregion
        }
Example #19
0
        public void Init()
        {
            this.replaceJudgerDict.Clear();
            this.replaceJudgerDict["WingSuit".ToLower()]      = new CondJudger_WingSuit();
            this.replaceJudgerDict["QiangHuaLevel".ToLower()] = new CondJudger_EquipForgeLvl();
            this.replaceJudgerDict["ZhuiJiaLevel".ToLower()]  = new CondJudger_EquipAppendLvl();
            this.replaceJudgerDict["EquipSuit".ToLower()]     = new CondJudger_EquipSuit();
            this.replaceJudgerDict["JuHun".ToLower()]         = new CondJudger_JuHun();
            GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath("Config/ReplaceGoods.xml"));
            XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath("Config/ReplaceGoods.xml"));

            if (xml == null)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时出错!!!文件不存在", "Config/ReplaceGoods.xml"), null, true);
            }
            else
            {
                try
                {
                    this.replaceDict.Clear();
                    IEnumerable <XElement> xmlItems = xml.Elements();
                    foreach (XElement xmlItem in xmlItems)
                    {
                        if (null != xmlItem)
                        {
                            GoodsReplaceManager.ReplaceRecord record = new GoodsReplaceManager.ReplaceRecord();
                            record.seq      = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                            record.condIdx  = Global.GetSafeAttributeStr(xmlItem, "ToType").ToLower();
                            record.condArg  = Global.GetSafeAttributeStr(xmlItem, "ToTypeProperty");
                            record.oldGoods = (int)Global.GetSafeAttributeLong(xmlItem, "OldGoods");
                            record.newGoods = (int)Global.GetSafeAttributeLong(xmlItem, "NewGoods");
                            List <GoodsReplaceManager.ReplaceRecord> recordList = null;
                            if (!this.replaceDict.TryGetValue(record.oldGoods, out recordList))
                            {
                                recordList = new List <GoodsReplaceManager.ReplaceRecord>();
                                this.replaceDict[record.oldGoods] = recordList;
                            }
                            recordList.Add(record);
                        }
                    }
                    foreach (KeyValuePair <int, List <GoodsReplaceManager.ReplaceRecord> > kvp in this.replaceDict)
                    {
                        kvp.Value.Sort(delegate(GoodsReplaceManager.ReplaceRecord left, GoodsReplaceManager.ReplaceRecord right)
                        {
                            int result;
                            if (left.seq > right.seq)
                            {
                                result = 1;
                            }
                            else if (left.seq == right.seq)
                            {
                                result = 0;
                            }
                            else
                            {
                                result = -1;
                            }
                            return(result);
                        });
                    }
                }
                catch (Exception ex)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时出错!!! {1}", "Config/ReplaceGoods.xml", ex.Message), null, true);
                }
            }
        }
Example #20
0
 public void InitFirstChargeConfigData()
 {
     try
     {
         string strCmd = GameManager.GameConfigMgr.GetGameConfigItemStr("platformtype", "app");
         strCmd = strCmd.ToLower();
         string             sectionKey = string.Empty;
         ChargePlatformType cpt;
         if (strCmd == "app")
         {
             sectionKey = "dl_app";
             cpt        = ChargePlatformType.CPT_App;
         }
         else if (strCmd == "yueyu")
         {
             sectionKey = "dl_yueyu";
             cpt        = ChargePlatformType.CPT_YueYu;
         }
         else if (strCmd == "andrid" || strCmd == "android" || strCmd == "yyb")
         {
             sectionKey = "dl_android";
             cpt        = ChargePlatformType.CPT_Android;
         }
         else
         {
             sectionKey = "dl_app";
             cpt        = ChargePlatformType.CPT_App;
         }
         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath("Config/MU_ChongZhi.xml"));
         XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath("Config/MU_ChongZhi.xml"));
         if (xml != null)
         {
             IEnumerable <XElement> xmlItems   = xml.Elements().First((XElement _xml) => _xml.Attribute("TypeID").Value.ToString().ToLower() == sectionKey).Elements();
             SingleChargeData       chargeData = new SingleChargeData();
             chargeData.YueKaBangZuan  = GameManager.PlatConfigMgr.GetGameConfigItemInt("YueKaBangZuan", 0);
             chargeData.ChargePlatType = (int)cpt;
             foreach (XElement item in xmlItems)
             {
                 if (null != item)
                 {
                     int money     = (int)Global.GetSafeAttributeLong(item, "RMB");
                     int bindmoney = (int)Global.GetSafeAttributeLong(item, "FirstBindZuanShi");
                     int id        = (int)Global.GetSafeAttributeLong(item, "ID");
                     if (id == YueKaManager.YUE_KA_MONEY_ID_IN_CHARGE_FILE)
                     {
                         chargeData.YueKaMoney = money;
                     }
                     chargeData.ChargeIDVsMoneyDict[id]    = money;
                     chargeData.MoneyVsChargeIDDict[money] = id;
                     if (!chargeData.singleData.ContainsKey(money))
                     {
                         chargeData.singleData[money] = bindmoney;
                     }
                 }
             }
             JieriSuperInputActivity jsiAct = HuodongCachingMgr.GetJieRiSuperInputActivity();
             if (null != jsiAct)
             {
                 jsiAct.FilterSingleChargeData(chargeData);
             }
             if (1 == Global.sendToDB <int, byte[]>(10171, DataHelper.ObjectToBytes <SingleChargeData>(chargeData), 0))
             {
                 Data.ChargeData = chargeData;
             }
         }
         else
         {
             LogManager.WriteLog(LogTypes.Fatal, string.Format("丢失平台充值配置文件{0}", "Config/MU_ChongZhi.xml"), null, true);
         }
     }
     catch (Exception e)
     {
         LogManager.WriteException("读取充值xml错误:" + e.ToString());
     }
 }
Example #21
0
        public void Init()
        {
            replaceJudgerDict.Clear();
            replaceJudgerDict[CondIndex.Cond_WingSuit.ToLower()]       = new CondJudger_WingSuit();
            replaceJudgerDict[CondIndex.Cond_EquipForgeLvl.ToLower()]  = new CondJudger_EquipForgeLvl();
            replaceJudgerDict[CondIndex.Cond_EquipAppendLvl.ToLower()] = new CondJudger_EquipAppendLvl();
            replaceJudgerDict[CondIndex.Cond_EquipSuit.ToLower()]      = new CondJudger_EquipSuit();

            GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(ReplaceCfgFile));
            XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(ReplaceCfgFile));

            if (xml == null)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时出错!!!文件不存在", ReplaceCfgFile));
                return;
            }

            try
            {
                replaceDict.Clear();
                IEnumerable <XElement> xmlItems = xml.Elements();
                foreach (var xmlItem in xmlItems)
                {
                    if (null == xmlItem)
                    {
                        continue;
                    }

                    ReplaceRecord record = new ReplaceRecord();
                    record.seq      = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                    record.condIdx  = Global.GetSafeAttributeStr(xmlItem, "ToType").ToLower();
                    record.condArg  = Global.GetSafeAttributeStr(xmlItem, "ToTypeProperty");
                    record.oldGoods = (int)Global.GetSafeAttributeLong(xmlItem, "OldGoods");
                    record.newGoods = (int)Global.GetSafeAttributeLong(xmlItem, "NewGoods");

                    List <ReplaceRecord> recordList = null;
                    if (!replaceDict.TryGetValue(record.oldGoods, out recordList))
                    {
                        recordList = new List <ReplaceRecord>();
                        replaceDict[record.oldGoods] = recordList;
                    }

                    recordList.Add(record);
                }

                // 优先级排序
                foreach (var kvp in replaceDict)
                {
                    kvp.Value.Sort((left, right) =>
                    {
                        if (left.seq > right.seq)
                        {
                            return(1);
                        }
                        else if (left.seq == right.seq)
                        {
                            return(0);
                        }
                        else
                        {
                            return(-1);
                        }
                    });
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("加载{0}时出错!!! {1}", ReplaceCfgFile, ex.Message));
            }
        }
Example #22
0
 public bool Init()
 {
     try
     {
         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(this.CfgFile));
         XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(this.CfgFile));
         if (null == xml)
         {
             return(false);
         }
         XElement args = xml.Element("Activities");
         if (null != args)
         {
             this.FromDate       = Global.GetSafeAttributeStr(args, "FromDate");
             this.ToDate         = Global.GetSafeAttributeStr(args, "ToDate");
             this.ActivityType   = (int)Global.GetSafeAttributeLong(args, "ActivityType");
             this.AwardStartDate = Global.GetSafeAttributeStr(args, "AwardStartDate");
             this.AwardEndDate   = Global.GetSafeAttributeStr(args, "AwardEndDate");
         }
         args = xml.Element("GiftList");
         if (null != args)
         {
             IEnumerable <XElement> xmlItems = args.Elements();
             foreach (XElement xmlItem in xmlItems)
             {
                 if (null != xmlItem)
                 {
                     JieriPlatChargeKingEveryDay.ChargeItem ci = new JieriPlatChargeKingEveryDay.ChargeItem();
                     ci.Id           = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                     ci.Rank         = (int)Global.GetSafeAttributeLong(xmlItem, "Ranking");
                     ci.Day          = (int)Global.GetSafeAttributeLong(xmlItem, "Day");
                     ci.NeedChargeYB = (int)Global.GetSafeAttributeLong(xmlItem, "MinYuanBao");
                     AwardItem           myAwardItem   = new AwardItem();
                     AwardItem           myAwardItem2  = new AwardItem();
                     AwardEffectTimeItem timeAwardItem = new AwardEffectTimeItem();
                     string goodsIDs = Global.GetSafeAttributeStr(xmlItem, "GoodsOne");
                     if (string.IsNullOrEmpty(goodsIDs))
                     {
                         LogManager.WriteLog(LogTypes.Warning, string.Format("读取{0}配置文件中的物品配置项失败", this.CfgFile), null, true);
                     }
                     else
                     {
                         string[] fields = goodsIDs.Split(new char[]
                         {
                             '|'
                         });
                         if (fields.Length <= 0)
                         {
                             LogManager.WriteLog(LogTypes.Warning, string.Format("读取{0}配置文件中的物品配置项失败", this.CfgFile), null, true);
                         }
                         else
                         {
                             myAwardItem.GoodsDataList = HuodongCachingMgr.ParseGoodsDataList(fields, "大型节日活动每日平台充值王配置");
                         }
                     }
                     goodsIDs = Global.GetSafeAttributeStr(xmlItem, "GoodsTwo");
                     if (!string.IsNullOrEmpty(goodsIDs))
                     {
                         string[] fields = goodsIDs.Split(new char[]
                         {
                             '|'
                         });
                         if (fields.Length <= 0)
                         {
                             LogManager.WriteLog(LogTypes.Warning, string.Format("读取{0}配置文件中的物品配置项失败", this.CfgFile), null, true);
                         }
                         else
                         {
                             myAwardItem2.GoodsDataList = HuodongCachingMgr.ParseGoodsDataList(fields, "大型节日活动每日平台充值王配置2");
                         }
                     }
                     string timeGoods = Global.GetSafeAttributeStr(xmlItem, "GoodsThr");
                     string timeList  = Global.GetSafeAttributeStr(xmlItem, "EffectiveTime");
                     timeAwardItem.Init(timeGoods, timeList, "大型节日每日平台充值王时效性物品活动配置");
                     ci.allAwardGoodsOne            = myAwardItem;
                     ci.occAwardGoodsTwo            = myAwardItem2;
                     ci.timeAwardGoodsThr           = timeAwardItem;
                     this.IdVsChargeItemDict[ci.Id] = ci;
                     List <JieriPlatChargeKingEveryDay.ChargeItem> chargeItemList;
                     if (!this.DayVsChargeItemListDict.TryGetValue(ci.Day, out chargeItemList))
                     {
                         chargeItemList = new List <JieriPlatChargeKingEveryDay.ChargeItem>();
                         chargeItemList.Add(ci);
                         this.DayVsChargeItemListDict[ci.Day] = chargeItemList;
                     }
                     else
                     {
                         chargeItemList.Add(ci);
                     }
                     chargeItemList.Sort(delegate(JieriPlatChargeKingEveryDay.ChargeItem left, JieriPlatChargeKingEveryDay.ChargeItem right)
                     {
                         int result;
                         if (left.Rank < right.Rank)
                         {
                             result = -1;
                         }
                         else if (left.Rank > right.Rank)
                         {
                             result = 1;
                         }
                         else
                         {
                             result = 0;
                         }
                         return(result);
                     });
                 }
             }
         }
         base.PredealDateTime();
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", this.CfgFile, ex.Message), null, true);
         return(false);
     }
     return(true);
 }
 public bool Init()
 {
     try
     {
         string activityTm = GameManager.systemParamsList.GetParamValueByName("SuperChongZhiFanLi");
         if (string.IsNullOrEmpty(activityTm))
         {
             LogManager.WriteLog(LogTypes.Warning, string.Format("解析大型节日充值返利活动配置文件中的SuperChongZhiFanLi失败", new object[0]), null, true);
             return(false);
         }
         string[] TmFields = activityTm.Split(new char[]
         {
             '|'
         });
         if (TmFields.Length != 2)
         {
             LogManager.WriteLog(LogTypes.Warning, string.Format("解析大型节日充值返利活动配置文件中的SuperChongZhiFanLi失败", new object[0]), null, true);
             return(false);
         }
         this.FromDate       = TmFields[0];
         this.ToDate         = TmFields[1];
         this.ActivityType   = 71;
         this.AwardStartDate = this.FromDate;
         this.AwardEndDate   = this.ToDate;
         base.PredealDateTime();
         string strCmd = GameManager.GameConfigMgr.GetGameConfigItemStr("platformtype", "app");
         strCmd = strCmd.ToLower();
         string sectionKey = string.Empty;
         if (strCmd == "app")
         {
             sectionKey = "dl_app";
         }
         else if (strCmd == "yueyu")
         {
             sectionKey = "dl_yueyu";
         }
         else if (strCmd == "andrid" || strCmd == "android" || strCmd == "yyb")
         {
             sectionKey = "dl_android";
         }
         else
         {
             sectionKey = "dl_app";
         }
         this.JieriSuperInputDict.Clear();
         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath("Config/MU_ChongZhiFanLi.xml"));
         XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath("Config/MU_ChongZhiFanLi.xml"));
         if (xml != null)
         {
             IEnumerable <XElement> xmlItems = xml.Elements().First((XElement _xml) => _xml.Attribute("TypeID").Value.ToString().ToLower() == sectionKey).Elements();
             foreach (XElement item in xmlItems)
             {
                 if (null != item)
                 {
                     JieriSuperInputData superInputData = new JieriSuperInputData();
                     superInputData.ID              = (int)Global.GetSafeAttributeLong(item, "ID");
                     superInputData.MutiNum         = (int)Global.GetSafeAttributeLong(item, "Num");
                     superInputData.PurchaseNum     = (int)Global.GetSafeAttributeLong(item, "SinglePurchase");
                     superInputData.FullPurchaseNum = (int)Global.GetSafeAttributeLong(item, "FullPurchase");
                     DateTime actDate;
                     DateTime.TryParse(Global.GetSafeAttributeStr(item, "Data"), out actDate);
                     TimeSpan actBegin;
                     TimeSpan.TryParse(Global.GetSafeAttributeStr(item, "BeginTime"), out actBegin);
                     TimeSpan actEnd;
                     TimeSpan.TryParse(Global.GetSafeAttributeStr(item, "EndTime"), out actEnd);
                     superInputData.BeginTime = actDate + actBegin;
                     superInputData.EndTime   = actDate + actEnd;
                     this.JieriSuperInputDict[superInputData.ID] = superInputData;
                 }
             }
         }
         Dictionary <int, int> OpenStateDict = new Dictionary <int, int>();
         string strPlatformOpen = GameManager.systemParamsList.GetParamValueByName("SuperChongZhiFanLiOpen");
         if (!string.IsNullOrEmpty(strPlatformOpen))
         {
             string[] Fields = strPlatformOpen.Split(new char[]
             {
                 '|'
             });
             foreach (string dat in Fields)
             {
                 string[] State = dat.Split(new char[]
                 {
                     ','
                 });
                 if (State.Length == 2)
                 {
                     OpenStateDict[Global.SafeConvertToInt32(State[0])] = Global.SafeConvertToInt32(State[1]);
                 }
             }
         }
         OpenStateDict.TryGetValue(UserMoneyMgr.getInstance().GetActivityPlatformType(), out this.PlatformOpenStateVavle);
         if (!this.InActivityTime())
         {
             GameManager.ClientMgr.NotifyAllActivityState(11, 0, "", "", 0);
         }
         else
         {
             GameManager.ClientMgr.NotifyAllActivityState(11, this.PlatformOpenStateVavle, "", "", 0);
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", "Config/MU_ChongZhiFanLi.xml", ex.Message), null, true);
         return(false);
     }
     return(true);
 }
Example #24
0
        public bool Init()
        {
            try
            {
                GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(CfgFile));
                XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(CfgFile));
                if (null == xml)
                {
                    return(false);
                }

                XElement args = xml.Element("Activities");
                if (null != args)
                {
                    FromDate     = Global.GetSafeAttributeStr(args, "FromDate");
                    ToDate       = Global.GetSafeAttributeStr(args, "ToDate");
                    ActivityType = (int)Global.GetSafeAttributeLong(args, "ActivityType");

                    AwardStartDate = Global.GetSafeAttributeStr(args, "AwardStartDate");
                    AwardEndDate   = Global.GetSafeAttributeStr(args, "AwardEndDate");
                }

                args = xml.Element("GiftList");
                if (null != args)
                {
                    IEnumerable <XElement> xmlItems = args.Elements();
                    foreach (var xmlItem in xmlItems)
                    {
                        if (null != xmlItem)
                        {
                            AwardItem           myAwardItem   = new AwardItem();
                            AwardItem           myAwardItem2  = new AwardItem();
                            AwardEffectTimeItem timeAwardItem = new AwardEffectTimeItem();

                            myAwardItem.MinAwardCondionValue = Global.GMax(0, (int)Global.GetSafeAttributeLong(xmlItem, "MinYuanBao"));
                            myAwardItem.AwardYuanBao         = 0;

                            string goodsIDs = Global.GetSafeAttributeStr(xmlItem, "GoodsOne");
                            if (string.IsNullOrEmpty(goodsIDs))
                            {
                                LogManager.WriteLog(LogTypes.Warning, string.Format("读取{0}配置文件中的物品配置项失败", CfgFile));
                            }
                            else
                            {
                                string[] fields = goodsIDs.Split('|');
                                if (fields.Length <= 0)
                                {
                                    LogManager.WriteLog(LogTypes.Warning, string.Format("读取{0}配置文件中的物品配置项失败", CfgFile));
                                }
                                else
                                {
                                    myAwardItem.GoodsDataList = HuodongCachingMgr.ParseGoodsDataList(fields, "大型节日赠送王活动配置");
                                }
                            }

                            goodsIDs = Global.GetSafeAttributeStr(xmlItem, "GoodsTwo");
                            if (string.IsNullOrEmpty(goodsIDs))
                            {
                                //LogManager.WriteLog(LogTypes.Warning, string.Format("读取大型节日消费王活动配置文件中的物品配置项1失败"));
                            }
                            else
                            {
                                string[] fields = goodsIDs.Split('|');
                                if (fields.Length <= 0)
                                {
                                    LogManager.WriteLog(LogTypes.Warning, string.Format("读取{0}配置文件中的物品配置项失败", CfgFile));
                                }
                                else
                                {
                                    //将物品字符串列表解析成物品数据列表
                                    myAwardItem2.GoodsDataList = HuodongCachingMgr.ParseGoodsDataList(fields, "大型节日赠送王活动配置");
                                }
                            }

                            string timeGoods = Global.GetSafeAttributeStr(xmlItem, "GoodsThr");
                            string timeList  = Global.GetSafeAttributeStr(xmlItem, "EffectiveTime");
                            timeAwardItem.Init(timeGoods, timeList, "大型节日赠送王时效性物品活动配置");

                            string   rankings = Global.GetSafeAttributeStr(xmlItem, "Ranking");
                            string[] paiHangs = rankings.Split('-');

                            if (paiHangs.Length <= 0)
                            {
                                continue;
                            }

                            int min = Global.SafeConvertToInt32(paiHangs[0]);
                            int max = Global.SafeConvertToInt32(paiHangs[paiHangs.Length - 1]);

                            //设置排行奖励
                            for (int paiHang = min; paiHang <= max; paiHang++)
                            {
                                allAwardDict.Add(paiHang, myAwardItem);
                                occAwardDict.Add(paiHang, myAwardItem2);
                                timeAwardDict.Add(paiHang, timeAwardItem);
                            }
                        }
                    }
                }

                PredealDateTime();
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", CfgFile, ex.Message));

                return(false);
            }
            return(true);
        }
Example #25
0
 public bool Init()
 {
     try
     {
         string fileName = "Config/ThemeActivityLiBao.xml";
         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName));
         XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName));
         if (null == xml)
         {
             return(false);
         }
         this.ActivityType   = 151;
         this.FromDate       = "-1";
         this.ToDate         = "-1";
         this.AwardStartDate = "-1";
         this.AwardEndDate   = "-1";
         this.MyAwardItem    = new AwardItem();
         this.MyAwardItem.MinAwardCondionValue = 0;
         this.MyAwardItem.AwardYuanBao         = 0;
         XElement xmlItem = xml.Element("ThemeActivityLiBao");
         if (null == xmlItem)
         {
             return(false);
         }
         string goodsIDs = Global.GetSafeAttributeStr(xmlItem, "GoodsOne");
         if (string.IsNullOrEmpty(goodsIDs))
         {
             LogManager.WriteLog(LogTypes.Warning, string.Format("读取大型主题服礼包活动配置文件中的物品配置项1失败", new object[0]), null, true);
         }
         else
         {
             string[] fields = goodsIDs.Split(new char[]
             {
                 '|'
             });
             if (fields.Length <= 0)
             {
                 LogManager.WriteLog(LogTypes.Warning, string.Format("解析大型主题服礼包活动配置文件中的物品配置项1失败", new object[0]), null, true);
             }
             else
             {
                 this.MyAwardItem.GoodsDataList = HuodongCachingMgr.ParseGoodsDataList(fields, "大型主题服礼包配置1");
             }
         }
         goodsIDs = Global.GetSafeAttributeStr(xmlItem, "GoodsTwo");
         if (string.IsNullOrEmpty(goodsIDs))
         {
             LogManager.WriteLog(LogTypes.Warning, string.Format("读取大型主题服礼包活动配置文件中的物品配置项2失败", new object[0]), null, true);
         }
         else
         {
             string[] fields = goodsIDs.Split(new char[]
             {
                 '|'
             });
             if (fields.Length <= 0)
             {
                 LogManager.WriteLog(LogTypes.Warning, string.Format("解析大型主题服礼包活动配置文件中的物品配置项2失败", new object[0]), null, true);
             }
             else
             {
                 List <GoodsData> GoodsDataList = HuodongCachingMgr.ParseGoodsDataList(fields, "大型主题服礼包配置2");
                 foreach (GoodsData item in GoodsDataList)
                 {
                     SystemXmlItem systemGoods = null;
                     if (GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(item.GoodsID, out systemGoods))
                     {
                         int       toOccupation = Global.GetMainOccupationByGoodsID(item.GoodsID);
                         AwardItem myOccAward   = this.GetOccAward(toOccupation);
                         if (null == myOccAward)
                         {
                             myOccAward = new AwardItem();
                             myOccAward.GoodsDataList.Add(item);
                             this.OccAwardItemDict[toOccupation] = myOccAward;
                         }
                         else
                         {
                             myOccAward.GoodsDataList.Add(item);
                         }
                     }
                 }
             }
         }
         base.PredealDateTime();
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Fatal, "Config/ThemeActivityLiBao.xml解析出现异常", ex, true);
         return(false);
     }
     return(true);
 }
Example #26
0
        // 初始化配置文件信息
        public bool Init()
        {
            try
            {
                // 节日福利配置文件
                GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(FuLiCfgFile));
                XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(FuLiCfgFile));
                if (null == xml)
                {
                    LogManager.WriteLog(LogTypes.Fatal, string.Format("加载{0}时出错!!!文件不存在", FuLiCfgFile));
                    return(false);
                }

                XElement args = xml.Element("Activities");
                if (null != args)
                {
                    FromDate     = Global.GetSafeAttributeStr(args, "FromDate");
                    ToDate       = Global.GetSafeAttributeStr(args, "ToDate");
                    ActivityType = (int)Global.GetSafeAttributeLong(args, "ActivityType");

                    AwardStartDate = Global.GetSafeAttributeStr(args, "AwardStartDate");
                    AwardEndDate   = Global.GetSafeAttributeStr(args, "AwardEndDate");
                }

                args = xml.Element("GiftList");

                foreach (var fuliXml in args.Elements())
                {
                    JieRiFuLiItem item = new JieRiFuLiItem();
                    item.Type      = (EJieRiFuLiType)Global.GetSafeAttributeLong(fuliXml, "TypeID");
                    item.Open      = (int)Global.GetSafeAttributeLong(fuliXml, "Button");
                    item.StartDate = Global.GetSafeAttributeStr(fuliXml, "AwardStartDate");
                    item.EndDate   = Global.GetSafeAttributeStr(fuliXml, "AwardEndDate");

                    string szArg = Global.GetSafeAttributeStr(fuliXml, "Function");
                    if (item.Type == EJieRiFuLiType.CallPetReplace)
                    {
                        item.Arg = Convert.ToInt32(szArg);
                    }
                    else if (item.Type == EJieRiFuLiType.SoulStoneExtFunc)
                    {
                        string[] fields = szArg.Split('|');
                        List <Tuple <int, int> > argList = new List <Tuple <int, int> >();
                        for (int i = 0; i < fields.Length; ++i)
                        {
                            string[] fields2 = fields[i].Split(',');
                            argList.Add(new Tuple <int, int>(Convert.ToInt32(fields2[0]), Convert.ToInt32(fields2[1])));
                        }
                        item.Arg = argList;
                    }
                    else
                    {
                        item.Arg = szArg;
                    }

                    fuliDict.Add(item.Type, item);
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", FuLiCfgFile, ex.Message));
                return(false);
            }

            return(true);
        }
Example #27
0
        private const int updateIntervalSec = 15; //30 seconds

        public bool Init()
        {
            try
            {
                GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(CfgFile));
                XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(CfgFile));
                if (null == xml)
                {
                    return(false);
                }

                XElement args = xml.Element("Activities");
                if (null != args)
                {
                    FromDate     = Global.GetSafeAttributeStr(args, "FromDate");
                    ToDate       = Global.GetSafeAttributeStr(args, "ToDate");
                    ActivityType = (int)Global.GetSafeAttributeLong(args, "ActivityType");

                    AwardStartDate = Global.GetSafeAttributeStr(args, "AwardStartDate");
                    AwardEndDate   = Global.GetSafeAttributeStr(args, "AwardEndDate");
                }

                args = xml.Element("GiftList");
                if (null != args)
                {
                    IEnumerable <XElement> xmlItems = args.Elements();
                    foreach (var xmlItem in xmlItems)
                    {
                        if (null == xmlItem)
                        {
                            continue;
                        }
                        ChargeItem ci = new ChargeItem();
                        ci.Rank         = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                        ci.NeedChargeYB = (int)Global.GetSafeAttributeLong(xmlItem, "MinYuanBao");

                        chargeItemList.Add(ci);
                    }

                    // 多个档次,按照档次Id从小到大排序
                    chargeItemList.Sort((left, right) =>
                    {
                        if (left.Rank < right.Rank)
                        {
                            return(-1);
                        }
                        else if (left.Rank > right.Rank)
                        {
                            return(1);
                        }
                        else
                        {
                            return(0);
                        }
                    });
                }

                PredealDateTime();
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", CfgFile, ex.Message));
                return(false);
            }

            return(true);
        }