Exemple #1
0
        public static CreateLanguageWindow ShowWindow(SmartLocalizationWindow parentWindow)
        {
            CreateLanguageWindow thisWindow = (CreateLanguageWindow)EditorWindow.GetWindow <CreateLanguageWindow>("New Language");

            thisWindow.parentWindow = parentWindow;
            return(thisWindow);
        }
        /// <summary> Shows the translate window window. </summary>
        public static TranslateLanguageWindow ShowWindow(SmartCultureInfo info, SmartLocalizationWindow smartLocWindow)
        {
            TranslateLanguageWindow translateLanguageWindow = (TranslateLanguageWindow)EditorWindow.GetWindow <TranslateLanguageWindow>("Translate Language", true, typeof(SmartLocalizationWindow));

            translateLanguageWindow.Initialize(info);
            return(translateLanguageWindow);
        }
        public static BulkUpdateWindow ShowWindow(BulkUpdateMethod updateMethod, SmartLocalizationWindow parentWindow)
        {
            BulkUpdateWindow thisWindow = (BulkUpdateWindow)EditorWindow.GetWindow <BulkUpdateWindow>("Update Languages");

            thisWindow.Initialize(updateMethod, parentWindow);

            return(thisWindow);
        }
Exemple #4
0
        public static LanguageUpdateWindow ShowWindow(SmartCultureInfo info, SmartLocalizationWindow parentWindow)
        {
            LanguageUpdateWindow languageUpdateWindow = (LanguageUpdateWindow)EditorWindow.GetWindow <LanguageUpdateWindow>("Update");

            languageUpdateWindow.Initialize(info, parentWindow);

            return(languageUpdateWindow);
        }
Exemple #5
0
        void Initialize(SmartCultureInfo chosenCulture, SmartLocalizationWindow parentWindow)
        {
            this.chosenCulture = chosenCulture;
            this.parentWindow  = parentWindow;

            if (chosenFileFormat >= availableFileFormats.Length)
            {
                chosenFileFormat = 0;
            }
        }
        /// <summary>
        /// Call this from OnInspectorGUI in your own editor class. It will create buttons and a selectable popup with all the keys available.
        /// </summary>
        /// <param name="currentKey">The currently chosen key</param>
        /// <param name="sort">If the select key GUI should filter keys with a certain type</param>
        /// <param name="sortType">If sort is true, this is the type of keys that will be shown.</param>
        /// <returns>The currently chosen key</returns>
        public static string SelectKeyGUI(string currentKey, bool sort = false, LocalizedObjectType sortType = LocalizedObjectType.INVALID)
        {
            if (!ShouldShowKeySelector())
            {
                return(currentKey);
            }

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("Smart Localization", EditorStyles.boldLabel);
            if (GUILayout.Button("Open", GUILayout.Width(50)))
            {
                SmartLocalizationWindow.ShowWindow();
            }
            EditorGUILayout.EndHorizontal();

            if (autoRefresh || parsedRootValues.Count == 0 || sortType != loadedObjectType)
            {
                RefreshList(sort, sortType);
            }

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("Sort Mode: ", EditorStyles.miniLabel, GUILayout.Width(55));
            if (sort)
            {
                GUILayout.Label(sortType.ToString() + " only.", EditorStyles.miniLabel);
            }
            else
            {
                GUILayout.Label("Showing ALL types", EditorStyles.miniLabel);
            }
            EditorGUILayout.EndHorizontal();


            int index = parsedRootValues.IndexOf(currentKey);

            index = Mathf.Max(0, index);
            int newIndex = index;

            newIndex = EditorGUILayout.Popup(index, parsedRootValues.ToArray());

            if (newIndex != index)
            {
                currentKey = parsedRootValues[newIndex];
            }

            if (!autoRefresh && GUILayout.Button("Refresh list", GUILayout.Width(70)))
            {
                RefreshList(sort, sortType);
            }


            return(currentKey);
        }
 public void Initialize(BulkUpdateMethod updateMethod, SmartLocalizationWindow parentWindow)
 {
     this.updateMedhod = updateMethod;
     this.parentWindow = parentWindow;
 }