void Initialize() { if (undoManager == null) { // Instantiate Undo Manager undoManager = new HOEditorUndoManager(this, "GGLocalization - Окно редактирования корневого языка"); } if (keyTypes == null) { //Get the different key types List <string> enumNames = new List <string>(Enum.GetNames(typeof(LocalizedObjectType))); if (enumNames.Contains("INVALID")) { enumNames.Remove("INVALID"); } keyTypes = enumNames.ToArray(); } if (changedRootKeys == null) { changedRootKeys = new List <SerializableStringPair>(); } if (changedRootValues == null) { changedRootValues = new List <SerializableLocalizationObjectPair>(); } if (parsedRootValues == null) { parsedRootValues = new Dictionary <string, LocalizedObject>(); } if (parsedRootValues.Count < 1) { SetRootValues(LanguageHandlerEditor.LoadParsedLanguageFile(null, true)); } settingsList.Clear(); settingsList.Add("CONVERTLINEBREAK"); settingsList.Add("GENERAL"); settingsList.Add("SEARCH"); settingsAdaptor = new SettingsListAdaptor(settingsList, DrawSettingsItem, 20); settingsContextMenu = new SettingsMenuControl(); localizedObjectAdaptor = new LocalizedObjectListAdaptor(changedRootValues, changedRootKeys, DrawRootPair, 17); if (localizedObjectContextMenu != null) { localizedObjectContextMenu.ClearEvents(); } localizedObjectContextMenu = new LocalizedObjectMenuControl(OnKeyDeleted, OnKeyAdded); listColumns = new EditorColumns(0.1f); listColumns.AddColumn("Type", 0.1f); listColumns.AddColumn("Key", 0.45f); listColumns.AddColumn("Comment", 0.45f); listColumns.RecalculateColumnWidths(); if (EditorPrefs.HasKey(CollapseMultilineSaveKey)) { collapseMultilineFields = EditorPrefs.GetBool(CollapseMultilineSaveKey); } GUIUtility.keyboardControl = 0; }
public void Initialize(SmartCultureInfo thisCultureInfo, bool forceNewLanguage = false) { if (thisCultureInfo != null) { if (undoManager == null) { // Instantiate Undo Manager undoManager = new HOEditorUndoManager(this, "GGLocalization - Translate Language Window"); //Smart Localization - Translate Language Window } if (thisCultureInfo != null) { bool newLanguage = thisCultureInfo != this.currentCultureInfo ? true : false; if (Application.isPlaying || forceNewLanguage) { newLanguage = true; } this.currentCultureInfo = thisCultureInfo; if (loadedLanguageValues == null || loadedLanguageValues.Count < 1 || newLanguage) { InitializeLanguage(thisCultureInfo, LanguageHandlerEditor.LoadParsedLanguageFile(null, true), LanguageHandlerEditor.LoadParsedLanguageFile(thisCultureInfo.languageCode, false)); } } settingsList.Clear(); settingsList.Add("SETTINGS"); settingsList.Add("CONVERTLINEBREAK"); settingsList.Add("WATCHFILE"); settingsList.Add("AUTOTRANSLATE"); settingsList.Add("GENERAL"); #if UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3 if (EditorUserBuildSettings.activeBuildTarget != BuildTarget.WebPlayer && EditorUserBuildSettings.activeBuildTarget != BuildTarget.WebPlayerStreamed) #endif { settingsList.Add("SORT"); } settingsList.Add("SEARCH"); settingsAdaptor = new SettingsListAdaptor(settingsList, DrawSettingsItem, 20); settingsContextMenu = new SettingsMenuControl(); listColumns = new EditorColumns(0.02f, true); listColumns.AddColumn("Копия", 0.1f); // Copy listColumns.AddColumn("Перевод", 0.1f); // Translate listColumns.AddColumn("Ключ", 0.21f); // Key listColumns.AddColumn("Комментарий", 0.21f); // Comment listColumns.AddColumn("Переопределить", 0.07f); //Override listColumns.AddColumn("Значение", 0.25f); // Value listColumns.RecalculateColumnWidths(); if (EditorPrefs.HasKey(CollapseMultilineSaveKey)) { collapseMultilineFields = EditorPrefs.GetBool(CollapseMultilineSaveKey); } GUIUtility.keyboardControl = 0; SmartCultureInfoCollection allCultures = SmartCultureInfoEx.Deserialize(LocalizationWorkspace.CultureInfoCollectionFilePath()); SmartCultureInfoCollection availableCultures = LanguageHandlerEditor.CheckAndSaveAvailableLanguages(allCultures); otherAvailableLanguageCodes.Clear(); otherAvailableLanguageCodesArray = null; foreach (SmartCultureInfo otherCulture in availableCultures.cultureInfos) { if (otherCulture.languageCode != thisCultureInfo.languageCode) { otherAvailableLanguageCodes.Add(otherCulture.languageCode); } } if (otherAvailableLanguageCodes.Count > 0) { otherAvailableLanguageCodesArray = otherAvailableLanguageCodes.ToArray(); } } }