FieldType GetTypeInfo(string word, FileInfo info) { if (word == "int32" || word == "int") { return(FieldType.FT_Int); } else if (word == "float") { return(FieldType.FT_Float); } else if (word == "string") { return(FieldType.FT_String); } else if (word == "double") { return(FieldType.FT_Float); } else { enumInfo enuinfo = null; //是枚举类型,改为int if (info.m_allEnums.TryGetValue(word, out enuinfo)) { return(FieldType.FT_Int); } } return(FieldType.FT_Class); }
void GetAllEnums(string text, FileInfo info) { int start = 0; //第一遍遍历先获得所有的message类型 while (start < text.Length) { //逐行解析 string lineNew = EditorUtils.readLine(text, ref start); List <string> allWords = EditorUtils.splitLine(lineNew); if (allWords.Count > 0) { string keyWord = allWords[0]; if (keyWord == "enum") //枚举 { enumInfo enuminfo = new enumInfo(); enuminfo.enumName = allWords[1]; info.m_allEnums.Add(enuminfo.enumName, enuminfo); } } } }