void OnGUI() { GUILayout.BeginVertical(); { // Scan project files and resources GUILayout.BeginVertical(EditorStyles.helpBox); { GUILayout.Label("Scan Project Files", EditorStyles.boldLabel); GUILayout.Label("Press the <i>Scan Project Files</i> button to begin scanning your project for files & resources that were created with a previous version of TextMesh Pro.", TMP_UIStyleManager.label); GUILayout.Space(10f); GUILayout.Label("Project folder to be scanned. Example \"Assets/TextMesh Pro\""); m_ProjectFolderToScan = EditorGUILayout.TextField("Folder Path: Assets/", m_ProjectFolderToScan); GUILayout.Space(5f); GUI.enabled = m_IsAlreadyScanningProject == false ? true : false; if (GUILayout.Button("Scan Project Files")) { m_CancelScanProcess = false; // Make sure Asset Serialization mode is set to ForceText and Version Control mode to Visible Meta Files. if (CheckProjectSerializationAndSourceControlModes() == true) { m_ProjectPath = Path.GetFullPath("Assets/.."); TMP_EditorCoroutine.StartCoroutine(ScanProjectFiles()); } else { EditorUtility.DisplayDialog("Project Settings Change Required", "In menu options \"Edit - Project Settings - Editor\", please change Asset Serialization Mode to ForceText and Source Control Mode to Visible Meta Files.", "OK", string.Empty); } } GUI.enabled = true; // Display progress bar Rect rect = GUILayoutUtility.GetRect(0f, 20f, GUILayout.ExpandWidth(true)); EditorGUI.ProgressBar(rect, m_ProgressPercentage, "Scan Progress (" + m_ScanningCurrentFileIndex + "/" + m_ScanningTotalFiles + ")"); // Display cancel button and name of file currently being scanned. if (m_IsAlreadyScanningProject) { Rect cancelRect = new Rect(rect.width - 20, rect.y + 2, 20, 16); if (GUI.Button(cancelRect, "X")) { m_CancelScanProcess = true; } GUILayout.Label(k_ProjectScanLabelPrefix + m_ScanningCurrentFileName, TMP_UIStyleManager.label); } else { GUILayout.Label(string.Empty); } GUILayout.Space(5); // Creation Feedback GUILayout.BeginVertical(TMP_UIStyleManager.textAreaBoxWindow, GUILayout.ExpandHeight(true)); { m_ProjectScanResultScrollPosition = EditorGUILayout.BeginScrollView(m_ProjectScanResultScrollPosition, GUILayout.ExpandHeight(true)); GUILayout.Label(m_ProjectScanResults, TMP_UIStyleManager.label); EditorGUILayout.EndScrollView(); } GUILayout.EndVertical(); GUILayout.Space(5f); } GUILayout.EndVertical(); // Scan project files and resources GUILayout.BeginVertical(EditorStyles.helpBox); { GUILayout.Label("Save Modified Project Files", EditorStyles.boldLabel); GUILayout.Label("Pressing the <i>Save Modified Project Files</i> button will update the files in the <i>Project Scan Results</i> listed above. <color=#FFFF80>Please make sure that you have created a backup of your project first</color> as these file modifications are permanent and cannot be undone.", TMP_UIStyleManager.label); GUILayout.Space(5f); GUI.enabled = m_IsAlreadyScanningProject == false && m_ModifiedAssetList.Count > 0 ? true : false; if (GUILayout.Button("Save Modified Project Files")) { UpdateProjectFiles(); } GUILayout.Space(10f); } GUILayout.EndVertical(); } GUILayout.EndVertical(); GUILayout.Space(5f); }
public static void WriteToFile(string result) { TMP_EditorCoroutine.StartCoroutine(Write(result)); }