private static bool Load_DuiHuanShangCheng(out List <DuiHuanShangChengConfig> _DuiHuanShangChengCgfList) { _DuiHuanShangChengCgfList = new List <DuiHuanShangChengConfig>(); try { XElement xml = ConfigHelper.Load(KuaFuServerManager.GetResourcePath("Config/DuiHuanShangCheng.xml", KuaFuServerManager.ResourcePathTypes.GameRes)); if (null == xml) { LogManager.WriteLog(LogTypes.Fatal, string.Format("读取 {0} null == xml", "Config/DuiHuanShangCheng.xml"), null, true); return(false); } IEnumerable <XElement> xmlItems = xml.Elements(); foreach (XElement xmlItem in xmlItems) { DuiHuanShangChengConfig myData = new DuiHuanShangChengConfig(); myData.ID = (int)ConfigHelper.GetElementAttributeValueLong(xmlItem, "ID", 0L); myData.DaiBiJiaGe = (int)ConfigHelper.GetElementAttributeValueLong(xmlItem, "DaiBiJiaGe", 0L); myData.MeiRiShangXianDan = (int)ConfigHelper.GetElementAttributeValueLong(xmlItem, "MeiRiShangXianDan", 0L); myData.Name = ConfigHelper.GetElementAttributeValue(xmlItem, "Name", ""); myData.WuPinID = ConfigHelper.GetElementAttributeValue(xmlItem, "WuPinID", ""); _DuiHuanShangChengCgfList.Add(myData); } } catch (Exception ex) { LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", "Config/DuiHuanShangCheng.xml", ex.Message), null, true); return(false); } return(true); }
public static bool InitConfig() { TianTi5v5Service.RankData.MaxPaiMingRank = 201; try { string fileName = "Config/TeamDuanWeiAward.xml"; string fullPathFileName = KuaFuServerManager.GetResourcePath(fileName, KuaFuServerManager.ResourcePathTypes.GameRes); XElement xml = ConfigHelper.Load(fullPathFileName); IEnumerable <XElement> nodes = xml.Elements(); foreach (XElement node in nodes) { int StarRank = (int)ConfigHelper.GetElementAttributeValueLong(node, "StarRank", 201L); TianTi5v5Service.RankData.MaxPaiMingRank = Math.Max(TianTi5v5Service.RankData.MaxPaiMingRank, StarRank); } } catch (Exception ex) { LogManager.WriteException(ex.ToString()); } Dictionary <int, TianTi5v5ZhanDuiData> dict = new Dictionary <int, TianTi5v5ZhanDuiData>(); lock (TianTi5v5Service.Mutex) { TianTi5v5Service.LoadZhanDuiRankData(TianTi5v5Service.RankData, TimeUtil.NowDateTime()); if (!TianTi5v5Service.Persistence.LoadZhanDuiData(dict)) { return(false); } TianTi5v5Service.ZhanDuiDict = dict; } TianTi5v5Service.pTianTiPiPeiCfg = new List <TianTi5v5Service.PiPeiCfg> { new TianTi5v5Service.PiPeiCfg { ID = 0, MinTime = 0, MaxTime = 5 }, new TianTi5v5Service.PiPeiCfg { ID = 1, MinTime = 5, MaxTime = 10 }, new TianTi5v5Service.PiPeiCfg { ID = 3, MinTime = 10, MaxTime = 15 }, new TianTi5v5Service.PiPeiCfg { ID = 25, MinTime = 15, MaxTime = 60 } }; return(true); }
public static bool InitConfig() { lock (ZhanDuiZhengBa_K.Mutex) { ZhanDuiZhengBa_K.Initialize = false; bool bOk = ZhanDuiZhengBa_K._Config.Load(KuaFuServerManager.GetResourcePath("Config\\TeamMatch.xml", KuaFuServerManager.ResourcePathTypes.GameRes), KuaFuServerManager.GetResourcePath("Config\\TeamMatchBirthPoint.xml", KuaFuServerManager.ResourcePathTypes.GameRes)); ZhanDuiZhengBaConsts.MinZhanDuiNum = (Global.TestMode ? 0 : 4); if (!bOk) { LogManager.WriteLog(LogTypes.Error, "ZhanDuiZhengBa_K.InitConfig failed!", null, true); } ZhanDuiZhengBa_K.Initialize = bOk; } return(true); }
public void LoadConfig() { try { List <StatisticsControl> MyIPControlList = new List <StatisticsControl>(); string file = "Config\\IPStaristicsConfig.xml"; XElement xml = ConfigHelper.Load(KuaFuServerManager.GetResourcePath(file, KuaFuServerManager.ResourcePathTypes.GameRes)); if (null != xml) { foreach (XElement xmlItem in xml.Elements()) { MyIPControlList.Add(new StatisticsControl { ID = Convert.ToInt32(xmlItem.Attribute("ID").Value.ToString()), ParamType = Convert.ToInt32(xmlItem.Attribute("ParamType").Value.ToString()), ParamLimit = Convert.ToInt32(xmlItem.Attribute("ParamLimit").Value.ToString()), ComParamType = Convert.ToInt32(xmlItem.Attribute("ComParamType").Value.ToString()), ComParamLimit = Convert.ToDouble(xmlItem.Attribute("ComParamLimit").Value.ToString()), OperaType = Convert.ToInt32(xmlItem.Attribute("OperaType").Value.ToString()), OperaParam = Convert.ToInt32(xmlItem.Attribute("OperaParam").Value.ToString()) }); } file = "Config\\IPPassList.xml"; xml = ConfigHelper.Load(KuaFuServerManager.GetResourcePath(file, KuaFuServerManager.ResourcePathTypes.GameRes)); if (null != xml) { List <IPPassList> NewIPPassList = new List <IPPassList>(); IEnumerable <XElement> xmlItems = xml.Elements(); foreach (XElement xmlItem in xmlItems) { IPPassList value = new IPPassList(); value.ID = Convert.ToInt32(xmlItem.Attribute("ID").Value.ToString()); string MinIP = xmlItem.Attribute("MinIP").Value.ToString(); value.MinIP = IpHelper.IpToInt(MinIP); string MaxIP = xmlItem.Attribute("MaxIP").Value.ToString(); value.MaxIP = IpHelper.IpToInt(MaxIP); NewIPPassList.Add(value); } this._IPControlList = MyIPControlList; this._IPPassList = NewIPPassList; } } } catch (Exception ex) { LogManager.WriteLog(LogTypes.Error, "IPStaristicsConfig.InitConfig failed!", ex, true); } }
public static bool InitConfig() { lock (EscapeBattle_K.Mutex) { EscapeBattle_K.Initialize = false; bool bOk = EscapeBattle_K._Config.Load(KuaFuServerManager.GetResourcePath("Config\\EscapeActivityRules.xml", KuaFuServerManager.ResourcePathTypes.GameRes)); EscapeBattleMatchConfig config = EscapeBattle_K._Config.MatchConfigList[0]; EscapeBattleConsts.MinZhanDuiNumPerGame = config.MatchTeamNum; EscapeBattleConsts.MinRoleNumPerGame = config.EnterBattleNum; EscapeBattleConsts.BattleSignSecs = config.BattleSignSecs; DateTime.TryParse(KuaFuServerManager.systemParamsList.GetParamValueByName("EscapeStartTime"), out EscapeBattleConsts.EscapeStartTime); if (!bOk) { LogManager.WriteLog(LogTypes.Error, "EscapeBattle_K.InitConfig failed!", null, true); } EscapeBattle_K.Initialize = bOk; } return(true); }
private static bool LoadCaiDaXiao(out List <CaiDaXiaoConfig> _CaiDaXiaoCfgList) { _CaiDaXiaoCfgList = new List <CaiDaXiaoConfig>(); try { XElement xml = ConfigHelper.Load(KuaFuServerManager.GetResourcePath("Config/CaiDaXiao.xml", KuaFuServerManager.ResourcePathTypes.GameRes)); if (null == xml) { LogManager.WriteLog(LogTypes.Fatal, string.Format("读取 {0} null == xml", "Config/CaiDaXiao.xml"), null, true); return(false); } IEnumerable <XElement> xmlItems = xml.Elements(); foreach (XElement xmlItem in xmlItems) { if (null != xmlItem) { CaiDaXiaoConfig myData = new CaiDaXiaoConfig(); myData.ID = (int)ConfigHelper.GetElementAttributeValueLong(xmlItem, "ID", 0L); myData.XiaoHaoDaiBi = (int)ConfigHelper.GetElementAttributeValueLong(xmlItem, "XiaoHaoDaiBi", 0L); myData.ShangChengKaiGuan = (int)ConfigHelper.GetElementAttributeValueLong(xmlItem, "ShangChengKaiGuan", 0L); myData.HuoDongKaiQi = ConfigHelper.GetElementAttributeValue(xmlItem, "HuoDongKaiQi", ""); myData.ZhuShuShangXian = (int)ConfigHelper.GetElementAttributeValueLong(xmlItem, "ZhuShuShangXian", 0L); DateTime.Parse(myData.HuoDongKaiQi); myData.HuoDongJieSu = ConfigHelper.GetElementAttributeValue(xmlItem, "HuoDongJieSu", ""); DateTime.Parse(myData.HuoDongJieSu); myData.MeiRiKaiQi = ConfigHelper.GetElementAttributeValue(xmlItem, "MeiRiKaiQi", ""); DateTime.Parse(myData.MeiRiKaiQi); myData.MeiRiJieSu = ConfigHelper.GetElementAttributeValue(xmlItem, "MeiRiJieSu", ""); DateTime.Parse(myData.MeiRiJieSu); _CaiDaXiaoCfgList.Add(myData); } } } catch (Exception ex) { LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", "Config/CaiDaXiao.xml", ex.Message), null, true); return(false); } return(true); }
public void LoadParamsList() { string fileName = string.Format("Config/SystemParams.xml", new object[0]); XElement xml = XElement.Load(KuaFuServerManager.GetResourcePath(fileName, KuaFuServerManager.ResourcePathTypes.GameRes)); if (null == xml) { throw new Exception(string.Format("加载系统配置参数配置文件:{0}, 失败。没有找到相关XML配置文件!", fileName)); } IEnumerable <XElement> paramNodes = xml.Elements("Params").Elements <XElement>(); if (null != paramNodes) { Dictionary <string, string> paramsDict = new Dictionary <string, string>(); foreach (XElement xmlNode in paramNodes) { string paramName = ConfigHelper.GetElementAttributeValue(xmlNode, "Name", ""); string paramValue = ConfigHelper.GetElementAttributeValue(xmlNode, "Value", ""); paramsDict[paramName] = paramValue; } this._ParamsDict = paramsDict; } }
public void InitConfig() { try { lock (this.MutexConfig) { DateTime.TryParse(KuaFuServerManager.systemParamsList.GetParamValueByName("ZorkStartTime"), out this.ZorkStartTime); this.SceneDataDict.Clear(); string fileName = "Config/ZorkActivityRules.xml"; string fullPathFileName = KuaFuServerManager.GetResourcePath(fileName, KuaFuServerManager.ResourcePathTypes.GameRes); XElement xml = ConfigHelper.Load(fullPathFileName); IEnumerable <XElement> xmlItems = xml.Elements(); foreach (XElement node in xmlItems) { ZorkBattleSceneInfo sceneItem = new ZorkBattleSceneInfo(); int id = (int)ConfigHelper.GetElementAttributeValueLong(node, "ID", 0L); int mapCode = (int)ConfigHelper.GetElementAttributeValueLong(node, "MapCode", 0L); sceneItem.Id = id; sceneItem.MapCode = mapCode; sceneItem.MaxEnterNum = (int)ConfigHelper.GetElementAttributeValueLong(node, "MaxEnterNum", 0L); sceneItem.PrepareSecs = (int)ConfigHelper.GetElementAttributeValueLong(node, "PrepareSecs", 0L); sceneItem.FightingSecs = (int)ConfigHelper.GetElementAttributeValueLong(node, "FightingSecs", 0L); sceneItem.ClearRolesSecs = (int)ConfigHelper.GetElementAttributeValueLong(node, "ClearRolesSecs", 0L); sceneItem.BattleSignSecs = (int)ConfigHelper.GetElementAttributeValueLong(node, "BattleSignSecs", 0L); sceneItem.SeasonFightRound = (int)ConfigHelper.GetElementAttributeValueLong(node, "SeasonFightDay", 0L); string[] fields = node.Attribute("TimePoints").Value.Split(new char[] { ',', '-', '|' }); for (int i = 0; i < fields.Length; i += 3) { TimeSpan dayPart = new TimeSpan(Convert.ToInt32(fields[i]), 0, 0, 0); TimeSpan time = DateTime.Parse(fields[i + 1]).TimeOfDay.Add(dayPart); TimeSpan time2 = DateTime.Parse(fields[i + 2]).TimeOfDay.Add(dayPart); sceneItem.TimePoints.Add(time); sceneItem.TimePoints.Add(time2); } for (int i = 0; i < sceneItem.TimePoints.Count; i++) { TimeSpan ts = new TimeSpan(sceneItem.TimePoints[i].Hours, sceneItem.TimePoints[i].Minutes, sceneItem.TimePoints[i].Seconds); sceneItem.SecondsOfDay.Add(ts.TotalSeconds); } for (int i = 0; i < sceneItem.TimePoints.Count; i++) { TimeSpan ts = new TimeSpan(sceneItem.TimePoints[i].Hours, sceneItem.TimePoints[i].Minutes, sceneItem.TimePoints[i].Seconds); sceneItem.SecondsOfDay.Add(ts.TotalSeconds); } this.SceneDataDict[id] = sceneItem; this.SeasonWeeks = Math.Max(this.SeasonWeeks, (int)Math.Ceiling((double)sceneItem.SeasonFightRound / (double)(sceneItem.TimePoints.Count / 2))); } this.ZorkLevelRangeList.Clear(); fileName = "Config/ZorkDanAward.xml"; fullPathFileName = KuaFuServerManager.GetResourcePath(fileName, KuaFuServerManager.ResourcePathTypes.GameRes); xml = ConfigHelper.Load(fullPathFileName); xmlItems = xml.Elements(); foreach (XElement node in xmlItems) { ZorkBattleAwardConfig item = new ZorkBattleAwardConfig(); item.ID = (int)ConfigHelper.GetElementAttributeValueLong(node, "ID", 0L); item.RankValue = (int)ConfigHelper.GetElementAttributeValueLong(node, "RankValue", 0L); item.WinRankValue = (int)ConfigHelper.GetElementAttributeValueLong(node, "WinRankValue", 0L); item.LoseRankValue = (int)ConfigHelper.GetElementAttributeValueLong(node, "LoseRankValue", 0L); this.ZorkLevelRangeList.Add(item); this.ZorkLevelRangeList.Sort(delegate(ZorkBattleAwardConfig left, ZorkBattleAwardConfig righit) { int result; if (left.ID > righit.ID) { result = -1; } else if (left.ID > righit.ID) { result = 1; } else { result = 0; } return(result); }); } } } catch (Exception ex) { LogManager.WriteExceptionUseCache(ex.ToString()); } }
private static bool LoadCaiShuZi(out List <CaiShuZiConfig> _CaiShuZiCfgList) { _CaiShuZiCfgList = new List <CaiShuZiConfig>(); try { XElement xml = ConfigHelper.Load(KuaFuServerManager.GetResourcePath("Config/CaiShuZi.xml", KuaFuServerManager.ResourcePathTypes.GameRes)); if (null == xml) { LogManager.WriteLog(LogTypes.Fatal, string.Format("读取 {0} null == xml", "Config/CaiShuZi.xml"), null, true); return(false); } IEnumerable <XElement> xmlItems = xml.Elements(); foreach (XElement xmlItem in xmlItems) { CaiShuZiConfig myData = new CaiShuZiConfig(); myData.ID = (int)ConfigHelper.GetElementAttributeValueLong(xmlItem, "ID", 0L); myData.XiaoHaoDaiBi = (int)ConfigHelper.GetElementAttributeValueLong(xmlItem, "XiaoHaoDaiBi", 0L); myData.ChuFaBiZhong = (int)ConfigHelper.GetElementAttributeValueLong(xmlItem, "ChuFaBiZhong", 0L); myData.BuChongTiaoJian = (int)ConfigHelper.GetElementAttributeValueLong(xmlItem, "BuChongTiaoJian", 0L); myData.XiTongChouCheng = ConfigHelper.GetElementAttributeValueDouble(xmlItem, "XiTongChouCheng", 0.0); myData.ShangChengKaiGuan = (int)ConfigHelper.GetElementAttributeValueLong(xmlItem, "ShangChengKaiGuan", 0L); myData.AnNiuList = new List <CaiShuZiAnNiu>(); foreach (string item in ConfigHelper.GetElementAttributeValue(xmlItem, "ZhongJiangFanLi", "").Split(new char[] { '|' })) { string[] temp = item.Split(new char[] { ',' }); if (temp.Length < 2) { LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现 AnNiuName err, myData.ID={1}", "Config/CaiShuZi.xml", myData.ID), null, true); } else { CaiShuZiAnNiu d = new CaiShuZiAnNiu(); d.NO = Convert.ToInt32(temp[0]); d.Percent = Convert.ToDouble(temp[1]); myData.AnNiuList.Add(d); if (d.NO != myData.AnNiuList.Count) { LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现 d.NO != myData.AnNiuList.Count myData.ID={1}", "Config/CaiShuZi.xml", myData.ID), null, true); } } } if (myData.AnNiuList.Count < 3) { LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现 myData.AnNiuList.Count < 3 err, myData.ID={1}", "Config/CaiShuZi.xml", myData.ID), null, true); } else { myData.KaiQiShiJian = ConfigHelper.GetElementAttributeValue(xmlItem, "KaiQiShiJian", ""); DateTime.Parse(myData.KaiQiShiJian); myData.JieShuShiJian = ConfigHelper.GetElementAttributeValue(xmlItem, "JieShuShiJian", ""); DateTime.Parse(myData.JieShuShiJian); myData.KaiJiangShiJian = ConfigHelper.GetElementAttributeValue(xmlItem, "KaiJiangShiJian", ""); DateTime.Parse(myData.KaiJiangShiJian); _CaiShuZiCfgList.Add(myData); } } } catch (Exception ex) { LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", "Config/CaiShuZi.xml", ex.Message), null, true); return(false); } return(true); }