public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
        {
            // Set up quest picker:
            if (questPicker == null)
            {
                questPicker = new QuestPicker(EditorTools.FindInitialDatabase(), prop.stringValue, true);
            }

            // Set up property drawer:
            EditorGUI.BeginProperty(position, GUIContent.none, prop);
            position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);

            if (EditorTools.selectedDatabase == null)
            {
                EditorTools.SetInitialDatabaseIfNull();
            }
            if (ShowReferenceDatabase())
            {
                var dbPosition = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
                position = new Rect(position.x, position.y + EditorGUIUtility.singleLineHeight, position.width, position.height - EditorGUIUtility.singleLineHeight);
                EditorTools.selectedDatabase = EditorGUI.ObjectField(dbPosition, questPicker.database, typeof(DialogueDatabase), true) as DialogueDatabase;
            }
            if (EditorTools.selectedDatabase != questPicker.database)
            {
                questPicker.database = EditorTools.selectedDatabase;
                questPicker.UpdateTitles();
            }

            questPicker.Draw(position);
            prop.stringValue = questPicker.currentQuest;

            EditorGUI.EndProperty();
        }
        public virtual void OnEnable()
        {
            var trigger = target as DialogueSystemTrigger;

            if (trigger == null)
            {
                return;
            }
            if (trigger.selectedDatabase == null)
            {
                if (EditorTools.selectedDatabase == null)
                {
                    EditorTools.selectedDatabase = EditorTools.FindInitialDatabase();
                }
                trigger.selectedDatabase = EditorTools.selectedDatabase;
            }
            else
            {
                EditorTools.selectedDatabase = trigger.selectedDatabase;
            }
            luaScriptWizard = new LuaScriptWizard(trigger.selectedDatabase);
            questPicker     = new QuestPicker(trigger.selectedDatabase, trigger.questName, trigger.useQuestNamePicker);
            questPicker.showReferenceDatabase = false;

            showSetQuestStateAction  = !string.IsNullOrEmpty(trigger.questName);
            showRunLuaCodeAction     = !string.IsNullOrEmpty(trigger.luaCode);
            showPlaySequenceAction   = !string.IsNullOrEmpty(trigger.sequence);                                                                                                       // || trigger.sequenceSpeaker != null || trigger.sequenceListener != null;
            showAlertAction          = !string.IsNullOrEmpty(trigger.alertMessage);                                                                                                   // || trigger.alertDuration > 0;
            showSendMessagesAction   = trigger.sendMessages.Length > 0;
            showBarkAction           = !string.IsNullOrEmpty(trigger.barkConversation) || !string.IsNullOrEmpty(trigger.barkText) || !string.IsNullOrEmpty(trigger.barkTextSequence); // || trigger.barker != null;
            showConversationAction   = !string.IsNullOrEmpty(trigger.conversation);                                                                                                   // || trigger.conversationActor != null || trigger.conversationConversant != null;
            showSetActiveAction      = trigger.setActiveActions.Length > 0;
            showSetEnabledAction     = trigger.setEnabledActions.Length > 0;
            showAnimatorStatesAction = trigger.setAnimatorStateActions.Length > 0;
            showUnityEventAction     = trigger.onExecute.GetPersistentEventCount() > 0;

            sendMessageList = new ReorderableList(serializedObject, serializedObject.FindProperty("sendMessages"), true, true, true, true);
            sendMessageList.drawHeaderCallback  = OnDrawSendMessageListHeader;
            sendMessageList.drawElementCallback = OnDrawSendMessageListElement;

            setActiveList = new ReorderableList(serializedObject, serializedObject.FindProperty("setActiveActions"), true, true, true, true);
            setActiveList.drawHeaderCallback  = OnDrawSetActiveListHeader;
            setActiveList.drawElementCallback = OnDrawSetActiveListElement;

            setEnabledList = new ReorderableList(serializedObject, serializedObject.FindProperty("setEnabledActions"), true, true, true, true);
            setEnabledList.drawHeaderCallback  = OnDrawSetEnabledListHeader;
            setEnabledList.drawElementCallback = OnDrawSetEnabledListElement;

            setAnimatorStateList = new ReorderableList(serializedObject, serializedObject.FindProperty("setAnimatorStateActions"), true, true, true, true);
            setAnimatorStateList.drawHeaderCallback  = OnDrawSetAnimatorStateListHeader;
            setAnimatorStateList.drawElementCallback = OnDrawSetAnimatorStateListElement;

            foldouts = EditorPrefs.HasKey(InspectorEditorPrefsKey) ? JsonUtility.FromJson <Foldouts>(EditorPrefs.GetString(InspectorEditorPrefsKey)) : new Foldouts();
            if (foldouts == null)
            {
                foldouts = new Foldouts();
            }
        }
 public void OnEnable()
 {
     var trigger = target as ConditionObserver;
     if (trigger == null) return;
     if (EditorTools.selectedDatabase == null) EditorTools.selectedDatabase = EditorTools.FindInitialDatabase();
     luaScriptWizard = new LuaScriptWizard(EditorTools.selectedDatabase);
     questPicker = new QuestPicker(EditorTools.selectedDatabase, trigger.questName, trigger.useQuestNamePicker);
     questPicker.showReferenceDatabase = false;
 }
 public void OnEnable()
 {
     var trigger = target as QuestTrigger;
     if (trigger != null) {
         if (EditorTools.selectedDatabase == null) EditorTools.selectedDatabase = EditorTools.FindInitialDatabase();
         luaScriptWizard = new LuaScriptWizard(EditorTools.selectedDatabase);
         questPicker = new QuestPicker(trigger.selectedDatabase, trigger.questName, trigger.useQuestNamePicker);
     }
 }
