Пример #1
0
        public override void OnInspectorGUI()
        {
            var trigger = target as LuaTrigger;

            if (trigger == null || luaScriptWizard == null)
            {
                return;
            }

            trigger.trigger = (DialogueTriggerEvent)EditorGUILayout.EnumPopup(new GUIContent("Trigger", "The event that triggers the Lua code"), trigger.trigger);

            var newDatabase = EditorGUILayout.ObjectField("Reference Database", luaScriptWizard.database, typeof(DialogueDatabase), false) as DialogueDatabase;

            if (newDatabase != luaScriptWizard.database)
            {
                EditorTools.selectedDatabase = newDatabase;
                luaScriptWizard.database     = newDatabase;
                luaScriptWizard.RefreshWizardResources();
            }

            // Lua code / wizard:
            trigger.luaCode = luaScriptWizard.Draw(new GUIContent("Lua Code", "The Lua code to run"), trigger.luaCode);

            trigger.once = EditorGUILayout.Toggle(new GUIContent("Only Once", "Only trigger once, then destroy this component"), trigger.once);
            EditorTools.DrawSerializedProperty(serializedObject, "condition");
        }
Пример #2
0
        public override void OnInspectorGUI()
        {
            var trigger = target as BarkTrigger;

            if (trigger == null)
            {
                return;
            }

            trigger.trigger = (DialogueTriggerEvent)EditorGUILayout.EnumPopup(new GUIContent("Trigger", "The event that triggers the bark"), trigger.trigger);
            if (conversationPicker != null)
            {
                conversationPicker.Draw();
                trigger.conversation = conversationPicker.currentConversation;
                trigger.useConversationTitlePicker = conversationPicker.usePicker;
                trigger.selectedDatabase           = conversationPicker.database;
                if (EditorTools.selectedDatabase == null)
                {
                    EditorTools.selectedDatabase = trigger.selectedDatabase;
                }
            }
            trigger.barkOrder                = (BarkOrder)EditorGUILayout.EnumPopup(new GUIContent("Bark Order", "The order in which to bark dialogue entries"), trigger.barkOrder);
            trigger.conversant               = EditorGUILayout.ObjectField(new GUIContent("Barker", "The actor speaking the bark. If unassigned, this GameObject"), trigger.conversant, typeof(Transform), true) as Transform;
            trigger.target                   = EditorGUILayout.ObjectField(new GUIContent("Target", "The GameObject being barked at"), trigger.target, typeof(Transform), true) as Transform;
            trigger.once                     = EditorGUILayout.Toggle(new GUIContent("Only Once", "Only trigger once, then destroy this component"), trigger.once);
            trigger.skipIfNoValidEntries     = EditorGUILayout.Toggle(new GUIContent("Skip If No Valid Entries", "Only trigger if at least one entry's Conditions are currently true"), trigger.skipIfNoValidEntries);
            trigger.allowDuringConversations = EditorGUILayout.Toggle(new GUIContent("Allow During Conversations", "Allow barks during active conversations"), trigger.allowDuringConversations);
            trigger.cacheBarkLines           = EditorGUILayout.Toggle(new GUIContent("Cache Bark Lines", "Cache all bark lines on first bark. Faster, but loses dynamic barks"), trigger.cacheBarkLines);
            EditorTools.DrawSerializedProperty(serializedObject, "condition");
        }
