Пример #1
0
        /// <summary>
        /// Initializes the Language
        /// </summary>
        public void InitializeLanguage(SmartCultureInfo info, Dictionary <string, LocalizedObject> rootValues, Dictionary <string, LocalizedObject> languageValues)
        {
            this.rootValues = rootValues;
            this.loadedLanguageValues.Clear();
            this.loadedLanguageValues = LanguageHandlerEditor.CreateSerializableLocalizationList(languageValues);
            //Load assets
            LanguageHandlerEditor.LoadAllAssets(this.loadedLanguageValues);

            this.thisLanguage = (currentCultureInfo.englishName + " - " + currentCultureInfo.languageCode);
            rootFileChanged   = false;

            SortLanguageValues(sortType);
            localizedObjectAdaptor     = new LocalizedObjectListAdaptor(this.loadedLanguageValues, null, DrawLanguageValue, 17, true);
            localizedObjectContextMenu = new LocalizedObjectMenuControl();

            localizedObjectAdaptor.collapseMultiline = collapseMultilineFields;
        }
Пример #2
0
        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;
        }