private MissionShiYongTable() { m_mapElements = new Dictionary <int, MissionShiYongElement>(); m_emptyItem = new MissionShiYongElement(); m_vecAllElements = new List <MissionShiYongElement>(); }
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 != 7) { Debug.Log("MissionShiYong.csv中列数量与生成的代码不匹配!"); return(false); } if (vecLine[0] != "MissionID") { Debug.Log("MissionShiYong.csv中字段[MissionID]位置不对应"); return(false); } if (vecLine[1] != "Name") { Debug.Log("MissionShiYong.csv中字段[Name]位置不对应"); return(false); } if (vecLine[2] != "MuBiao") { Debug.Log("MissionShiYong.csv中字段[MuBiao]位置不对应"); return(false); } if (vecLine[3] != "ZuoBiao") { Debug.Log("MissionShiYong.csv中字段[ZuoBiao]位置不对应"); return(false); } if (vecLine[4] != "IsTiShi") { Debug.Log("MissionShiYong.csv中字段[IsTiShi]位置不对应"); return(false); } if (vecLine[5] != "Time") { Debug.Log("MissionShiYong.csv中字段[Time]位置不对应"); return(false); } if (vecLine[6] != "DaoHang") { Debug.Log("MissionShiYong.csv中字段[DaoHang]位置不对应"); return(false); } for (int i = 0; i < nRow; i++) { MissionShiYongElement member = new MissionShiYongElement(); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.MissionID); readPos += GameAssist.ReadString(binContent, readPos, out member.Name); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.MuBiao); readPos += GameAssist.ReadString(binContent, readPos, out member.ZuoBiao); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.IsTiShi); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Time); readPos += GameAssist.ReadString(binContent, readPos, out member.DaoHang); member.IsValidate = true; m_vecAllElements.Add(member); m_mapElements[member.MissionID] = member; } return(true); }
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 != 7) { Debug.Log("MissionShiYong.csv中列数量与生成的代码不匹配!"); return(false); } if (vecLine[0] != "MissionID") { Debug.Log("MissionShiYong.csv中字段[MissionID]位置不对应"); return(false); } if (vecLine[1] != "Name") { Debug.Log("MissionShiYong.csv中字段[Name]位置不对应"); return(false); } if (vecLine[2] != "MuBiao") { Debug.Log("MissionShiYong.csv中字段[MuBiao]位置不对应"); return(false); } if (vecLine[3] != "ZuoBiao") { Debug.Log("MissionShiYong.csv中字段[ZuoBiao]位置不对应"); return(false); } if (vecLine[4] != "IsTiShi") { Debug.Log("MissionShiYong.csv中字段[IsTiShi]位置不对应"); return(false); } if (vecLine[5] != "Time") { Debug.Log("MissionShiYong.csv中字段[Time]位置不对应"); return(false); } if (vecLine[6] != "DaoHang") { Debug.Log("MissionShiYong.csv中字段[DaoHang]位置不对应"); return(false); } while (true) { vecLine = GameAssist.readCsvLine(strContent, ref contentOffset); if ((int)vecLine.Count == 0) { break; } if ((int)vecLine.Count != (int)7) { return(false); } MissionShiYongElement member = new MissionShiYongElement(); member.MissionID = Convert.ToInt32(vecLine[0]); member.Name = vecLine[1]; member.MuBiao = Convert.ToInt32(vecLine[2]); member.ZuoBiao = vecLine[3]; member.IsTiShi = Convert.ToInt32(vecLine[4]); member.Time = Convert.ToInt32(vecLine[5]); member.DaoHang = vecLine[6]; member.IsValidate = true; m_vecAllElements.Add(member); m_mapElements[member.MissionID] = member; } return(true); }