private void DrawInputsStage()
        {
            if (DialogueManager.instance.displaySettings.inputSettings == null)
            {
                DialogueManager.instance.displaySettings.inputSettings = new DisplaySettings.InputSettings();
            }
            EditorGUILayout.LabelField("Input Settings", EditorStyles.boldLabel);
            EditorWindowTools.StartIndentedSection();
            EditorGUILayout.HelpBox("In this section, you'll specify input settings for the dialogue UI.", MessageType.Info);
            EditorWindowTools.StartIndentedSection();

            EditorWindowTools.DrawHorizontalLine();
            EditorGUILayout.LabelField("Player Response Menu", EditorStyles.boldLabel);
            EditorGUILayout.BeginHorizontal();
            DialogueManager.instance.displaySettings.inputSettings.alwaysForceResponseMenu = EditorGUILayout.Toggle("Always Force Menu", DialogueManager.instance.displaySettings.inputSettings.alwaysForceResponseMenu);
            EditorGUILayout.HelpBox("Tick to always force the response menu. If unticked, then when the player only has one valid response, the UI will automatically select it without showing the response menu.", MessageType.None);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            DialogueManager.instance.displaySettings.inputSettings.includeInvalidEntries = EditorGUILayout.Toggle("Include Invalid Entries", DialogueManager.instance.displaySettings.inputSettings.includeInvalidEntries);
            EditorGUILayout.HelpBox("Tick to include entries whose conditions are false in the menu. Their buttons will be visible but non-interactable.", MessageType.None);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            bool useTimeout = EditorGUILayout.Toggle("Timer", (DialogueManager.instance.displaySettings.inputSettings.responseTimeout > 0));

            EditorGUILayout.HelpBox("Tick to make the response menu timed. If unticked, players can take as long as they want to make their selection.", MessageType.None);
            EditorGUILayout.EndHorizontal();
            if (useTimeout)
            {
                if (Tools.ApproximatelyZero(DialogueManager.instance.displaySettings.inputSettings.responseTimeout))
                {
                    DialogueManager.instance.displaySettings.inputSettings.responseTimeout = DefaultResponseTimeoutDuration;
                }
                DialogueManager.instance.displaySettings.inputSettings.responseTimeout       = EditorGUILayout.FloatField("Timeout Seconds", DialogueManager.instance.displaySettings.inputSettings.responseTimeout);
                DialogueManager.instance.displaySettings.inputSettings.responseTimeoutAction = (ResponseTimeoutAction)EditorGUILayout.EnumPopup("If Time Runs Out", DialogueManager.instance.displaySettings.inputSettings.responseTimeoutAction);
            }
            else
            {
                DialogueManager.instance.displaySettings.inputSettings.responseTimeout = 0;
            }

            EditorWindowTools.DrawHorizontalLine();
            EditorGUILayout.LabelField("Quick Time Event (QTE) Trigger Buttons", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("QTE trigger buttons may be defined on the Dialogue Manager's inspector under Display Settings > Input Settings > QTE Input Buttons.", MessageType.None);
            if (GUILayout.Button("Inspect Dialogue Manager object", GUILayout.Width(240)))
            {
                Selection.activeObject = DialogueManager.instance;
            }

            EditorWindowTools.DrawHorizontalLine();
            EditorGUILayout.LabelField("Cancel Line", EditorStyles.boldLabel);
            EditorGUILayout.BeginHorizontal();
            DialogueManager.instance.displaySettings.inputSettings.cancel.key = (KeyCode)EditorGUILayout.EnumPopup("Key", DialogueManager.instance.displaySettings.inputSettings.cancel.key);
            EditorGUILayout.HelpBox("Pressing this key interrupts the currently-playing subtitle.", MessageType.None);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            DialogueManager.instance.displaySettings.inputSettings.cancel.buttonName = EditorGUILayout.TextField("Button Name", DialogueManager.instance.displaySettings.inputSettings.cancel.buttonName);
            EditorGUILayout.HelpBox("Pressing this button interrupts the currently-playing subtitle.", MessageType.None);
            EditorGUILayout.EndHorizontal();

            EditorWindowTools.DrawHorizontalLine();
            EditorGUILayout.LabelField("Cancel Conversation", EditorStyles.boldLabel);
            EditorGUILayout.BeginHorizontal();
            DialogueManager.instance.displaySettings.inputSettings.cancelConversation.key = (KeyCode)EditorGUILayout.EnumPopup("Key", DialogueManager.instance.displaySettings.inputSettings.cancel.key);
            EditorGUILayout.HelpBox("Pressing this key cancels the conversation if in the response menu.", MessageType.None);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            DialogueManager.instance.displaySettings.inputSettings.cancelConversation.buttonName = EditorGUILayout.TextField("Button Name", DialogueManager.instance.displaySettings.inputSettings.cancel.buttonName);
            EditorGUILayout.HelpBox("Pressing this button cancels the conversation if in the response menu.", MessageType.None);
            EditorGUILayout.EndHorizontal();

            EditorWindowTools.EndIndentedSection();
            EditorWindowTools.EndIndentedSection();
            DrawNavigationButtons(true, true, false);
        }
Beispiel #2
0
 private Transform GetBarker()
 {
     return(Tools.Select(conversant, this.transform));
 }
Beispiel #3
0
        /// <summary>
        /// Starts displaying a subtitle.
        /// </summary>
        /// <param name='subtitle'>
        /// Subtitle to display.
        /// </param>
        /// <param name='isPCResponseNext'>
        /// Indicates whether the next stage is the player or NPC.
        /// </param>
        /// <param name='isPCAutoResponseNext'>
        /// Indicates whether the next stage is a player auto-response.
        /// </param>
        public void StartSubtitle(Subtitle subtitle, bool isPCResponseMenuNext, bool isPCAutoResponseNext)
        {
            notifyOnFinishSubtitle = true;
            if (subtitle != null)
            {
                if (DialogueDebug.logInfo)
                {
                    Debug.Log(string.Format("{0}: {1} says '{2}'", new System.Object[] { DialogueDebug.Prefix, Tools.GetGameObjectName(subtitle.speakerInfo.transform), subtitle.formattedText.text }));
                }
                NotifyParticipantsOnConversationLine(subtitle);
                if (ShouldShowSubtitle(subtitle))
                {
                    ui.ShowSubtitle(subtitle);

                    // Save this info in case SetContinueMode() sequencer command forces reevaluation:
                    _subtitle             = subtitle;
                    _isPCResponseMenuNext = isPCResponseMenuNext;
                    _isPCAutoResponseNext = isPCAutoResponseNext;

                    SetupContinueButton(subtitle, isPCResponseMenuNext, isPCAutoResponseNext);
                }
                else
                {
                    waitForContinue = false;
                }
                sequencer.SetParticipants(subtitle.speakerInfo.transform, subtitle.listenerInfo.transform);
                sequencer.entrytag        = subtitle.entrytag;
                sequencer.subtitleEndTime = GetDefaultSubtitleDuration(subtitle.formattedText.text);
                if (!string.IsNullOrEmpty(subtitle.sequence) && subtitle.sequence.Contains("{{default}}"))
                {
                    subtitle.sequence = subtitle.sequence.Replace("{{default}}", GetDefaultSequence(subtitle));
                }
                if (subtitle.speakerInfo.isNPC)
                {
                    lastNPCSubtitle = subtitle;
                }
                else
                {
                    lastPCSubtitle = subtitle;
                }
                lastSubtitle = subtitle;
                if (dialogueEntrySpokenHandler != null)
                {
                    dialogueEntrySpokenHandler(subtitle);
                }
                sequencer.PlaySequence(string.IsNullOrEmpty(subtitle.sequence) ? GetDefaultSequence(subtitle) : PreprocessSequence(subtitle), settings.subtitleSettings.informSequenceStartAndEnd, false);
            }
            else
            {
                FinishSubtitle();
            }
            IsCancelKeyDown  = IsSubtitleCancelKeyDown;
            CancelledHandler = OnCancelSubtitle;
            if (!string.IsNullOrEmpty(subtitle.formattedText.text))
            {
                _lastModeWasResponseMenu = false;
            }
        }
Beispiel #4
0
 private void Awake()
 {
     Tools.DeprecationWarning(this, "Use LocalizeUI instead.");
 }