Пример #1
0
        public override void OnInspectorGUI()
        {
            InspectorUtils.DrawDefaultScriptField(serializedObject);

            serializedObject.Update();
            {
                HandleField(ref Dialog.Dialog, "Dialog Script");

                InspectorUtils.DrawFoldableProperty(serializedObject.FindProperty("OnDialogStart"));
                InspectorUtils.DrawFoldableProperty(serializedObject.FindProperty("OnDialogEnd"));

                var actors = serializedObject.FindProperty("Actors");
                if (actors.arraySize != 0)
                {
                    EditorGUILayout.Space();
                    EditorGUILayout.LabelField("Actors", EditorStyles.boldLabel);
                    for (int i = 0; i < actors.arraySize; i++)
                    {
                        EditorGUILayout.PropertyField(actors.GetArrayElementAtIndex(i));
                    }
                }

                var functions = serializedObject.FindProperty("Functions");
                if (functions.arraySize != 0)
                {
                    EditorGUILayout.Space();
                    EditorGUILayout.LabelField("Functions", EditorStyles.boldLabel);
                    for (int i = 0; i < functions.arraySize; i++)
                    {
                        var prop = functions.GetArrayElementAtIndex(i);
                        InspectorUtils.DrawFoldableProperty(prop, prop.FindPropertyRelative("Name").stringValue);
                    }
                }
            }
            serializedObject.ApplyModifiedProperties();

            EditorGUILayout.Space();
            if (GUILayout.Button("Reload"))
            {
                Dialog.ReloadDialog();
            }
        }