public override void OnInspectorGUI() { serializedObject.Update(); EditorWindowTools.DrawDeprecatedTriggerHelpBox(); var trigger = target as SequenceTrigger; if (trigger == null) { return; } var triggerProperty = serializedObject.FindProperty("trigger"); EditorGUILayout.PropertyField(triggerProperty); if (DialogueTriggerEventDrawer.IsEnableOrStartEnumIndex(triggerProperty.enumValueIndex)) { EditorGUILayout.PropertyField(serializedObject.FindProperty("waitOneFrameOnStartOrEnable"), new GUIContent("Wait 1 Frame", "Tick to wait one frame to allow other components to finish their OnStart/OnEnable")); } serializedObject.ApplyModifiedProperties(); EditorGUI.BeginChangeCheck(); var newSequence = SequenceEditorTools.DrawLayout(new GUIContent("Sequence"), trigger.sequence, ref sequenceRect, ref syntaxState); var changed = EditorGUI.EndChangeCheck(); serializedObject.Update(); if (changed) { serializedObject.FindProperty("sequence").stringValue = newSequence; } EditorGUILayout.PropertyField(serializedObject.FindProperty("speaker"), true); EditorGUILayout.PropertyField(serializedObject.FindProperty("listener"), true); EditorGUILayout.PropertyField(serializedObject.FindProperty("once"), true); EditorTools.DrawReferenceDatabase(); EditorGUILayout.PropertyField(serializedObject.FindProperty("condition"), true); serializedObject.ApplyModifiedProperties(); }
private void DrawSequenceAction() { foldouts.sequenceFoldout = EditorWindowTools.EditorGUILayoutFoldout("Play Sequence", "Play a sequence.", foldouts.sequenceFoldout, false); if (foldouts.sequenceFoldout) { try { EditorWindowTools.EditorGUILayoutBeginGroup(); if (DialogueTriggerEventDrawer.IsEnableOrStartEnumIndex(triggerProperty.enumValueIndex)) { EditorGUILayout.PropertyField(serializedObject.FindProperty("waitOneFrameOnStartOrEnable"), new GUIContent("Wait 1 Frame", "Tick to wait one frame to allow other components to finish their OnStart/OnEnable"), true); } serializedObject.ApplyModifiedProperties(); EditorGUI.BeginChangeCheck(); var newSequence = SequenceEditorTools.DrawLayout(new GUIContent("Sequence"), trigger.sequence, ref sequenceRect); var changed = EditorGUI.EndChangeCheck(); serializedObject.Update(); if (changed) { serializedObject.FindProperty("sequence").stringValue = newSequence; } EditorGUILayout.PropertyField(serializedObject.FindProperty("sequenceSpeaker"), true); EditorGUILayout.PropertyField(serializedObject.FindProperty("sequenceListener"), true); } finally { EditorWindowTools.EditorGUILayoutEndGroup(); } } }
public override void OnInspectorGUI() { var trigger = target as ConditionObserver; if (trigger == null) { return; } serializedObject.Update(); // Reference database: EditorTools.selectedDatabase = EditorGUILayout.ObjectField(new GUIContent("Reference Database", "Database to use for pop-up menus. Assumes this database will be in memory at runtime."), EditorTools.selectedDatabase, typeof(DialogueDatabase), false) as DialogueDatabase; // Frequency, once, observeGameObject: EditorGUILayout.PropertyField(serializedObject.FindProperty("frequency"), true); EditorGUILayout.PropertyField(serializedObject.FindProperty("once"), true); EditorGUILayout.PropertyField(serializedObject.FindProperty("observeGameObject"), true); // Condition: foldouts.conditionFoldout = EditorWindowTools.EditorGUILayoutFoldout("Conditions", "Conditions that must be true for trigger to fire.", foldouts.conditionFoldout); if (foldouts.conditionFoldout) { try { EditorWindowTools.EditorGUILayoutBeginGroup(); ConditionPropertyDrawer.hideMainFoldout = true; var conditionProperty = serializedObject.FindProperty("condition"); conditionProperty.isExpanded = true; EditorGUILayout.PropertyField(conditionProperty, true); ConditionPropertyDrawer.hideMainFoldout = false; } finally { EditorWindowTools.EditorGUILayoutEndGroup(); } } // Action: foldouts.actionFoldout = EditorWindowTools.EditorGUILayoutFoldout("Actions", "Actions to run when the observed condition becomes true.", foldouts.actionFoldout); if (foldouts.actionFoldout) { try { EditorWindowTools.EditorGUILayoutBeginGroup(); serializedObject.ApplyModifiedProperties(); // Lua code / wizard: if (EditorTools.selectedDatabase != luaScriptWizard.database) { luaScriptWizard.database = EditorTools.selectedDatabase; luaScriptWizard.RefreshWizardResources(); } EditorGUI.BeginChangeCheck(); var newLuaCode = luaScriptWizard.Draw(new GUIContent("Lua Code", "The Lua code to run when the condition is true"), trigger.luaCode); // Sequence: var newSequence = SequenceEditorTools.DrawLayout(new GUIContent("Sequence"), trigger.sequence, ref sequenceRect, ref sequenceSyntaxState); // Quest: if (EditorTools.selectedDatabase != questPicker.database) { questPicker.database = EditorTools.selectedDatabase; questPicker.UpdateTitles(); } questPicker.Draw(); var newQuestName = questPicker.currentQuest; var newUseQuestNamePicker = questPicker.usePicker; var changed = EditorGUI.EndChangeCheck(); serializedObject.Update(); if (changed) { serializedObject.FindProperty("luaCode").stringValue = newLuaCode; serializedObject.FindProperty("sequence").stringValue = newSequence; serializedObject.FindProperty("questName").stringValue = newQuestName; serializedObject.FindProperty("useQuestNamePicker").boolValue = newUseQuestNamePicker; } EditorGUILayout.PropertyField(serializedObject.FindProperty("questState"), true); // Alert message: EditorGUILayout.PropertyField(serializedObject.FindProperty("alertMessage"), true); EditorGUILayout.PropertyField(serializedObject.FindProperty("textTable"), true); // Send Messages list: DrawSendMessageAction(); } finally { EditorWindowTools.EditorGUILayoutEndGroup(); } } serializedObject.ApplyModifiedProperties(); }