public static void DrawLocaleSelection(GUIContent label, string[] locales, int selected) { EditorGUI.BeginChangeCheck(); selected = EditorGUILayout.Popup(label.text, selected, locales); if (EditorGUI.EndChangeCheck()) { ShaderEditor.Active.PropertyDictionary[ShaderEditor.PROPERTY_NAME_LOCALE].MaterialProperty.floatValue = selected; ShaderEditor.ReloadActive(); } }
private static void LocaleDropdown() { EditorGUI.BeginChangeCheck(); EditorGUILayout.BeginHorizontal(); GUILayout.Label(new GUIContent(Locale.editor.Get("locale"), Locale.editor.Get("locale_tooltip")), GUILayout.ExpandWidth(false)); Locale.editor.selected_locale_index = EditorGUILayout.Popup(Locale.editor.selected_locale_index, Locale.editor.available_locales, GUILayout.ExpandWidth(false)); if (Locale.editor.Get("translator").Length > 0) { GUILayout.Label(Locale.editor.Get("translation") + ": " + Locale.editor.Get("translator"), GUILayout.ExpandWidth(false)); } EditorGUILayout.EndHorizontal(); if (EditorGUI.EndChangeCheck()) { Config.Singleton.locale = Locale.editor.available_locales[Locale.editor.selected_locale_index]; Config.Singleton.Save(); ShaderEditor.ReloadActive(); } }