public virtual TextFile.Token[] GetRSCTokens(int id) { if (localizedStringDebug && !string.IsNullOrEmpty(TextManager.Instance.RuntimeRSCStrings)) { Debug.LogFormat("Trying localized string using RSC collection '{0}'", TextManager.Instance.RuntimeRSCStrings); } // First attempt to get string from localization string localizedString; if (GetLocalizedString(TextManager.Instance.RuntimeRSCStrings, id.ToString(), out localizedString)) { return(DaggerfallStringTableImporter.ConvertStringToRSCTokens(localizedString)); } if (localizedStringDebug) { Debug.Log("Failed to get localized string. Fallback to TEXT.RSC"); } if (!rscFile.IsLoaded) { OpenTextRSCFile(); } byte[] buffer = rscFile.GetBytesById(id); if (buffer == null) { return(null); } return(TextFile.ReadTokens(ref buffer, 0, TextFile.Formatting.EndOfRecord)); }
void DisplayGUI() { DrawDefaultInspector(); EditorGUILayout.Space(); EditorGUILayout.LabelField("Copy String Tables", EditorStyles.boldLabel); GUILayoutHelper.Indent(() => { targetInternalStrings = EditorGUILayout.TextField("Internal Strings > ", targetInternalStrings); targetRSCStrings = EditorGUILayout.TextField("RSC Strings > ", targetRSCStrings); }); overwriteTargetStringTables = EditorGUILayout.Toggle(new GUIContent("Overwrite Target String Tables?", "When enabled will copy over existing strings in target string tables."), overwriteTargetStringTables); if (overwriteTargetStringTables) { EditorGUILayout.HelpBox("Warning: Existing keys in the target string tables will be replaced by source.", MessageType.Warning); } else { EditorGUILayout.HelpBox("Copy will create all missing keys in target string tables from source. Existing keys will not be overwritten.", MessageType.Info); } EditorGUILayout.Space(); if (GUILayout.Button("Copy All")) { DaggerfallStringTableImporter.CopyInternalStringTable(targetInternalStrings, overwriteTargetStringTables); //DaggerfallStringTableImporter.ImportTextRSCToStringTables(rscCollectionName.stringValue); } }
void DisplayGUI() { var runtimeInternalStrings = Prop("runtimeInternalStrings"); var runtimeRSCStrings = Prop("runtimeRSCStrings"); var runtimeBOKStrings = Prop("runtimeBOKStrings"); var runtimeFlatStrings = Prop("runtimeFlatStrings"); var tableCopyOverwriteTargetStringTables = Prop("tableCopyOverwriteTargetStringTables"); var tableCopyTargetInternalStrings = Prop("tableCopyTargetInternalStrings"); var tableCopyTargetRSCStrings = Prop("tableCopyTargetRSCStrings"); var tableCopyTargetBOKStrings = Prop("tableCopyTargetBOKStrings"); var tableCopyTargetFlatStrings = Prop("tableCopyTargetFlatStrings"); EditorGUILayout.Space(); EditorGUILayout.LabelField("Live String Tables", EditorStyles.boldLabel); GUILayoutHelper.Indent(() => { runtimeInternalStrings.stringValue = EditorGUILayout.TextField("Internal Strings", runtimeInternalStrings.stringValue); runtimeRSCStrings.stringValue = EditorGUILayout.TextField("RSC Strings", runtimeRSCStrings.stringValue); runtimeBOKStrings.stringValue = EditorGUILayout.TextField("BOK Strings", runtimeBOKStrings.stringValue); runtimeFlatStrings.stringValue = EditorGUILayout.TextField("FLATS.CFG Strings", runtimeFlatStrings.stringValue); }); EditorGUILayout.Space(); EditorGUILayout.LabelField("Copy String Tables", EditorStyles.boldLabel); GUILayoutHelper.Indent(() => { tableCopyTargetInternalStrings.stringValue = EditorGUILayout.TextField("Internal Strings > ", tableCopyTargetInternalStrings.stringValue); tableCopyTargetRSCStrings.stringValue = EditorGUILayout.TextField("RSC Strings > ", tableCopyTargetRSCStrings.stringValue); tableCopyTargetBOKStrings.stringValue = EditorGUILayout.TextField("BOK Strings > ", tableCopyTargetBOKStrings.stringValue); tableCopyTargetFlatStrings.stringValue = EditorGUILayout.TextField("FLATS.CFG Strings > ", tableCopyTargetFlatStrings.stringValue); tableCopyOverwriteTargetStringTables.boolValue = EditorGUILayout.Toggle(new GUIContent("Overwrite String Tables?", "When enabled will copy over existing strings in target string tables."), tableCopyOverwriteTargetStringTables.boolValue); }); if (tableCopyOverwriteTargetStringTables.boolValue) { EditorGUILayout.HelpBox("Warning: Existing keys in the target string tables will be replaced by source.", MessageType.Warning); } else { EditorGUILayout.HelpBox("Copy will create all missing keys in target string tables from source. Existing keys will not be overwritten.", MessageType.Info); } EditorGUILayout.Space(); if (GUILayout.Button("Copy All")) { DaggerfallStringTableImporter.CopyInternalStringTable(tableCopyTargetInternalStrings.stringValue, tableCopyOverwriteTargetStringTables.boolValue); DaggerfallStringTableImporter.CopyTextRSCToStringTable(tableCopyTargetRSCStrings.stringValue, tableCopyOverwriteTargetStringTables.boolValue); //DaggerfallStringTableImporter.CopyTextBOKToStringTable(tableCopyTargetBOKStrings.stringValue, tableCopyOverwriteTargetStringTables.boolValue); DaggerfallStringTableImporter.CopyTextFlatsToStringTable(tableCopyTargetFlatStrings.stringValue, tableCopyOverwriteTargetStringTables.boolValue); } }
public virtual TextFile.Token[] GetRSCTokens(string id) { if (localizedStringDebug && !string.IsNullOrEmpty(TextManager.Instance.RuntimeRSCStrings)) { Debug.LogFormat("Trying localized string using RSC collection '{0}'", TextManager.Instance.RuntimeRSCStrings); } // Attempt to get string from localization, no fallback for string IDs string localizedString; if (GetLocalizedString(TextManager.Instance.RuntimeRSCStrings, id, out localizedString)) { return(DaggerfallStringTableImporter.ConvertStringToRSCTokens(localizedString)); } return(null); }
void DisplayGUI() { DrawDefaultInspector(); EditorGUILayout.Space(); EditorGUILayout.LabelField(new GUIContent("String Importer", "Import classic text data into named String Table Collections.\nNOTE: You must create collections manually.\nWARNING: Existing collections will be cleared."), EditorStyles.boldLabel); GUILayoutHelper.Horizontal(() => { var rscCollectionName = Prop("textRSCCollection"); if (GUILayout.Button("Import All")) { DaggerfallStringTableImporter.ImportTextRSCToStringTables(rscCollectionName.stringValue); } if (GUILayout.Button("Clear All")) { DaggerfallStringTableImporter.ClearStringTables(rscCollectionName.stringValue); } }); }