Пример #3
0
        public override void OnInspectorGUI()
        {
            var trigger = target as ConversationTrigger;

            if (trigger == null)
            {
                return;
            }

            trigger.trigger = (DialogueTriggerEvent)EditorGUILayout.EnumPopup(new GUIContent("Trigger", "The event that triggers the conversation"), trigger.trigger);
            if (conversationPicker != null)
            {
                conversationPicker.Draw();
                trigger.conversation = conversationPicker.currentConversation;
                trigger.useConversationTitlePicker = conversationPicker.usePicker;
                trigger.selectedDatabase           = conversationPicker.database;
                if (EditorTools.selectedDatabase == null)
                {
                    EditorTools.selectedDatabase = trigger.selectedDatabase;
                }
            }
            trigger.actor                         = EditorGUILayout.ObjectField(new GUIContent("Actor", "The primary actor (e.g., player). If unassigned, the GameObject that triggered the conversation"), trigger.actor, typeof(Transform), true) as Transform;
            trigger.conversant                    = EditorGUILayout.ObjectField(new GUIContent("Conversant", "The other actor (e.g., NPC). If unassigned, this GameObject"), trigger.conversant, typeof(Transform), true) as Transform;
            trigger.once                          = EditorGUILayout.Toggle(new GUIContent("Only Once", "Only trigger once, then destroy this component"), trigger.once);
            trigger.skipIfNoValidEntries          = EditorGUILayout.Toggle(new GUIContent("Skip If No Valid Entries", "Only trigger if at least one entry's Conditions are currently true"), trigger.skipIfNoValidEntries);
            trigger.stopConversationOnTriggerExit = EditorGUILayout.Toggle(new GUIContent("Stop On Trigger Exit", "Stop the triggered conversation if this GameObject receives OnTriggerExit"), trigger.stopConversationOnTriggerExit);
            EditorTools.DrawSerializedProperty(serializedObject, "condition");
        }
        public override void OnInspectorGUI()
        {
            var trigger = target as ConditionObserver;

            if (trigger == null)
            {
                return;
            }

            // Reference database:
            EditorTools.selectedDatabase = EditorGUILayout.ObjectField("Reference Database", EditorTools.selectedDatabase, typeof(DialogueDatabase), false) as DialogueDatabase;

            // Frequency, once, observeGameObject:
            trigger.frequency         = EditorGUILayout.FloatField(new GUIContent("Frequency", "Frequency in seconds between checks"), trigger.frequency);
            trigger.once              = EditorGUILayout.Toggle(new GUIContent("Only Once", "Destroy after the condition is true"), trigger.once);
            trigger.observeGameObject = EditorGUILayout.ObjectField(new GUIContent("Observe GameObject", "Refer to this GameObject when evaluating the Condition"), trigger.observeGameObject, typeof(GameObject), false) as GameObject;

            // Condition:
            EditorTools.DrawSerializedProperty(serializedObject, "condition");

            actionFoldout = EditorGUILayout.Foldout(actionFoldout, "Action");
            if (!actionFoldout)
            {
                return;
            }

            EditorWindowTools.StartIndentedSection();

            // Lua code / wizard:
            if (EditorTools.selectedDatabase != luaScriptWizard.database)
            {
                luaScriptWizard.database = EditorTools.selectedDatabase;
                luaScriptWizard.RefreshWizardResources();
            }
            trigger.luaCode = luaScriptWizard.Draw(new GUIContent("Lua Code", "The Lua code to run when the condition is true"), trigger.luaCode);

            // Quest:
            if (EditorTools.selectedDatabase != questPicker.database)
            {
                questPicker.database = EditorTools.selectedDatabase;
                questPicker.UpdateTitles();
            }
            questPicker.Draw();
            trigger.questName          = questPicker.currentQuest;
            trigger.useQuestNamePicker = questPicker.usePicker;
            trigger.questState         = (QuestState)EditorGUILayout.EnumPopup(new GUIContent("Quest State", "The new quest state"), trigger.questState);

            // Alert message:
            trigger.alertMessage       = EditorGUILayout.TextField(new GUIContent("Alert Message", "Optional alert message to display when triggered"), trigger.alertMessage);
            trigger.localizedTextTable = EditorGUILayout.ObjectField(new GUIContent("Localized Text Table", "The localized text table to use for the alert message text"), trigger.localizedTextTable, typeof(LocalizedTextTable), true) as LocalizedTextTable;

            // Send Messages list:
            EditorTools.DrawSerializedProperty(serializedObject, "sendMessages");

            EditorWindowTools.EndIndentedSection();
        }
        public override void OnInspectorGUI()
        {
            var persistentActiveData = target as PersistentActiveData;

            if (persistentActiveData == null)
            {
                return;
            }

            persistentActiveData.target = EditorGUILayout.ObjectField(new GUIContent("Target", "The GameObject to set active or inactive based on the Condition below"), persistentActiveData.target, typeof(GameObject), true) as GameObject;

            EditorTools.DrawReferenceDatabase();
            EditorTools.DrawSerializedProperty(serializedObject, "condition");
        }
