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 != 17) { Debug.Log("BaseAI.csv中列数量与生成的代码不匹配!"); return(false); } if (vecLine[0] != "baseAiId") { Debug.Log("BaseAI.csv中字段[baseAiId]位置不对应"); return(false); } if (vecLine[1] != "Comment") { Debug.Log("BaseAI.csv中字段[Comment]位置不对应"); return(false); } if (vecLine[2] != "canMove") { Debug.Log("BaseAI.csv中字段[canMove]位置不对应"); return(false); } if (vecLine[3] != "attackType") { Debug.Log("BaseAI.csv中字段[attackType]位置不对应"); return(false); } if (vecLine[4] != "aiCd") { Debug.Log("BaseAI.csv中字段[aiCd]位置不对应"); return(false); } if (vecLine[5] != "noAttack") { Debug.Log("BaseAI.csv中字段[noAttack]位置不对应"); return(false); } if (vecLine[6] != "patrolRate") { Debug.Log("BaseAI.csv中字段[patrolRate]位置不对应"); return(false); } if (vecLine[7] != "followPortal") { Debug.Log("BaseAI.csv中字段[followPortal]位置不对应"); return(false); } if (vecLine[8] != "counterAttack") { Debug.Log("BaseAI.csv中字段[counterAttack]位置不对应"); return(false); } if (vecLine[9] != "SkillPriority") { Debug.Log("BaseAI.csv中字段[SkillPriority]位置不对应"); return(false); } if (vecLine[10] != "GuardType") { Debug.Log("BaseAI.csv中字段[GuardType]位置不对应"); return(false); } if (vecLine[11] != "GuardScope") { Debug.Log("BaseAI.csv中字段[GuardScope]位置不对应"); return(false); } if (vecLine[12] != "PatrolSpeed") { Debug.Log("BaseAI.csv中字段[PatrolSpeed]位置不对应"); return(false); } if (vecLine[13] != "RaidSpeed") { Debug.Log("BaseAI.csv中字段[RaidSpeed]位置不对应"); return(false); } if (vecLine[14] != "BloodReturn") { Debug.Log("BaseAI.csv中字段[BloodReturn]位置不对应"); return(false); } if (vecLine[15] != "InterveneSkill") { Debug.Log("BaseAI.csv中字段[InterveneSkill]位置不对应"); return(false); } if (vecLine[16] != "ExpandAI") { Debug.Log("BaseAI.csv中字段[ExpandAI]位置不对应"); return(false); } while (true) { vecLine = GameAssist.readCsvLine(strContent, ref contentOffset); if ((int)vecLine.Count == 0) { break; } if ((int)vecLine.Count != (int)17) { return(false); } BaseAIElement member = new BaseAIElement(); member.baseAiId = Convert.ToInt32(vecLine[0]); member.Comment = vecLine[1]; member.canMove = Convert.ToInt32(vecLine[2]); member.attackType = Convert.ToInt32(vecLine[3]); member.aiCd = Convert.ToInt32(vecLine[4]); member.noAttack = Convert.ToInt32(vecLine[5]); member.patrolRate = Convert.ToInt32(vecLine[6]); member.followPortal = Convert.ToInt32(vecLine[7]); member.counterAttack = Convert.ToInt32(vecLine[8]); member.SkillPriority = Convert.ToInt32(vecLine[9]); member.GuardType = Convert.ToInt32(vecLine[10]); member.GuardScope = Convert.ToInt32(vecLine[11]); member.PatrolSpeed = Convert.ToInt32(vecLine[12]); member.RaidSpeed = Convert.ToInt32(vecLine[13]); member.BloodReturn = Convert.ToInt32(vecLine[14]); member.InterveneSkill = Convert.ToInt32(vecLine[15]); member.ExpandAI = Convert.ToInt32(vecLine[16]); member.IsValidate = true; m_vecAllElements.Add(member); m_mapElements[member.baseAiId] = member; } return(true); }
private BaseAITable() { m_mapElements = new Dictionary <int, BaseAIElement>(); m_emptyItem = new BaseAIElement(); m_vecAllElements = new List <BaseAIElement>(); }
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 != 17) { Debug.Log("BaseAI.csv中列数量与生成的代码不匹配!"); return(false); } if (vecLine[0] != "baseAiId") { Debug.Log("BaseAI.csv中字段[baseAiId]位置不对应"); return(false); } if (vecLine[1] != "Comment") { Debug.Log("BaseAI.csv中字段[Comment]位置不对应"); return(false); } if (vecLine[2] != "canMove") { Debug.Log("BaseAI.csv中字段[canMove]位置不对应"); return(false); } if (vecLine[3] != "attackType") { Debug.Log("BaseAI.csv中字段[attackType]位置不对应"); return(false); } if (vecLine[4] != "aiCd") { Debug.Log("BaseAI.csv中字段[aiCd]位置不对应"); return(false); } if (vecLine[5] != "noAttack") { Debug.Log("BaseAI.csv中字段[noAttack]位置不对应"); return(false); } if (vecLine[6] != "patrolRate") { Debug.Log("BaseAI.csv中字段[patrolRate]位置不对应"); return(false); } if (vecLine[7] != "followPortal") { Debug.Log("BaseAI.csv中字段[followPortal]位置不对应"); return(false); } if (vecLine[8] != "counterAttack") { Debug.Log("BaseAI.csv中字段[counterAttack]位置不对应"); return(false); } if (vecLine[9] != "SkillPriority") { Debug.Log("BaseAI.csv中字段[SkillPriority]位置不对应"); return(false); } if (vecLine[10] != "GuardType") { Debug.Log("BaseAI.csv中字段[GuardType]位置不对应"); return(false); } if (vecLine[11] != "GuardScope") { Debug.Log("BaseAI.csv中字段[GuardScope]位置不对应"); return(false); } if (vecLine[12] != "PatrolSpeed") { Debug.Log("BaseAI.csv中字段[PatrolSpeed]位置不对应"); return(false); } if (vecLine[13] != "RaidSpeed") { Debug.Log("BaseAI.csv中字段[RaidSpeed]位置不对应"); return(false); } if (vecLine[14] != "BloodReturn") { Debug.Log("BaseAI.csv中字段[BloodReturn]位置不对应"); return(false); } if (vecLine[15] != "InterveneSkill") { Debug.Log("BaseAI.csv中字段[InterveneSkill]位置不对应"); return(false); } if (vecLine[16] != "ExpandAI") { Debug.Log("BaseAI.csv中字段[ExpandAI]位置不对应"); return(false); } for (int i = 0; i < nRow; i++) { BaseAIElement member = new BaseAIElement(); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.baseAiId); readPos += GameAssist.ReadString(binContent, readPos, out member.Comment); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.canMove); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.attackType); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.aiCd); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.noAttack); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.patrolRate); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.followPortal); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.counterAttack); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.SkillPriority); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.GuardType); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.GuardScope); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.PatrolSpeed); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.RaidSpeed); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.BloodReturn); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.InterveneSkill); readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.ExpandAI); member.IsValidate = true; m_vecAllElements.Add(member); m_mapElements[member.baseAiId] = member; } return(true); }