예제 #1
0
    /// <summary>
    /// 大陆和台湾词语对照
    /// </summary>
    /// <returns></returns>
    static Dictionary <string, string> getMap()
    {
        Dictionary <string, string> map = null;

        map = FileUitl.GetDictionaryFromFile("../GWEditor/Assets/_Prefab/zh_cn_zh_tw.txt");
        return(map);
    }
예제 #2
0
    public static void SaveSciptLines(string filePath, string[] fileContents)
    {
        StringBuilder sb = new StringBuilder();

        for (int i = 0; i < fileContents.Length; i++)
        {
            sb.Append(fileContents[i]);
            sb.Append("\r\n");
        }
        FileUitl.SaveUTF8TextFile(filePath, sb.ToString());
    }
예제 #3
0
    void SaveMapFile(string path, bool merge)
    {
        if (merge && !MergeLines())//合并
        {
            Debug.Log("没有变动无需保存");
            state = OptStatus.None;
            return;
        }
        StringBuilder sb = new StringBuilder();

        sb.Append("id"); sb.Append(",");
        sb.Append("path"); sb.Append(",");
        sb.Append("line"); sb.Append(",");
        sb.Append("zh_cn"); sb.Append(",");
        sb.Append("zh_tw"); sb.Append("\n");
        List <ScriptLineVo> lines = scriptMapLines;
        List <string>       texts = new List <string>();

        for (int i = 0; i < lines.Count; i++)
        {
            ScriptLineVo line = lines[i];
            sb.Append(line.id);
            sb.Append(",");
            sb.Append(line.path);
            sb.Append(",");
            sb.Append(line.lineNum);
            sb.Append(",");
            line.orgText[0] = FindChineseTool.replaceWord(line.orgText[0], ",", DOT);
            sb.Append(line.orgText[0]);
            sb.Append(",");
            if (line.zh_tw == null)
            {
                sb.Append(LangguageTools.To_zh_tc(line.orgText[0]));
            }
            else
            {
                sb.Append(line.zh_tw);
            }
            sb.Append("\n");
        }
        if (File.Exists(path))
        {
            File.Delete(path);
        }
        FileUitl.SaveUTF8TextFile(path, sb.ToString());
        Debug.Log("保存成功!");
        if (merge)
        {
            state = OptStatus.None;
        }
    }
예제 #4
0
    void reSaveOfficialMapFile(string path)
    {
        StringBuilder sb = new StringBuilder();

        sb.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); sb.Append("\n");
        sb.Append("<root>"); sb.Append("\n");
        sb.Append("<Scripts>"); sb.Append("\n");
        List <ScriptLineVo> lines = scriptMapLines;

        for (int i = 0; i < lines.Count; i++)
        {
            /*<Script id="" zh_cn="" zh_tw="">*/
            ScriptLineVo line = lines[i];
            sb.Append(string.Format("<Script id=\"{0}\" zh_cn={1} zh_tw={2} />", line.id, line.zh_cn, line.zh_tw));
            sb.Append("\n");
        }
        sb.Append("</Scripts>"); sb.Append("\n");
        sb.Append("</root>");
        if (File.Exists(path))
        {
            File.Delete(path);
        }
        FileUitl.SaveTextFile(path, sb.ToString());
    }