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 != 26) { Debug.Log("HeroSkill.csv中列数量与生成的代码不匹配!"); return(false); } if (vecLine[0] != "SkillID") { Debug.Log("HeroSkill.csv中字段[SkillID]位置不对应"); return(false); } if (vecLine[1] != "Name") { Debug.Log("HeroSkill.csv中字段[Name]位置不对应"); return(false); } if (vecLine[2] != "SourceIcon") { Debug.Log("HeroSkill.csv中字段[SourceIcon]位置不对应"); return(false); } if (vecLine[3] != "Type") { Debug.Log("HeroSkill.csv中字段[Type]位置不对应"); return(false); } if (vecLine[4] != "SkillMana") { Debug.Log("HeroSkill.csv中字段[SkillMana]位置不对应"); return(false); } if (vecLine[5] != "CD") { Debug.Log("HeroSkill.csv中字段[CD]位置不对应"); return(false); } if (vecLine[6] != "Tips") { Debug.Log("HeroSkill.csv中字段[Tips]位置不对应"); return(false); } if (vecLine[7] != "Lv") { Debug.Log("HeroSkill.csv中字段[Lv]位置不对应"); return(false); } if (vecLine[8] != "LvUp") { Debug.Log("HeroSkill.csv中字段[LvUp]位置不对应"); return(false); } if (vecLine[9] != "Attributes") { Debug.Log("HeroSkill.csv中字段[Attributes]位置不对应"); return(false); } if (vecLine[10] != "JieSuo") { Debug.Log("HeroSkill.csv中字段[JieSuo]位置不对应"); return(false); } if (vecLine[11] != "UnderAttack") { Debug.Log("HeroSkill.csv中字段[UnderAttack]位置不对应"); return(false); } if (vecLine[12] != "AblityID") { Debug.Log("HeroSkill.csv中字段[AblityID]位置不对应"); return(false); } if (vecLine[13] != "FriendNum") { Debug.Log("HeroSkill.csv中字段[FriendNum]位置不对应"); return(false); } if (vecLine[14] != "FriendBuffID") { Debug.Log("HeroSkill.csv中字段[FriendBuffID]位置不对应"); return(false); } if (vecLine[15] != "BuffID") { Debug.Log("HeroSkill.csv中字段[BuffID]位置不对应"); return(false); } if (vecLine[16] != "TrapID") { Debug.Log("HeroSkill.csv中字段[TrapID]位置不对应"); return(false); } if (vecLine[17] != "DamageRuduce") { Debug.Log("HeroSkill.csv中字段[DamageRuduce]位置不对应"); return(false); } if (vecLine[18] != "DamageNum") { Debug.Log("HeroSkill.csv中字段[DamageNum]位置不对应"); return(false); } if (vecLine[19] != "SkillDistance") { Debug.Log("HeroSkill.csv中字段[SkillDistance]位置不对应"); return(false); } if (vecLine[20] != "TargetOpt") { Debug.Log("HeroSkill.csv中字段[TargetOpt]位置不对应"); return(false); } if (vecLine[21] != "TargetNum") { Debug.Log("HeroSkill.csv中字段[TargetNum]位置不对应"); return(false); } if (vecLine[22] != "ParameterType") { Debug.Log("HeroSkill.csv中字段[ParameterType]位置不对应"); return(false); } if (vecLine[23] != "ParameterNum") { Debug.Log("HeroSkill.csv中字段[ParameterNum]位置不对应"); return(false); } if (vecLine[24] != "TargetGroup") { Debug.Log("HeroSkill.csv中字段[TargetGroup]位置不对应"); return(false); } if (vecLine[25] != "DamageAmend") { Debug.Log("HeroSkill.csv中字段[DamageAmend]位置不对应"); return(false); } while (true) { vecLine = GameAssist.readCsvLine(strContent, ref contentOffset); if ((int)vecLine.Count == 0) { break; } if ((int)vecLine.Count != (int)26) { return(false); } HeroSkillElement member = new HeroSkillElement(); member.SkillID = Convert.ToInt32(vecLine[0]); member.Name = vecLine[1]; member.SourceIcon = vecLine[2]; member.Type = Convert.ToInt32(vecLine[3]); member.SkillMana = vecLine[4]; member.CD = Convert.ToInt32(vecLine[5]); member.Tips = vecLine[6]; member.Lv = Convert.ToInt32(vecLine[7]); member.LvUp = Convert.ToInt32(vecLine[8]); member.Attributes = Convert.ToInt32(vecLine[9]); member.JieSuo = vecLine[10]; member.UnderAttack = Convert.ToInt32(vecLine[11]); member.AblityID = vecLine[12]; member.FriendNum = Convert.ToInt32(vecLine[13]); member.FriendBuffID = Convert.ToInt32(vecLine[14]); member.BuffID = Convert.ToInt32(vecLine[15]); member.TrapID = Convert.ToInt32(vecLine[16]); member.DamageRuduce = Convert.ToInt32(vecLine[17]); member.DamageNum = vecLine[18]; member.SkillDistance = Convert.ToInt32(vecLine[19]); member.TargetOpt = Convert.ToInt32(vecLine[20]); member.TargetNum = Convert.ToInt32(vecLine[21]); member.ParameterType = Convert.ToInt32(vecLine[22]); member.ParameterNum = vecLine[23]; member.TargetGroup = Convert.ToInt32(vecLine[24]); member.DamageAmend = vecLine[25]; member.IsValidate = true; m_vecAllElements.Add(member); m_mapElements[member.SkillID] = member; } return(true); }
private HeroSkillTable() { m_mapElements = new Dictionary <int, HeroSkillElement>(); m_emptyItem = new HeroSkillElement(); m_vecAllElements = new List <HeroSkillElement>(); }
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 != 26) { Debug.Log("HeroSkill.csv中列数量与生成的代码不匹配!"); return(false); } if (vecLine[0] != "SkillID") { Debug.Log("HeroSkill.csv中字段[SkillID]位置不对应"); return(false); } if (vecLine[1] != "Name") { Debug.Log("HeroSkill.csv中字段[Name]位置不对应"); return(false); } if (vecLine[2] != "SourceIcon") { Debug.Log("HeroSkill.csv中字段[SourceIcon]位置不对应"); return(false); } if (vecLine[3] != "Type") { Debug.Log("HeroSkill.csv中字段[Type]位置不对应"); return(false); } if (vecLine[4] != "SkillMana") { Debug.Log("HeroSkill.csv中字段[SkillMana]位置不对应"); return(false); } if (vecLine[5] != "CD") { Debug.Log("HeroSkill.csv中字段[CD]位置不对应"); return(false); } if (vecLine[6] != "Tips") { Debug.Log("HeroSkill.csv中字段[Tips]位置不对应"); return(false); } if (vecLine[7] != "Lv") { Debug.Log("HeroSkill.csv中字段[Lv]位置不对应"); return(false); } if (vecLine[8] != "LvUp") { Debug.Log("HeroSkill.csv中字段[LvUp]位置不对应"); return(false); } if (vecLine[9] != "Attributes") { Debug.Log("HeroSkill.csv中字段[Attributes]位置不对应"); return(false); } if (vecLine[10] != "JieSuo") { Debug.Log("HeroSkill.csv中字段[JieSuo]位置不对应"); return(false); } if (vecLine[11] != "UnderAttack") { Debug.Log("HeroSkill.csv中字段[UnderAttack]位置不对应"); return(false); } if (vecLine[12] != "AblityID") { Debug.Log("HeroSkill.csv中字段[AblityID]位置不对应"); return(false); } if (vecLine[13] != "FriendNum") { Debug.Log("HeroSkill.csv中字段[FriendNum]位置不对应"); return(false); } if (vecLine[14] != "FriendBuffID") { Debug.Log("HeroSkill.csv中字段[FriendBuffID]位置不对应"); return(false); } if (vecLine[15] != "BuffID") { Debug.Log("HeroSkill.csv中字段[BuffID]位置不对应"); return(false); } if (vecLine[16] != "TrapID") { Debug.Log("HeroSkill.csv中字段[TrapID]位置不对应"); return(false); } if (vecLine[17] != "DamageRuduce") { Debug.Log("HeroSkill.csv中字段[DamageRuduce]位置不对应"); return(false); } if (vecLine[18] != "DamageNum") { Debug.Log("HeroSkill.csv中字段[DamageNum]位置不对应"); return(false); } if (vecLine[19] != "SkillDistance") { Debug.Log("HeroSkill.csv中字段[SkillDistance]位置不对应"); return(false); } if (vecLine[20] != "TargetOpt") { Debug.Log("HeroSkill.csv中字段[TargetOpt]位置不对应"); return(false); } if (vecLine[21] != "TargetNum") { Debug.Log("HeroSkill.csv中字段[TargetNum]位置不对应"); return(false); } if (vecLine[22] != "ParameterType") { Debug.Log("HeroSkill.csv中字段[ParameterType]位置不对应"); return(false); } if (vecLine[23] != "ParameterNum") { Debug.Log("HeroSkill.csv中字段[ParameterNum]位置不对应"); return(false); } if (vecLine[24] != "TargetGroup") { Debug.Log("HeroSkill.csv中字段[TargetGroup]位置不对应"); return(false); } if (vecLine[25] != "DamageAmend") { Debug.Log("HeroSkill.csv中字段[DamageAmend]位置不对应"); return(false); } for (int i = 0; i < nRow; i++) { HeroSkillElement member = new HeroSkillElement(); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.SkillID); readPos += GameAssist.ReadString(binContent, readPos, out member.Name); readPos += GameAssist.ReadString(binContent, readPos, out member.SourceIcon); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Type); readPos += GameAssist.ReadString(binContent, readPos, out member.SkillMana); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.CD); readPos += GameAssist.ReadString(binContent, readPos, out member.Tips); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Lv); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.LvUp); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Attributes); readPos += GameAssist.ReadString(binContent, readPos, out member.JieSuo); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.UnderAttack); readPos += GameAssist.ReadString(binContent, readPos, out member.AblityID); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.FriendNum); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.FriendBuffID); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.BuffID); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.TrapID); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.DamageRuduce); readPos += GameAssist.ReadString(binContent, readPos, out member.DamageNum); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.SkillDistance); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.TargetOpt); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.TargetNum); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.ParameterType); readPos += GameAssist.ReadString(binContent, readPos, out member.ParameterNum); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.TargetGroup); readPos += GameAssist.ReadString(binContent, readPos, out member.DamageAmend); member.IsValidate = true; m_vecAllElements.Add(member); m_mapElements[member.SkillID] = member; } return(true); }