private void OnUpgradeButtonCB() { System.Action <string, int, int> updateProgress = (text, now, max) => { EditorUtility.DisplayProgressBar("Upgrade...", text, (float)now / (float)max); }; List <string> jpTextList = new List <string>(); for (int i = 0; i < m_FilteredPathList.Count; i++) { string assetPath = m_FilteredPathList[i]; LocalizationTextEditor.UpgradeToLocalizationText(assetPath, m_TextCompGUID, m_TextCompFileID, m_LocalizationCompGUID, m_LocalizationCompFileID, jpTextList); updateProgress(assetPath, i + 1, m_FilteredPathList.Count); } EditorUtility.ClearProgressBar(); string outputFilePath = Path.Combine(Application.dataPath.Substring(0, Application.dataPath.LastIndexOf('/')), "output.txt"); jpTextList = jpTextList.Distinct().ToList <string>(); System.Text.StringBuilder sb = new System.Text.StringBuilder(); foreach (var str in jpTextList) { sb.AppendLine(str); } System.IO.File.AppendAllText(outputFilePath, sb.ToString()); }
private void OnSetKeyButtonCB() { System.Action <string, int, int> updateProgress = (text, now, max) => { EditorUtility.DisplayProgressBar("Upgrade...", text, (float)now / (float)max); }; int length = m_FilteredPathList.Count; for (int i = 0; i < length; i++) { string assetPath = m_FilteredPathList[i]; LocalizationTextEditor.SetLocalizationKey(assetPath, m_LocalizationCompGUID, m_LocalizationCompFileID); updateProgress(assetPath, i + 1, length); } EditorUtility.ClearProgressBar(); }