예제 #1
0
 void ShowOtherLines()
 {
     if (newScriptLines == null)
     {
         return;
     }
     if (newScriptLines.Count > 0)
     {
         EditorGUILayout.LabelField("总计" + newScriptLines.Count + "需要手动修改国际化的代码 记录如下:");
     }
     scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
     for (int i = 0; i < newScriptLines.Count; i++)
     {
         ScriptLineVo line = newScriptLines[i];
         if (!line.isCanAutoSet())
         {
             EditorGUILayout.BeginHorizontal();
             string error = (line.isStaticText || line.isCaseText || line.isConstText) ? " 不应该出现中文常量" : "";
             error += line.orgText.Count > 1 ? " 需要字符串拼接" : "";
             EditorGUILayout.LabelField(string.Format("{0} line:[{1}] Error:{2}", line.path, line.lineNum, error));
             if (GUILayout.Button("定位脚本", GUILayout.Width(100)))
             {
                 string path = Application.dataPath + line.path;
                 path = FindChineseTool.replaceWord(path, "/", "\\");
                 bool flag = FindChineseTool.OpenAsset(path, int.Parse(line.lineNum) - 1, _devPath);
                 if (!flag)
                 {
                     Debug.LogError("无法定位" + path);
                 }
             }
             EditorGUILayout.EndHorizontal();
         }
     }
     EditorGUILayout.EndScrollView();
 }
예제 #2
0
    bool MergeLines()
    {
        bool needSave = false;

        for (int i = 0; i < newScriptLines.Count; i++)
        {
            ScriptLineVo line = newScriptLines[i];
            if (line.isCanAutoSet())
            {//只处理一行只有一中文的情况
                ScriptLineVo oldLine = GetOldLine(line.orgText[0]);
                if (oldLine == null)
                {
                    _last_s_id++;
                    line.id = _last_s_id;
                    scriptMapLines.Add(line);
                    Debug.Log(string.Format("New file:{0} line:[{1}] \ntext:{2} \nscript:{3}", line.path, line.lineNum, line.orgText[0], line.stript));
                    needSave = true;
                }
                else
                {
                    if (oldLine.path.IndexOf(line.path) == -1)
                    {
                        oldLine.path    = oldLine.path + "|" + line.path;
                        oldLine.lineNum = oldLine.lineNum + "|" + line.lineNum;
                        Debug.Log(string.Format("Add file Path:{0} line:[{1}] \ntext:{2} \nscript:{3}", line.path, line.lineNum, line.orgText[0], line.stript));
                        needSave = true;
                    }
                }
            }
        }
        return(needSave);
    }