Пример #6
0
        public override void OnInspectorGUI()
        {
            var trigger = target as QuestTrigger;

            if (trigger == null)
            {
                return;
            }

            trigger.trigger = (DialogueTriggerEvent)EditorGUILayout.EnumPopup(new GUIContent("Trigger", "The event that triggers the quest change"), trigger.trigger);
            if (questPicker != null)
            {
                questPicker.Draw();
                trigger.questName          = questPicker.currentQuest;
                trigger.useQuestNamePicker = questPicker.usePicker;
                trigger.selectedDatabase   = questPicker.database;
                if (EditorTools.selectedDatabase == null)
                {
                    EditorTools.selectedDatabase = trigger.selectedDatabase;
                }
            }
            trigger.questState = (QuestState)EditorGUILayout.EnumPopup(new GUIContent("Quest State", "The new quest state"), trigger.questState);

            EditorWindowTools.StartIndentedSection();

            // Lua code / wizard:
            if (EditorTools.selectedDatabase != luaScriptWizard.database)
            {
                luaScriptWizard.database = EditorTools.selectedDatabase;
                luaScriptWizard.RefreshWizardResources();
            }
            trigger.luaCode = luaScriptWizard.Draw(new GUIContent("Lua Code", "The Lua code to run when the condition is true"), trigger.luaCode);

            trigger.alertMessage       = EditorGUILayout.TextField(new GUIContent("Alert Message", "Optional alert message to display when triggered"), trigger.alertMessage);
            trigger.localizedTextTable = EditorGUILayout.ObjectField(new GUIContent("Localized Text Table", "The localized text table to use for the alert message text"), trigger.localizedTextTable, typeof(LocalizedTextTable), true) as LocalizedTextTable;

            // Send Messages list:
            EditorTools.DrawSerializedProperty(serializedObject, "sendMessages");

            trigger.once = EditorGUILayout.Toggle(new GUIContent("Only Once", "Only trigger once, then destroy this component"), trigger.once);

            EditorWindowTools.EndIndentedSection();

            EditorTools.DrawSerializedProperty(serializedObject, "condition");
        }
Пример #7
0
        public override void OnInspectorGUI()
        {
            var trigger = target as AlertTrigger;

            if (trigger == null)
            {
                return;
            }

            trigger.trigger            = (DialogueTriggerEvent)EditorGUILayout.EnumPopup(new GUIContent("Trigger", "The event that triggers the Lua code"), trigger.trigger);
            trigger.localizedTextTable = EditorGUILayout.ObjectField(new GUIContent("Localized Text Table", "Optional localized text table; if assigned, Message is the field in the table"), trigger.localizedTextTable, typeof(LocalizedTextTable), true) as LocalizedTextTable;
            trigger.message            = EditorGUILayout.TextField(new GUIContent("Message", "The message to display, which may contain tags such as [var=varName]"), trigger.message);
            trigger.duration           = EditorGUILayout.FloatField(new GUIContent("Duration", "The duration in seconds to display the message"), trigger.duration);
            trigger.once = EditorGUILayout.Toggle(new GUIContent("Only Once", "Only trigger once, then destroy this component"), trigger.once);

            EditorTools.DrawReferenceDatabase();
            EditorTools.DrawSerializedProperty(serializedObject, "condition");
        }
        public override void OnInspectorGUI()
        {
            var trigger = target as SequenceTrigger;

            if (trigger == null)
            {
                return;
            }

            trigger.trigger = (DialogueTriggerEvent)EditorGUILayout.EnumPopup(new GUIContent("Trigger", "The event that triggers the sequence"), trigger.trigger);
            if (trigger.trigger == DialogueTriggerEvent.OnEnable || trigger.trigger == DialogueTriggerEvent.OnStart)
            {
                trigger.waitOneFrameOnStartOrEnable = EditorGUILayout.Toggle(new GUIContent("Wait 1 Frame", "Tick to wait one frame to allow other components to finish their OnStart/OnEnable"), trigger.waitOneFrameOnStartOrEnable);
            }
            EditorGUILayout.LabelField(new GUIContent("Sequence", "The sequence to play"));
            EditorWindowTools.StartIndentedSection();
            trigger.sequence = EditorGUILayout.TextArea(trigger.sequence);
            EditorWindowTools.EndIndentedSection();
            trigger.speaker  = EditorGUILayout.ObjectField(new GUIContent("Speaker", "The GameObject referenced by 'speaker'. If unassigned, this GameObject"), trigger.speaker, typeof(Transform), true) as Transform;
            trigger.listener = EditorGUILayout.ObjectField(new GUIContent("Listener", "The GameObject referenced by 'listener'. If unassigned, the GameObject that triggered this sequence"), trigger.listener, typeof(Transform), true) as Transform;
            trigger.once     = EditorGUILayout.Toggle(new GUIContent("Only Once", "Only trigger once, then destroy this component"), trigger.once);
            EditorTools.DrawReferenceDatabase();
            EditorTools.DrawSerializedProperty(serializedObject, "condition");
        }