GetSayDialog() публичный статический Метод

Returns a SayDialog by searching for one in the scene or creating one if none exists.
public static GetSayDialog ( ) : SayDialog
Результат SayDialog
Пример #1
0
 protected virtual void OnWriterState(Writer writer, WriterState writerState)
 {
     if (writerState == WriterState.End)
     {
         AddLine(SayDialog.GetSayDialog().NameText.text,
                 SayDialog.GetSayDialog().StoryText.text);
     }
 }
Пример #2
0
        /// <summary>
        /// Hides any currently displayed Say Dialog.
        /// </summary>
        public virtual void HideSayDialog()
        {
            var sayDialog = SayDialog.GetSayDialog();

            if (sayDialog != null)
            {
                sayDialog.FadeWhenDone = true;
            }
        }
Пример #3
0
        public virtual void HideSayDialog()
        {
            SayDialog sayDialog = SayDialog.GetSayDialog();

            if (sayDialog != null)
            {
                sayDialog.FadeOut();
            }
        }
Пример #4
0
        public override void OnEnter()
        {
            if (!showAlways && executionCount >= showCount)
            {
                Continue();
                return;
            }

            executionCount++;

            // Override the active say dialog if needed
            if (character != null && character.SetSayDialog != null)
            {
                SayDialog.ActiveSayDialog = character.SetSayDialog;
            }

            if (setSayDialog != null)
            {
                SayDialog.ActiveSayDialog = setSayDialog;
            }

            var sayDialog = SayDialog.GetSayDialog();

            if (sayDialog == null)
            {
                Continue();
                return;
            }

            var flowchart = GetFlowchart();

            sayDialog.SetActive(true);

            sayDialog.SetCharacter(character);
            sayDialog.SetCharacterImage(portrait);
            sayDialog.SetButtonUIActive(waitForClick);

            string displayText = storyText;

            var activeCustomTags = CustomTag.activeCustomTags;

            for (int i = 0; i < activeCustomTags.Count; i++)
            {
                var ct = activeCustomTags[i];
                displayText = displayText.Replace(ct.TagStartSymbol, ct.ReplaceTagStartWith);
                if (ct.TagEndSymbol != "" && ct.ReplaceTagEndWith != "")
                {
                    displayText = displayText.Replace(ct.TagEndSymbol, ct.ReplaceTagEndWith);
                }
            }

            string subbedText = flowchart.SubstituteVariables(displayText);

            sayDialog.Say(subbedText, !extendPrevious, waitForClick, fadeWhenDone, stopVoiceover, waitForVO, voiceOverClip, delegate {
                Continue();
            });
        }
Пример #5
0
        public override void OnEnter()
        {
            if (!showAlways && executionCount >= showCount)
            {
                Continue();
                return;
            }

            executionCount++;

            // Override the active say dialog if needed
            if (character != null && character.SetSayDialog != null)
            {
                SayDialog.ActiveSayDialog = character.SetSayDialog;
            }

            if (setSayDialog != null)
            {
                SayDialog.ActiveSayDialog = setSayDialog;
            }

            var sayDialog = SayDialog.GetSayDialog();

            if (sayDialog == null)
            {
                Continue();
                return;
            }

            var flowchart = GetFlowchart();

            sayDialog.SetActive(true);

            sayDialog.SetCharacter(character);
            sayDialog.SetCharacterImage(portrait);

            string displayText = storyText;

            var activeCustomTags = CustomTag.activeCustomTags;

            for (int i = 0; i < activeCustomTags.Count; i++)
            {
                var ct = activeCustomTags[i];
                displayText = displayText.Replace(ct.TagStartSymbol, ct.ReplaceTagStartWith);
                if (ct.TagEndSymbol != "" && ct.ReplaceTagEndWith != "")
                {
                    displayText = displayText.Replace(ct.TagEndSymbol, ct.ReplaceTagEndWith);
                }
            }

            string subbedText = flowchart.SubstituteVariables(displayText);


            SayAndContinue(sayDialog, subbedText);
        }
        protected virtual void OnWriterState(Writer writer, WriterState writerState)
        {
            if (writerState == WriterState.End)
            {
                var sd   = SayDialog.GetSayDialog();
                var from = sd.NameText;
                var line = sd.StoryText;

                AddLine(from, line);
            }
        }
