示例#1
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();
            });
        }
示例#2
0
        public override void OnEnter()
        {
            if (!showAlways && executionCount >= showCount)
            {
                Continue();
                return;
            }

            executionCount++;

            showBasicGUI = false;
            if (sayDialog == null)
            {
                // Try to get game's default SayDialog
                sayDialog = GetFungusScript().defaultSay;

                if (sayDialog == null)
                {
                    // Try to get any SayDialog in the scene
                    sayDialog = GameObject.FindObjectOfType <SayDialog>();
                }
                if (sayDialog == null)
                {
                    // No custom dialog box exists, just use basic gui
                    showBasicGUI = true;
                    return;
                }
            }

            FungusScript fungusScript = GetFungusScript();

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

            if (fadeIn)
            {
                sayDialog.FadeInDialog();
            }
            else
            {
                sayDialog.ShowDialog(true);
            }

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

            string extendedStoryText = storyText;

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

            string subbedText = fungusScript.SubstituteVariables(extendedStoryText);

            sayDialog.Say(subbedText, delegate {
                if (fadeOut)
                {
                    sayDialog.FadeOutDialog();
                }
                else
                {
                    sayDialog.ShowDialog(false);
                }
                Continue();
            });
        }