public static Achievement GetAchievement(int acId) { string[][] strs = ReadTxt.ReadText("achievement"); Achievement a = new Achievement(); for (int i = 0; i < strs.Length - 1; i++) { a.id = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 0)); if (a.id != acId) { continue; } a.name = ReadTxt.GetDataByRowAndCol(strs, i + 1, 1); a.desc = ReadTxt.GetDataByRowAndCol(strs, i + 1, 2); a.req = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 3)); return(a); } Debug.Log("没有找到成就--" + acId); return(new Achievement()); }
public void LoadPlaces(bool isRebirth) { // Debug.Log ("正在读取数据*******************************************"); PlaceDic = new Dictionary <int, Places> (); string[][] strs = ReadTxt.ReadText("places"); p = new PlaceUnit[strs.Length - 1]; for (int i = 0; i < p.Length; i++) { p [i] = new PlaceUnit(); p [i].unitId = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 0)); p [i].actionType = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 1)); string s = "PlaceUnit" + p [i].unitId.ToString() + "Para" + (isRebirth ? "_Memory" : ""); if (PlayerPrefs.GetString(s, "") == "") { p [i].actionParam = 1 + ";" + ReadTxt.GetDataByRowAndCol(strs, i + 1, 2); } else { p [i].actionParam = PlayerPrefs.GetString(s, ""); } p [i].name = ReadTxt.GetDataByRowAndCol(strs, i + 1, 3); p [i].desc = ReadTxt.GetDataByRowAndCol(strs, i + 1, 4); } for (int i = 0; i < MapDic.Count; i++) { Places ps = new Places(); ps.id = MapDic [i].id; for (int j = 0; j < p.Length; j++) { if ((int)(p [j].unitId / 100) == ps.id) { ps.placeUnits.Add(p [j]); } } PlaceDic.Add(ps.id, ps); } }
public static Plants GetPlant(int pId) { string[][] strs = ReadTxt.ReadText("plants"); Plants p = new Plants(); for (int i = 0; i < strs.Length - 1; i++) { p.plantType = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 0)); if (p.plantType != pId) { continue; } string[][] s = ReadTxt.GetRequire(ReadTxt.GetDataByRowAndCol(strs, i + 1, 1)); if (s != null) { p.plantReq = new Dictionary <int, int> (); for (int j = 0; j < s.Length; j++) { p.plantReq.Add(int.Parse(s [j] [0]), int.Parse(s [j] [1])); } } p.plantTime = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 2)); p.plantGrowCycle = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 3)); string[][] ss = ReadTxt.GetRequire(ReadTxt.GetDataByRowAndCol(strs, i + 1, 4)); if (ss != null) { p.plantObtain = new Dictionary <int, int> (); for (int j = 0; j < ss.Length; j++) { p.plantObtain.Add(int.Parse(ss [j] [0]), int.Parse(ss [j] [1])); } } return(p); } Debug.Log("没有找到种植类型--" + pId); return(new Plants()); }
public static Skill GetSkill(int skillId) { string[][] strs = ReadTxt.ReadText("skill"); Skill s = new Skill(); for (int i = 0; i < strs.Length - 1; i++) { s.id = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 0)); if (s.id != skillId) { continue; } s.name = ReadTxt.GetDataByRowAndCol(strs, i + 1, 1); s.target = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 2)); s.power = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 3)); s.effectId = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 4)); s.effectProp = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 5)); s.castSpeed = float.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 6)); return(s); } Debug.Log("没有找到技能--" + skillId); return(new Skill()); }
public static DungeonTreasure GetDungeonTreasure(int dtId) { string[][] strs = ReadTxt.ReadText("dungeon_treasure"); DungeonTreasure dt = new DungeonTreasure(); for (int i = 0; i < strs.Length - 1; i++) { dt.id = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 0)); if (dt.id != dtId) { continue; } string[][] p = ReadTxt.GetRequire(ReadTxt.GetDataByRowAndCol(strs, i + 1, 1)); dt.reward = new Dictionary <int, int> (); for (int j = 0; j < p.Length; j++) { dt.reward.Add(int.Parse(p [j] [0]), int.Parse(p [j] [1])); } return(dt); } Debug.Log("没有找到地牢宝藏--" + dtId); return(new DungeonTreasure()); }
public static MonsterTitle GetMonsterTitle(int mtId) { string[][] strs = ReadTxt.ReadText("monster_title"); MonsterTitle mt = new MonsterTitle(); for (int i = 0; i < strs.Length - 1; i++) { mt.id = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 0)); if (mt.id != mtId) { continue; } mt.title = ReadTxt.GetDataByRowAndCol(strs, i + 1, 1); mt.hpBonus = float.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 2)); mt.atkBonus = float.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 3)); mt.defBonus = float.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 4)); mt.attSpeedBonus = float.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 5)); mt.speedBonus = float.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 6)); mt.dodgeBonus = float.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 7)); return(mt); } Debug.Log("没有找到怪物后缀--" + mtId); return(new MonsterTitle()); }
//组建xml文档 public string GetXml(PingZhengTemp PingZhengTemp, string path) { //string xml = new Dal.NcBill.ccpwgbg().ToNc(newdh, Server.MapPath("~/")); StringBuilder sb = new StringBuilder(); //表头 PingZhengTemp.id = System.Guid.NewGuid().ToString().ToUpper(); PingZhengTemp.date = PingZhengTemp.date; PingZhengTemp.year = PingZhengTemp.date.Substring(0, 4).ToString(); PingZhengTemp.month = PingZhengTemp.date.Substring(5, 2).ToString(); PingZhengTemp.voucher_type = PingZhengTemp.voucher_type.ToString(); string s1 = ReadTxt.Read(path + "Views\\NcModel\\1header.txt"); s1 = ReadTxt.ReplaceTxt(PingZhengTemp, s1); //表体 string s2 = ReadTxt.Read(path + "Views\\NcModel\\2body.txt"); StringBuilder sb2 = new StringBuilder(); var entry = PingZhengTemp.entry.ToList(); foreach (var i in entry) { if (!string.IsNullOrEmpty(i.xjl)) { i.item += "<item name=\"现金流量项目\">" + i.xjl + "</item>"; } if (i.fzhs != null) { var fzhs = i.fzhs.ToList(); foreach (var j in fzhs) { if (!string.IsNullOrEmpty(j.Hsame)) { i.item += "<item name=\"" + j.Hsame + "\">" + j.Hsvale + "</item>"; } } } } //替换 foreach (var i in entry) { string stemp = s2.ToString(); stemp = ReadTxt.ReplaceTxt(i, stemp); stemp = stemp.Replace("@item", ""); sb2.Append(stemp); } //表尾 string s3 = ReadTxt.Read(path + "Views\\NcModel\\3foot.txt"); string endstr = sb.Append(s1).Append(sb2.ToString()).Append(s3).ToString(); XmlDocument xdoc = new XmlDocument(); xdoc.LoadXml(endstr); //写日志 string FilePath = path + "XMLDoc/" + PingZhengTemp.company + PingZhengTemp.date.ToString() + ".txt"; ReadTxt.Write(FilePath, xdoc.InnerXml); return(xdoc.InnerXml); }
public MaTran(string file) { var txt = new ReadTxt(file); MT = txt.TachPhanTuSo(); }
/// <summary> /// 用于获取地牢的怪物,需要提供最小等级和最大等级 /// </summary> /// <returns>The monster.</returns> /// <param name="minLv">Minimum lv.</param> /// <param name="maxLv">Max lv.</param> public static ArrayList GetMonster(int minLv, int maxLv, int livePlace) { ArrayList mList = new ArrayList(); string[][] strs = ReadTxt.ReadText("monster"); for (int i = 0; i < strs.Length - 1; i++) { Monster m = new Monster(); m.id = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 0)); Debug.Log(m.id); m.level = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 2)); m.livePlace = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 15)); if (m.level < minLv || m.level > maxLv || m.livePlace != livePlace) { continue; } m.id = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 0)); m.name = ReadTxt.GetDataByRowAndCol(strs, i + 1, 1); m.model = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 3)); m.spirit = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 4)); m.speed = float.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 5)); m.range = float.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 6)); m.vitalSensibility = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 7)); string s = ReadTxt.GetDataByRowAndCol(strs, i + 1, 8); int skillId = 0; if (s.Contains("|")) { string[] ss = s.Split('|'); m.skillList = new Skill[ss.Length]; for (int j = 0; j < ss.Length; j++) { skillId = int.Parse(ss [j]); m.skillList [j] = GetSkill(skillId); } } else { m.skillList = new Skill[1]; skillId = int.Parse(s); m.skillList [0] = GetSkill(skillId); } s = ReadTxt.GetDataByRowAndCol(strs, i + 1, 9); string[] s1 = s.Split('|'); m.bodyPart = new string[3]; for (int j = 0; j < m.bodyPart.Length; j++) { m.bodyPart [j] = s1 [j]; } string[][] re = ReadTxt.GetRequire(ReadTxt.GetDataByRowAndCol(strs, i + 1, 10)); m.drop = new Dictionary <int, float>(); if (re != null) { for (int j = 0; j < re.Length; j++) { m.drop.Add(int.Parse(re [j] [0]), float.Parse(re [j] [1])); } } m.canCapture = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 11)); m.groupNum = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 12)); m.mapOpen = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 13)); m.renown = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 14)); mList.Add(m); } return(mList); }