Example #1
0
        private void OnLevelsNameGUI()
        {
            foreach (var externalEditor in _externalEditorData)
            {
                // Draw Level names from other editors (read only)
                externalEditor.LevelSpawnNames = JEMBetterEditor.ContentList(externalEditor.LevelSpawnNames, this,
                                                                             str =>
                {
                    str = EditorGUILayout.TextField(str);
                    return(str);
                },
                                                                             new JEMBetterEditorStyle(externalEditor.name, $"{ nameof(SharedContentEditorWindow)}.{externalEditor.UniqueGUID}.LevelSpawnNames")
                {
                    Readonly = true
                });
            }

            // Draw local editor
            if (_localEditorData == null)
            {
                EditorGUILayout.HelpBox("No local editor data detected.", MessageType.Warning, true);
            }
            else
            {
                _localEditorData.LevelSpawnNames = JEMBetterEditor.ContentList(_localEditorData.LevelSpawnNames, this,
                                                                               str =>
                {
                    str = EditorGUILayout.TextField(str);
                    return(str);
                },
                                                                               new JEMBetterEditorStyle($"Local Shared Data ({_localEditorData.name})", $"{nameof(SharedContentEditorWindow)}.{_localEditorData.UniqueGUID}.LevelSpawnNames"));
            }
        }
        /// <inheritdoc />
        public override void OnInspectorGUI()
        {
            EditorGUILayout.HelpBox("SLUI UNITY EVENT HELPER - This script is needed because of UnityEvents\n" +
                                    "design that is not allowing to get or set parameters.", MessageType.Info, true);

            EditorGUILayout.LabelField("Events", EditorStyles.boldLabel);
            _target.Items = JEMBetterEditor.ContentList(_target.Items, _target, o =>
            {
                EditorGUILayout.BeginVertical();
                GUILayout.Label("Parameters", EditorStyles.boldLabel);
                o.obj = JEMBetterEditor.ContentList(o.obj, _target, s =>
                {
                    s = EditorGUILayout.TextField(s);
                    return(s);
                }, new JEMBetterEditorStyle("Objects", $"{nameof(SLUIUnityEventHelperEditor)}.Obj_{_target.Items.IndexOf(o)}")
                {
                    FoldoutHeaderType = JEMBetterEditorHeaderType.None
                });

                CheckEvent(_target.Items.IndexOf(o), o.obj);
                EditorGUILayout.EndVertical();
                EditorGUILayout.Space();
                EditorGUILayout.Space();
                return(o);
            }, new JEMBetterEditorStyle("Events", $"{nameof(SLUIUnityEventHelperEditor)}.Events")
            {
                FoldoutHeaderType = JEMBetterEditorHeaderType.None
            });

            var button = _target.GetComponent <Button>();

            if (button == null)
            {
                return;
            }
            if (_target.Items.Count != button.onClick.GetPersistentEventCount())
            {
                EditorGUILayout.HelpBox("Error. You have defined invalid amount of events.", MessageType.Error, true);
            }
        }