Пример #1
0
 private void drawGrid()
 {
     EditorGUITools.DoHorizontal(() => {
         keyColumn();
         foreach (var locale in serializedLocales.targetObjects)
         {
             localeColumn(new SerializedObject(locale));
         }
     });
 }
Пример #2
0
        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();
        }
Пример #3
0
 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);
     }
 }
Пример #4
0
        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();
        }