4 namespace HKI.Core.Loc.Editor
9 [CustomEditor(typeof(TextLocalization))]
13 const string textLocalizationElementsSPName =
"TextLocalizationElements";
15 SerializedProperty textLocalizationElementsSP = null;
20 textLocalizationElementsSP = serializedObject.FindProperty(textLocalizationElementsSPName);
26 Draw(serializedObject, textLocalizationElementsSP);
30 public static void Draw(SerializedObject serializedObject, SerializedProperty property)
32 serializedObject.Update();
34 EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
36 if (GUILayout.Button(
"Add", EditorStyles.toolbarButton, GUILayout.Width(40.0f)))
38 property.InsertArrayElementAtIndex(property.arraySize);
40 serializedObject.ApplyModifiedProperties();
41 serializedObject.Update();
44 EditorGUILayout.LabelField(
"Count of languages: " + property.arraySize);
46 EditorGUILayout.EndHorizontal();
51 for (
int i = 0; i <
property.arraySize; i++)
53 EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
55 EditorGUILayout.PropertyField(property.GetArrayElementAtIndex(i));
57 if(GUILayout.Button(
"Delete", EditorStyles.toolbarButton, GUILayout.Width(70.0f)))
64 EditorGUILayout.EndHorizontal();
68 property.DeleteArrayElementAtIndex(deleteIndex);
70 serializedObject.ApplyModifiedProperties();
override void OnInspectorGUI()
static void Draw(SerializedObject serializedObject, SerializedProperty property)
Custom inspector for the TextLocalization class.