private void drawGrid() { EditorGUITools.DoHorizontal(() => { keyColumn(); foreach (var locale in serializedLocales.targetObjects) { localeColumn(new SerializedObject(locale)); } }); }
private void keyColumn() { int strings = serializedLocales.FindProperty("items").arraySize; EditorGUITools.DoVertical(() => { EditorGUILayout.LabelField(new GUIContent("String name", "The name used to identify this translation")); for (int keyIndex = 0; keyIndex < strings; keyIndex++) { var keyProp = serializedLocales.FindProperty("items").GetArrayElementAtIndex(keyIndex).FindPropertyRelative("key"); EditorGUILayout.PropertyField(keyProp); } }); serializedLocales.ApplyModifiedProperties(); }
private void OnGUI() { EditorGUITools.DoHorizontal(addOrRemoveLocale); if (serializedLocales != null && serializedLocales.targetObject != null) { serializedLocales.Update(); if (serializedLocales.FindProperty("items").arraySize > 0) { scrollPosition = EditorGUITools.DoScroll(drawGrid, scrollPosition); } else { EditorGUILayout.LabelField(Strings.NoStrings); } EditorGUITools.DoHorizontal(addOrRemoveItem); } }
private void localeColumn(SerializedObject locale) { int strings = serializedLocales.FindProperty("items").arraySize; EditorGUITools.DoVertical(() => { string label = locale.targetObject.name; if (settings.DefaultLocale == locale.targetObject.name) { label += " (Default)"; } EditorGUILayout.LabelField(label); for (int keyIndex = 0; keyIndex < strings; keyIndex++) { var localisationProp = locale.FindProperty("items").GetArrayElementAtIndex(keyIndex).FindPropertyRelative("value"); EditorGUILayout.PropertyField(localisationProp); } }); locale.ApplyModifiedProperties(); }