Пример #7
0
        public override void OnStopExecuting()
        {
            var sayDialog = SayDialog.GetSayDialog();

            if (sayDialog == null)
            {
                return;
            }

            sayDialog.Stop();
        }
Пример #8
0
        public override void OnEnter()
        {
            if (!showAlways && executionCount >= showCount)
            {
                Continue();
                return;
            }

            executionCount++;

            // Override the active say dialog if needed
            if (character != null && character.setSayDialog != null)
            {
                SayDialog.activeSayDialog = character.setSayDialog;
            }

            if (setSayDialog != null)
            {
                SayDialog.activeSayDialog = setSayDialog;
            }

            SayDialog sayDialog = SayDialog.GetSayDialog();

            if (sayDialog == null)
            {
                Continue();
                return;
            }

            Flowchart flowchart = GetFlowchart();

            sayDialog.gameObject.SetActive(true);

            sayDialog.SetCharacter(character, flowchart);
            sayDialog.SetCharacterImage(portrait);

            string displayText = storyText;

            foreach (CustomTag ct in CustomTag.activeCustomTags)
            {
                displayText = displayText.Replace(ct.tagStartSymbol, ct.replaceTagStartWith);
                if (ct.tagEndSymbol != "" && ct.replaceTagEndWith != "")
                {
                    displayText = displayText.Replace(ct.tagEndSymbol, ct.replaceTagEndWith);
                }
            }

            string subbedText = flowchart.SubstituteVariables(displayText);

            sayDialog.Say(subbedText, !extendPrevious, waitForClick, fadeWhenDone, stopVoiceover, voiceOverClip, delegate {
                Continue();
            });
        }
Пример #9
0
        protected virtual void OnWriterState(Writer writer, WriterState writerState)
        {
            if (writerState == WriterState.End)
            {
                var sd = SayDialog.GetSayDialog();

                if (sd != null)
                {
                    NarrativeLogEntry entry = new NarrativeLogEntry()
                    {
                        name = sd.NameText,
                        text = sd.StoryText
                    };
                    AddLine(entry);
                }
            }
        }
Пример #10
0
        protected virtual SayDialog GetSayDialog(Character character)
        {
            SayDialog sayDialog = null;

            if (character != null)
            {
                if (character.SetSayDialog != null)
                {
                    sayDialog = character.SetSayDialog;
                }
            }

            if (sayDialog == null)
            {
                sayDialog = SayDialog.GetSayDialog();
            }

            return(sayDialog);
        }
        protected virtual SayDialog GetSayDialog(Character character)
        {
            SayDialog sayDialog = null;
            if (character != null)
            {
                if (character.SetSayDialog != null)
                {
                    sayDialog = character.SetSayDialog;
                }
            }

            if (sayDialog == null)
            {
                sayDialog = SayDialog.GetSayDialog();
            }

            sayDialog.SetActive(true);
            SayDialog.ActiveSayDialog = sayDialog;

            return sayDialog;
        }
Пример #12
0
        protected virtual void HideSayDialog()
        {
            SayDialog sayDialog = SayDialog.GetSayDialog();

            if (sayDialog != null)
            {
                bool fadingOut = false;
                bool movingOut = false;
                if (sayDialog.alwaysFadeDialog)
                {
                    sayDialog.FadeOutDialog();
                    fadingOut = true;
                }
                if (sayDialog.alwaysMoveDialog)
                {
                    sayDialog.MoveOutDialog();
                    movingOut = true;
                }
                if (!fadingOut && !movingOut)
                {
                    sayDialog.ShowDialog(false);
                }
            }
        }
