Exemple #1
0
 private void DrawReadOnlyEventFields()
 {
     EditorGUILayout.LabelField("Application ID", _selectedEventObject.application.ToString());
     EditorGUILayout.LabelField("ID", _selectedEventObject.id.ToString());
     EditorGUILayout.LabelField("Name", _selectedEventObject.name);
     EventsManagerUI.SizedTextAreaLabel(_parent.position.width - LIST_WIDTH, "Description", _selectedEventObject.description);
 }
Exemple #2
0
        private void DrawParameterViewer(DDNAEventManagerEventParameter parameter)
        {
            List <string> usingEvents = GetEventNamesThatUseParameter(parameter.id);

            GUILayout.BeginVertical();

            EditorGUILayout.LabelField("Application ID", parameter.application.ToString());
            EditorGUILayout.LabelField("ID", parameter.id.ToString());
            EditorGUILayout.LabelField("Name", parameter.name);
            EventsManagerUI.SizedTextAreaLabel(_parent.position.width - LIST_WIDTH, "Description", parameter.description);

            EditorGUILayout.LabelField("Type", parameter.type);
            if (parameter.type == "STRING")
            {
                EditorGUILayout.LabelField("Format", parameter.format);
            }
            if (usingEvents.Count > 0)
            {
                EditorGUILayout.HelpBox("This parameter is in use by the following events: \n- " +
                                        String.Join("\n- ", usingEvents),
                                        MessageType.Info);
            }
            else
            {
                EditorGUILayout.HelpBox("This parameter is not used by any events!",
                                        MessageType.Info);
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
        }
Exemple #3
0
        private void DrawParameterCreator()
        {
            GUILayout.BeginVertical();
            EditorGUILayout.LabelField("Create New Parameter", EditorStyles.boldLabel);

            _newName        = EditorGUILayout.TextField("Name", _newName);
            _newDescription = EventsManagerUI.WordWrappedTextField(_parent.position.width - LIST_WIDTH,
                                                                   "Description",
                                                                   _newDescription);

            _newType = (ParameterType)EditorGUILayout.EnumPopup("Type", _newType);

            if (_newType == ParameterType.String)
            {
                _newFormat = EditorGUILayout.TextField("Format", _newFormat);
            }

            if (String.IsNullOrEmpty(_newName))
            {
                EditorGUILayout.HelpBox("A name is required.", MessageType.Warning);
            }
            else if (_parameterCreator.NameIsInvalid(_newName))
            {
                EditorGUILayout.HelpBox("Parameter names must begin with a lower-case English letter (a-z), and otherwise can only include upper-case or lower-case English letters (a-z, A-Z), digits (0-9) or underscores (_).", MessageType.Warning);
            }
            else
            {
                bool nameAlreadyInUse = false;
                foreach (DDNAEventManagerEventParameter parameter in _parameterProvider.Data)
                {
                    if (_newName.Equals(parameter.name, StringComparison.InvariantCultureIgnoreCase))
                    {
                        nameAlreadyInUse = true;
                        break;
                    }
                }

                if (nameAlreadyInUse)
                {
                    EditorGUILayout.HelpBox($"A parameter with the name {_newName} already exists.", MessageType.Warning);
                }
                else if (String.IsNullOrEmpty(_newDescription))
                {
                    EditorGUILayout.HelpBox("A description is required.", MessageType.Warning);
                }
                else if (GUILayout.Button("Create Parameter"))
                {
                    _mode = Mode.Creating;
                    CreateParameter();
                }
            }

            GUILayout.EndVertical();
        }
Exemple #4
0
        private void DrawEventCreator()
        {
            GUILayout.BeginVertical();
            EditorGUILayout.LabelField("Create New Event", EditorStyles.boldLabel);

            _newEventName        = EditorGUILayout.TextField("Event Name", _newEventName);
            _newEventDescription = EventsManagerUI.WordWrappedTextField(_parent.position.width - LIST_WIDTH,
                                                                        "Description",
                                                                        _newEventDescription);

            if (String.IsNullOrEmpty(_newEventName))
            {
                EditorGUILayout.HelpBox("A name is required.", MessageType.Warning);
            }
            else if (_eventEditor.NameIsInvalid(_newEventName))
            {
                EditorGUILayout.HelpBox("Event names can only include upper-case or lower-case English letters (a-z, A-Z), digits (0-9) or underscores (_).", MessageType.Warning);
            }
            else
            {
                bool nameAlreadyInUse = false;
                foreach (DDNAEventManagerEvent apiEvent in _eventProvider.Data)
                {
                    if (apiEvent.environment == _environmentProvider.CurrentEnvironmentId &&
                        _newEventName.Equals(apiEvent.name, StringComparison.InvariantCultureIgnoreCase))
                    {
                        nameAlreadyInUse = true;
                        break;
                    }
                }

                if (nameAlreadyInUse)
                {
                    EditorGUILayout.HelpBox($"An event with the name {_newEventName} already exists.", MessageType.Warning);
                }
                else if (String.IsNullOrEmpty(_newEventDescription))
                {
                    EditorGUILayout.HelpBox("A description is required.", MessageType.Warning);
                }
                else if (GUILayout.Button("Create Event"))
                {
                    _mode = Mode.Creating;
                    _eventEditor.CreateEvent(_newEventName,
                                             _newEventDescription,
                                             _environmentProvider.CurrentEnvironmentId,
                                             _authProvider.AuthToken);
                }
            }
            GUILayout.EndVertical();
        }