Exemple #1
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;
                }
                m_sequencer.SetParticipants(subtitle.speakerInfo.transform, subtitle.listenerInfo.transform);
                m_sequencer.entrytag        = subtitle.entrytag;
                m_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);
                }
                m_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;
            }
        }
 /// <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)
 {
     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);
             waitForContinue = ShouldWaitForContinueButton(subtitle, isPCResponseMenuNext, isPCAutoResponseNext);
             var showContinueButton = ShouldShowContinueButton(isPCResponseMenuNext, isPCAutoResponseNext);
             if (waitForContinue)
             {
                 if (string.IsNullOrEmpty(subtitle.formattedText.text) && (subtitle.dialogueEntry.id == 0))
                 {
                     waitForContinue = false;
                 }
             }
             if (!showContinueButton)
             {
                 if (ui is AbstractDialogueUI)
                 {
                     (ui as AbstractDialogueUI).HideContinueButton(subtitle);
                 }
             }
         }
         else
         {
             waitForContinue = false;
         }
         sequencer.SetParticipants(subtitle.speakerInfo.transform, subtitle.listenerInfo.transform);
         sequencer.entrytag = subtitle.entrytag;
         sequencer.PlaySequence(string.IsNullOrEmpty(subtitle.sequence) ? GetDefaultSequence(subtitle) : PreprocessSequence(subtitle), settings.subtitleSettings.informSequenceStartAndEnd, false);
         if (subtitle.speakerInfo.IsNPC)
         {
             lastNPCSubtitle = subtitle;
         }
         else
         {
             lastPCSubtitle = subtitle;
         }
         lastSubtitle = subtitle;
         if (dialogueEntrySpokenHandler != null)
         {
             dialogueEntrySpokenHandler(subtitle);
         }
     }
     else
     {
         FinishSubtitle();
     }
     CancelledHandler = OnCancelSubtitle;
 }