Пример #13
0
        public override void OnEnter()
        {
            if (!showAlways && executionCount >= showCount)
            {
                Continue();
                return;
            }

            // 记录自己的
            // 调用次数
            executionCount++;

            // 角色上,是否有设置,
            // 聊天窗口
            // Override the active say dialog if needed
            if (character != null && character.SetSayDialog != null)
            {
                // 使用设置的对话框
                SayDialog.ActiveSayDialog = character.SetSayDialog;
            }

            // 本Say命令上
            // 是否有设置,对话面板
            if (setSayDialog != null)
            {
                // 使用设置的对话框
                SayDialog.ActiveSayDialog = setSayDialog;
            }

            // 获取到,
            // 对话面板
            var sayDialog = SayDialog.GetSayDialog();

            if (sayDialog == null)
            {
                Continue();
                return;
            }

            var flowchart = GetFlowchart();

            // 打开对话面板
            sayDialog.SetActive(true);

            // 设置对话的角色
            sayDialog.SetCharacter(character);

            // 设置对话框内,
            // 对话角色的头像
            // 并调整文本大小和位置
            sayDialog.SetCharacterImage(portrait);

            string displayText = storyText;

            // 遍历
            // 自定义的Tag
            // 根据设置,进行文本替换
            var activeCustomTags = CustomTag.activeCustomTags;

            for (int i = 0; i < activeCustomTags.Count; i++)
            {
                var ct = activeCustomTags[i];

                // 替换开始Tag
                displayText = displayText.Replace(ct.TagStartSymbol, ct.ReplaceTagStartWith);

                // 替换结束Tag
                if (ct.TagEndSymbol != "" && ct.ReplaceTagEndWith != "")
                {
                    displayText = displayText.Replace(ct.TagEndSymbol, ct.ReplaceTagEndWith);
                }
            }

            // 替换变量{$VarName}内容
            string subbedText = flowchart.SubstituteVariables(displayText);

            // Say有持续时间
            //  * 中间文本一点点出来
            //  * 文本中间有延迟
            //  * 文本最后,可能等待输入
            // 所以这里是,有完成回调!
            // 完成后,才执行下一个命令
            sayDialog.Say(
                subbedText,
                !extendPrevious,
                waitForClick,
                fadeWhenDone,

                // 和语音相关的
                // 3个选项
                stopVoiceover,      // 文本结束时候,是否结束语音
                waitForVO,
                voiceOverClip,
                delegate {
                Continue();
            }
                );
        }
Пример #14
0
 /// <summary>
 /// Returns the current say dialog.
 /// </summary>
 public virtual SayDialog GetSayDialog()
 {
     return(SayDialog.GetSayDialog());
 }
Пример #15
0
        protected virtual SayDialog GetSayDialog()
        {
            SayDialog sayDialog = SayDialog.GetSayDialog();

            return(sayDialog);
        }
Пример #16
0
        public override void OnEnter()
        {
            if (needName && StorySystem.StoryDataUtilities.StoryUserName != null)
            {
                storyText = storyText.Insert(AfterHowManyNumber, StorySystem.StoryDataUtilities.StoryUserName);
            }

            if (!showAlways && executionCount >= showCount)
            {
                Continue();
                return;
            }

            executionCount++;

            // Override the active say dialog if needed
            if (character != null && character.SetSayDialog != null)
            {
                SayDialog.ActiveSayDialog = character.SetSayDialog;
            }

            if (setSayDialog != null)
            {
                SayDialog.ActiveSayDialog = setSayDialog;
            }

            DialogPortrait diaPortrait = null;

            int[] diaPLayerSetting      = null;
            PortraitAnimClip[] animInfo = null;
            if (character != null && character.displayPortrait != null)
            {
                diaPortrait = character.displayPortrait;
            }

            if (diaPortrait != null)
            {
                diaPLayerSetting = new int[diaPortrait.charLayers.Length];
                var   presetData   = diaPortrait.GetPresetData();
                int[] layerSetting = null;
                if (portraitPresetIndex >= 0 &&
                    presetData != null &&
                    presetData.portraitPresets != null &&
                    presetData.portraitPresets.Length > portraitPresetIndex
                    )
                {
                    layerSetting = presetData.portraitPresets[portraitPresetIndex].spIndexes;
                }
                else
                {
                    layerSetting = portraitLayerSetting;
                }

                int overwriteSettingMax = layerSetting.Length;
                for (int i = 0; i < diaPLayerSetting.Length; i++)
                {
                    if (i < overwriteSettingMax)
                    {
                        diaPLayerSetting[i] = (layerSetting[i] >= 0) ? layerSetting[i] : character.defaultProtraitLayerSetting[i];
                    }
                    else
                    {
                        diaPLayerSetting[i] = layerSetting[i];
                    }
                }

                if (animPressetIndex >= 0 &&
                    presetData != null &&
                    presetData.animPresets != null &&
                    presetData.animPresets.Length > animPressetIndex
                    )
                {
                    animInfo = presetData.animPresets[animPressetIndex].clips;
                }
                else
                {
                    animInfo = animClips;
                }
            }

            DialogPortrait.ActivePortrait = diaPortrait;
            if (diaPortrait != null)
            {
                if (diaPLayerSetting != null && diaPLayerSetting.Length > 0)
                {
                    for (int i = 0; i < diaPLayerSetting.Length; i++)
                    {
                        diaPortrait.SetSprite(i, diaPLayerSetting[i]);
                    }
                }

                if (animInfo != null && animInfo.Length > 0)
                {
                    diaPortrait.PlayAnim(animInfo);
                }
            }

            var sayDialog = SayDialog.GetSayDialog();

            if (sayDialog == null)
            {
                Continue();
                return;
            }

            var flowchart = GetFlowchart();

            sayDialog.SetActive(true);

            sayDialog.SetCharacter(character);

            sayDialog.SetCharacterImage(portrait);

            string displayText = storyText;

            //if (playType == AnimPlayType.Start && !string.IsNullOrEmpty(sayDialogAnim))
            //{
            //    //  sayDialog.PlayAnim(sayDialogAnim);

            //}

            var activeCustomTags = CustomTag.activeCustomTags;

            for (int i = 0; i < activeCustomTags.Count; i++)
            {
                var ct = activeCustomTags[i];
                displayText = displayText.Replace(ct.TagStartSymbol, ct.ReplaceTagStartWith);
                if (ct.TagEndSymbol != "" && ct.ReplaceTagEndWith != "")
                {
                    displayText = displayText.Replace(ct.TagEndSymbol, ct.ReplaceTagEndWith);
                }
            }

            string subbedText = flowchart.SubstituteVariables(displayText);

            //stop voice via wwise
            if (!string.IsNullOrEmpty(PreVoiceClipName))
            {
                AudioManager.StopSound(PreVoiceClipName, 0);
            }//play voice via wwise
            if (!string.IsNullOrEmpty(voiceClipName))
            {
                AudioManager.TimeLinePlayVoice(voiceClipName);
            }
            sayDialog.Say(subbedText, !extendPrevious, waitForClick, fadeWhenDone, stopVoiceover, waitForVO, voiceOverClip, delegate {
                Continue();
            }, diaPortrait);
        }
