private void ReadTextConfigData() { TextConfigData textConfigData = new TextConfigData(); textConfigData.SetDictionaryData(default(TextConfigData.DictionaryData), "--- EMPTY ---"); using (List <string> .Enumerator enumerator = this.GetFilePaths("Assets/StreamingAssets/Vuforia/WordLists/", "vwl").GetEnumerator()) { while (enumerator.MoveNext()) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(enumerator.Current); string binaryFile = "Vuforia/WordLists/" + fileNameWithoutExtension + ".vwl"; textConfigData.SetDictionaryData(new TextConfigData.DictionaryData { BinaryFile = binaryFile }, fileNameWithoutExtension); } } using (List <string> .Enumerator enumerator = this.GetFilePaths("Assets/StreamingAssets/QCAR/", "vwl").GetEnumerator()) { while (enumerator.MoveNext()) { string fileNameWithoutExtension2 = Path.GetFileNameWithoutExtension(enumerator.Current); string binaryFile2 = "QCAR/" + fileNameWithoutExtension2 + ".vwl"; textConfigData.SetDictionaryData(new TextConfigData.DictionaryData { BinaryFile = binaryFile2 }, fileNameWithoutExtension2); } } textConfigData.SetWordListData(default(TextConfigData.WordListData), "--- EMPTY ---"); using (List <string> .Enumerator enumerator = this.GetFilePaths("Assets/StreamingAssets/Vuforia/WordLists/", "lst").GetEnumerator()) { while (enumerator.MoveNext()) { string fileNameWithoutExtension3 = Path.GetFileNameWithoutExtension(enumerator.Current); string textFile = "Vuforia/WordLists/" + fileNameWithoutExtension3 + ".lst"; textConfigData.SetWordListData(new TextConfigData.WordListData { TextFile = textFile }, fileNameWithoutExtension3); } } using (List <string> .Enumerator enumerator = this.GetFilePaths("Assets/StreamingAssets/QCAR/", "lst").GetEnumerator()) { while (enumerator.MoveNext()) { string fileNameWithoutExtension4 = Path.GetFileNameWithoutExtension(enumerator.Current); string textFile2 = "QCAR/" + fileNameWithoutExtension4 + ".lst"; textConfigData.SetWordListData(new TextConfigData.WordListData { TextFile = textFile2 }, fileNameWithoutExtension4); } } this.mTextConfigData = textConfigData; }
private ConfigDataManager() { this.mConfigData = new Dictionary <string, ConfigData>(); this.mTextConfigData = new TextConfigData(); }
public override void OnInspectorGUI() { VuforiaUtilities.DisableGuiForPrefab(base.target); base.DrawDefaultInspector(); using (base.serializedObject.Edit()) { TextConfigData textConfigData = ConfigDataManager.Instance.GetTextConfigData(); if (textConfigData.NumDictionaries > 1) { EditorGUILayout.HelpBox("The list of words the TextTracker can detect and track.\nThe word list is loaded from a binary file and can be extended by a list of custom words.", MessageType.Info); string[] array = new string[textConfigData.NumDictionaries]; string[] array2 = new string[textConfigData.NumDictionaries]; textConfigData.CopyDictionaryNamesAndFiles(array, array2, 0); int num = VuforiaUtilities.GetIndexFromString(this.mWordListFile.stringValue, array2); if (num < 0) { num = 0; } int num2 = EditorGUILayout.Popup("Word List", num, array, new GUILayoutOption[0]); this.mWordListFile.stringValue = array2[num2]; if (num2 == 0) { GUI.enabled = false; } } else { if (GUILayout.Button("No word list available. \nPlease copy it from the TextRecognition sample app. \nPress here to go to the download page for sample apps!", new GUILayoutOption[0])) { SceneManager.Instance.GoToSampleAppPage(); } GUI.enabled = false; } int expr_D8 = textConfigData.NumWordLists; string[] array3 = new string[expr_D8]; string[] array4 = new string[expr_D8]; textConfigData.CopyWordListNamesAndFiles(array3, array4, 0); int num3 = VuforiaUtilities.GetIndexFromString(this.mCustomWordListFile.stringValue, array4); if (num3 < 0) { num3 = 0; } int num4 = EditorGUILayout.Popup("Additional Word File", num3, array3, new GUILayoutOption[0]); if (num4 != num3) { if (num4 != 0) { TextRecoEditor.TestValidityOfWordListFile(array4[num4]); } this.mCustomWordListFile.stringValue = array4[num4]; } EditorGUILayout.LabelField("Additional Words:", new GUILayoutOption[0]); EditorGUILayout.HelpBox("Write one word per line. Open compound words can be specified using whitespaces.", MessageType.None); this.mAdditionalCustomWords.stringValue = EditorGUILayout.TextArea(this.mAdditionalCustomWords.stringValue, new GUILayoutOption[0]); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.HelpBox("The filter list allows to specify subset of words that will be detected and tracked.", MessageType.Info); EditorGUILayout.PropertyField(this.mFilterMode, new GUIContent("Filter Mode"), new GUILayoutOption[0]); if (this.mFilterMode.enumValueIndex != 0) { int num5 = VuforiaUtilities.GetIndexFromString(this.mFilterListFile.stringValue, array4); if (num5 < 0) { num5 = 0; } int num6 = EditorGUILayout.Popup("Filter List File", num5, array3, new GUILayoutOption[0]); if (num6 != num5) { if (num6 != 0) { TextRecoEditor.TestValidityOfWordListFile(array4[num6]); } this.mFilterListFile.stringValue = array4[num6]; } EditorGUILayout.LabelField("Additional Filter Words:", new GUILayoutOption[0]); EditorGUILayout.HelpBox("Write one word per line. Open compound words can be specified using whitespaces.", MessageType.None); this.mAdditionalFilterWords.stringValue = EditorGUILayout.TextArea(this.mAdditionalFilterWords.stringValue, new GUILayoutOption[0]); } EditorGUILayout.HelpBox("It is possible to use Word Prefabs to define augmentations for detected words. Each Word Prefab can be instantiated up to a maximum number.", MessageType.Info); if (EditorGUILayout.Toggle("Use Word Prefabs", this.mWordPrefabCreationMode.enumValueIndex == 1, new GUILayoutOption[0])) { this.mWordPrefabCreationMode.enumValueIndex = 1; EditorGUILayout.PropertyField(this.mMaximumWordInstances, new GUIContent("Max Simultaneous Words"), new GUILayoutOption[0]); } else { this.mWordPrefabCreationMode.enumValueIndex = 0; } } GUI.enabled = true; }