public bool LoadCsv(string strContent) { if (strContent.Length == 0) { return(false); } m_mapElements.Clear(); m_vecAllElements.Clear(); int contentOffset = 0; List <string> vecLine; vecLine = GameAssist.readCsvLine(strContent, ref contentOffset); if (vecLine.Count != 16) { Debug.Log("XingShiFuMo.csv中列数量与生成的代码不匹配!"); return(false); } if (vecLine[0] != "LV") { Debug.Log("XingShiFuMo.csv中字段[LV]位置不对应"); return(false); } if (vecLine[1] != "Exp") { Debug.Log("XingShiFuMo.csv中字段[Exp]位置不对应"); return(false); } if (vecLine[2] != "Money") { Debug.Log("XingShiFuMo.csv中字段[Money]位置不对应"); return(false); } if (vecLine[3] != "Dem") { Debug.Log("XingShiFuMo.csv中字段[Dem]位置不对应"); return(false); } if (vecLine[4] != "Pattack") { Debug.Log("XingShiFuMo.csv中字段[Pattack]位置不对应"); return(false); } if (vecLine[5] != "Mattack") { Debug.Log("XingShiFuMo.csv中字段[Mattack]位置不对应"); return(false); } if (vecLine[6] != "PDefense") { Debug.Log("XingShiFuMo.csv中字段[PDefense]位置不对应"); return(false); } if (vecLine[7] != "MDefense") { Debug.Log("XingShiFuMo.csv中字段[MDefense]位置不对应"); return(false); } if (vecLine[8] != "HP") { Debug.Log("XingShiFuMo.csv中字段[HP]位置不对应"); return(false); } if (vecLine[9] != "Baoji") { Debug.Log("XingShiFuMo.csv中字段[Baoji]位置不对应"); return(false); } if (vecLine[10] != "Bisha") { Debug.Log("XingShiFuMo.csv中字段[Bisha]位置不对应"); return(false); } if (vecLine[11] != "MP") { Debug.Log("XingShiFuMo.csv中字段[MP]位置不对应"); return(false); } if (vecLine[12] != "MpHuifu") { Debug.Log("XingShiFuMo.csv中字段[MpHuifu]位置不对应"); return(false); } if (vecLine[13] != "Renxing") { Debug.Log("XingShiFuMo.csv中字段[Renxing]位置不对应"); return(false); } if (vecLine[14] != "Shouhu") { Debug.Log("XingShiFuMo.csv中字段[Shouhu]位置不对应"); return(false); } if (vecLine[15] != "HpHuifu") { Debug.Log("XingShiFuMo.csv中字段[HpHuifu]位置不对应"); return(false); } while (true) { vecLine = GameAssist.readCsvLine(strContent, ref contentOffset); if ((int)vecLine.Count == 0) { break; } if ((int)vecLine.Count != (int)16) { return(false); } XingShiFuMoElement member = new XingShiFuMoElement(); member.LV = Convert.ToInt32(vecLine[0]); member.Exp = Convert.ToInt32(vecLine[1]); member.Money = Convert.ToInt32(vecLine[2]); member.Dem = Convert.ToInt32(vecLine[3]); member.Pattack = Convert.ToInt32(vecLine[4]); member.Mattack = Convert.ToInt32(vecLine[5]); member.PDefense = Convert.ToInt32(vecLine[6]); member.MDefense = Convert.ToInt32(vecLine[7]); member.HP = Convert.ToInt32(vecLine[8]); member.Baoji = Convert.ToInt32(vecLine[9]); member.Bisha = Convert.ToInt32(vecLine[10]); member.MP = Convert.ToInt32(vecLine[11]); member.MpHuifu = Convert.ToInt32(vecLine[12]); member.Renxing = Convert.ToInt32(vecLine[13]); member.Shouhu = Convert.ToInt32(vecLine[14]); member.HpHuifu = Convert.ToInt32(vecLine[15]); member.IsValidate = true; m_vecAllElements.Add(member); m_mapElements[member.LV] = member; } return(true); }
private XingShiFuMoTable() { m_mapElements = new Dictionary <int, XingShiFuMoElement>(); m_emptyItem = new XingShiFuMoElement(); m_vecAllElements = new List <XingShiFuMoElement>(); }
public bool LoadBin(byte[] binContent) { m_mapElements.Clear(); m_vecAllElements.Clear(); int nCol, nRow; int readPos = 0; readPos += GameAssist.ReadInt32Variant(binContent, readPos, out nCol); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out nRow); List <string> vecLine = new List <string>(nCol); List <int> vecHeadType = new List <int>(nCol); string tmpStr; int tmpInt; for (int i = 0; i < nCol; i++) { readPos += GameAssist.ReadString(binContent, readPos, out tmpStr); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out tmpInt); vecLine.Add(tmpStr); vecHeadType.Add(tmpInt); } if (vecLine.Count != 16) { Debug.Log("XingShiFuMo.csv中列数量与生成的代码不匹配!"); return(false); } if (vecLine[0] != "LV") { Debug.Log("XingShiFuMo.csv中字段[LV]位置不对应"); return(false); } if (vecLine[1] != "Exp") { Debug.Log("XingShiFuMo.csv中字段[Exp]位置不对应"); return(false); } if (vecLine[2] != "Money") { Debug.Log("XingShiFuMo.csv中字段[Money]位置不对应"); return(false); } if (vecLine[3] != "Dem") { Debug.Log("XingShiFuMo.csv中字段[Dem]位置不对应"); return(false); } if (vecLine[4] != "Pattack") { Debug.Log("XingShiFuMo.csv中字段[Pattack]位置不对应"); return(false); } if (vecLine[5] != "Mattack") { Debug.Log("XingShiFuMo.csv中字段[Mattack]位置不对应"); return(false); } if (vecLine[6] != "PDefense") { Debug.Log("XingShiFuMo.csv中字段[PDefense]位置不对应"); return(false); } if (vecLine[7] != "MDefense") { Debug.Log("XingShiFuMo.csv中字段[MDefense]位置不对应"); return(false); } if (vecLine[8] != "HP") { Debug.Log("XingShiFuMo.csv中字段[HP]位置不对应"); return(false); } if (vecLine[9] != "Baoji") { Debug.Log("XingShiFuMo.csv中字段[Baoji]位置不对应"); return(false); } if (vecLine[10] != "Bisha") { Debug.Log("XingShiFuMo.csv中字段[Bisha]位置不对应"); return(false); } if (vecLine[11] != "MP") { Debug.Log("XingShiFuMo.csv中字段[MP]位置不对应"); return(false); } if (vecLine[12] != "MpHuifu") { Debug.Log("XingShiFuMo.csv中字段[MpHuifu]位置不对应"); return(false); } if (vecLine[13] != "Renxing") { Debug.Log("XingShiFuMo.csv中字段[Renxing]位置不对应"); return(false); } if (vecLine[14] != "Shouhu") { Debug.Log("XingShiFuMo.csv中字段[Shouhu]位置不对应"); return(false); } if (vecLine[15] != "HpHuifu") { Debug.Log("XingShiFuMo.csv中字段[HpHuifu]位置不对应"); return(false); } for (int i = 0; i < nRow; i++) { XingShiFuMoElement member = new XingShiFuMoElement(); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.LV); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Exp); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Money); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Dem); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Pattack); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Mattack); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.PDefense); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.MDefense); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.HP); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Baoji); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Bisha); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.MP); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.MpHuifu); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Renxing); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Shouhu); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.HpHuifu); member.IsValidate = true; m_vecAllElements.Add(member); m_mapElements[member.LV] = member; } return(true); }