public static void Open(string key) { TextLocaliserGUIEditorEditWindow window = new TextLocaliserGUIEditorEditWindow(); window.titleContent = new GUIContent("Edit Value"); window.ShowUtility(); window.key = key; window.localisationValue = TextLocalisation.GetLocalisedValue(key); }
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { if (property.isExpanded) { var value = TextLocalisation.GetLocalisedValue(property.FindPropertyRelative("key").stringValue); return(height); } return(21); }
void Set() { _textBox = GetComponent <TextMeshProUGUI>(); string val = TextLocalisation.GetLocalisedValue(key); _textBox.text = TextLocalisation.GetLocalisedValue(key); if (gameObject.GetComponent <UITextAnimator>()) { gameObject.GetComponent <UITextAnimator>().Set(val); } }
public static string TextField(string label, string key) { EditorGUILayout.BeginVertical(); EditorGUILayout.BeginHorizontal(); key = EditorGUILayout.TextField(label, key); DrawSearchButton(); DrawAddButton(key); DrawEditButton(key); EditorGUILayout.EndHorizontal(); if (CheckIsValid(key)) { GUI.skin.textField.wordWrap = true; EditorGUILayout.LabelField(" ", TextLocalisation.GetLocalisedValue(key), EditorStyles.wordWrappedLabel, GUILayout.Height(50)); GUI.skin.textField.wordWrap = false; } EditorGUILayout.EndVertical(); return(key); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { EditorGUI.BeginProperty(position, label, property); position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Keyboard), label); position.height = 18; Rect foldoutRect = new Rect(position); foldoutRect.width = 25; property.isExpanded = EditorGUI.Foldout(foldoutRect, property.isExpanded, "", true); position.x += 35; position.width -= 75; TextLocaliserEditorGUI.TextPropertyField(position, property); if (property.isExpanded) { var value = TextLocalisation.GetLocalisedValue(property.FindPropertyRelative("key").stringValue); GUIStyle style = new GUIStyle(EditorStyles.wordWrappedLabel); var newHeight = style.CalcHeight(new GUIContent(value), position.width) + 22; if (newHeight > height) { height = newHeight; } position.height = height; position.y += 21; EditorGUI.LabelField(position, value, EditorStyles.wordWrappedLabel); } EditorGUI.EndProperty(); }
static bool CheckIsValid(string key) { if (key == null) { return(false); } if (key == string.Empty) { return(false); } if (key == "") { return(false); } if (TextLocalisation.GetLocalisedValue(key) == null) { return(false); } else { return(true); } }
public static string GetValue(string key) { return(TextLocalisation.GetLocalisedValue(key)); }