Beispiel #5
0
        public void OnEnable()
        {
            var trigger = target as QuestTrigger;

            if (trigger != null)
            {
                EditorTools.SetInitialDatabaseIfNull();
                luaScriptWizard = new LuaScriptWizard(EditorTools.selectedDatabase);
                questPicker     = new QuestPicker(trigger.selectedDatabase, trigger.questName, trigger.useQuestNamePicker);
            }
        }
        protected virtual void DrawTopInfo()
        {
            // Trigger event:
            triggerProperty = serializedObject.FindProperty("trigger");
            EditorGUILayout.PropertyField(triggerProperty, true);

            // HelpBox for OnTrigger/Collision:
            var isPhysicsEvent =
                triggerProperty.enumValueIndex == 3 ||  //DialogueSystemTriggerEvent.OnTriggerEnter
                triggerProperty.enumValueIndex == 7 ||  //DialogueSystemTriggerEvent.OnTriggerExit
                triggerProperty.enumValueIndex == 11 || //DialogueSystemTriggerEvent.OnCollisionEnter
                triggerProperty.enumValueIndex == 12;   //DialogueSystemTriggerEvent.OnCollisionExit

            if (isPhysicsEvent)
            {
                var acceptedTags = serializedObject.FindProperty("condition").FindPropertyRelative("acceptedTags");
                if (acceptedTags.arraySize == 0)
                {
                    EditorGUILayout.HelpBox("You may want to set Conditions > Accepted Tags to observe collisions only with GameObjects with specific tags such as 'Player'. Otherwise this trigger may fire for unintended collisions such as world geometry.", MessageType.Info);
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button("Add 'Player' Tag", EditorStyles.miniButton, EditorTools.GUILayoutButtonWidth("Add 'Player' Tag")))
                    {
                        acceptedTags.arraySize = 1;
                        acceptedTags.GetArrayElementAtIndex(0).stringValue = "Player";
                    }
                    EditorGUILayout.EndHorizontal();
                }
            }

            // Reference database:
            var databaseProperty = serializedObject.FindProperty("selectedDatabase");
            var oldDatabase      = databaseProperty.objectReferenceValue;

            EditorGUILayout.PropertyField(databaseProperty, new GUIContent("Reference Database", "Database to use for pop-up menus. Assumes this database will be in memory at runtime."), true);
            var newDatabase = databaseProperty.objectReferenceValue as DialogueDatabase;

            if (newDatabase != oldDatabase)
            {
                luaScriptWizard = new LuaScriptWizard(newDatabase);
                questPicker     = new QuestPicker(newDatabase, trigger.questName, trigger.useQuestNamePicker);
                questPicker.showReferenceDatabase = false;
            }
            if (newDatabase != null)
            {
                EditorTools.selectedDatabase = newDatabase;
            }
        }
        public void OnEnable()
        {
            var trigger = target as ConditionObserver;

            if (trigger == null)
            {
                return;
            }
            if (EditorTools.selectedDatabase == null)
            {
                EditorTools.selectedDatabase = EditorTools.FindInitialDatabase();
            }
            luaScriptWizard = new LuaScriptWizard(EditorTools.selectedDatabase);
            questPicker     = new QuestPicker(EditorTools.selectedDatabase, trigger.questName, trigger.useQuestNamePicker);
            questPicker.showReferenceDatabase = false;
        }
        public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
        {
            // Set up quest picker:
            if (questPicker == null) {
                questPicker = new QuestPicker(EditorTools.FindInitialDatabase(), prop.stringValue, true);
            }
            if (EditorTools.selectedDatabase != questPicker.database) {
                questPicker.database = EditorTools.selectedDatabase;
                questPicker.UpdateTitles();
            }

            // Set up property drawer:
            EditorGUI.BeginProperty(position, GUIContent.none, prop);
            position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);

            questPicker.Draw(position);

            EditorGUI.EndProperty();
        }
Beispiel #9
0
        public void OnEnable()
        {
            var trigger = target as ConditionObserver;

            if (trigger == null)
            {
                return;
            }
            if (EditorTools.selectedDatabase == null)
            {
                EditorTools.selectedDatabase = EditorTools.FindInitialDatabase();
            }
            luaScriptWizard = new LuaScriptWizard(EditorTools.selectedDatabase);
            questPicker     = new QuestPicker(EditorTools.selectedDatabase, trigger.questName, trigger.useQuestNamePicker);
            questPicker.showReferenceDatabase = false;
            sendMessageList = new ReorderableList(serializedObject, serializedObject.FindProperty("sendMessages"), true, true, true, true);
            sendMessageList.drawHeaderCallback  = OnDrawSendMessageListHeader;
            sendMessageList.drawElementCallback = OnDrawSendMessageListElement;
            foldouts = EditorPrefs.HasKey(InspectorEditorPrefsKey) ? JsonUtility.FromJson <Foldouts>(EditorPrefs.GetString(InspectorEditorPrefsKey)) : new Foldouts();
        }
Beispiel #10
0
        public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
        {
            // Set up quest picker:
            if (questPicker == null)
            {
                questPicker = new QuestPicker(EditorTools.FindInitialDatabase(), prop.stringValue, true);
            }
            if (EditorTools.selectedDatabase != questPicker.database)
            {
                questPicker.database = EditorTools.selectedDatabase;
                questPicker.UpdateTitles();
            }

            // Set up property drawer:
            EditorGUI.BeginProperty(position, GUIContent.none, prop);
            position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);

            questPicker.Draw(position);

            EditorGUI.EndProperty();
        }