Пример #17
0
        public override void OnEnter()
        {
            if (!showAlways && executionCount >= showCount)
            {
                Continue();
                return;
            }

            executionCount++;

            // Override the active say dialog if needed
            if (setSayDialog != null)
            {
                SayDialog.activeSayDialog = setSayDialog;
            }

            SayDialog sayDialog = SayDialog.GetSayDialog();

            if (sayDialog == null)
            {
                Continue();
                return;
            }

            Flowchart flowchart = GetFlowchart();

            sayDialog.SetCharacter(character, flowchart);
            sayDialog.SetCharacterImage(portrait);

            bool fadingIn = false;
            bool movingIn = false;

            if (sayDialog.alwaysFadeDialog || fadeIn)
            {
                sayDialog.FadeInDialog();
                fadingIn = true;
            }
            if (sayDialog.alwaysMoveDialog)
            {
                sayDialog.MoveInDialog();
                movingIn = true;
            }
            if (!fadingIn && !movingIn)
            {
                sayDialog.ShowDialog(true);
            }

            if (voiceOverClip != null)
            {
                sayDialog.PlayVoiceOver(voiceOverClip);
            }

            string displayText = storyText;

            foreach (CustomTag ct in CustomTag.activeCustomTags)
            {
                displayText = displayText.Replace(ct.tagStartSymbol, ct.replaceTagStartWith);
                if (ct.tagEndSymbol != "" && ct.replaceTagEndWith != "")
                {
                    displayText = displayText.Replace(ct.tagEndSymbol, ct.replaceTagEndWith);
                }
            }

            if (extendPrevious)
            {
                displayText = "{s=0}" + Dialog.prevStoryText + "{/s}" + displayText;
            }

            string subbedText = flowchart.SubstituteVariables(displayText);

            sayDialog.Say(subbedText, waitForClick, delegate {
                if (waitForClick)
                {
                    bool fadingOut = false;
                    bool movingOut = false;
                    if (sayDialog.alwaysFadeDialog || fadeOut)
                    {
                        sayDialog.FadeOutDialog();
                        fadingOut = true;
                    }
                    if (sayDialog.alwaysMoveDialog)
                    {
                        sayDialog.MoveOutDialog();
                        movingOut = true;
                    }
                    if (!fadingOut && !movingOut)
                    {
                        sayDialog.ShowDialog(false);
                    }
                }
                Continue();
            });
        }