Esempio n. 1
0
        public override void OnEnter()
        {
            if (showOnce && executionCount > 0)
            {
                Continue();
                return;
            }

            executionCount++;

            SayDialog dialog = SetSayDialog.activeDialog;

            showBasicGUI = false;
            if (dialog == null)
            {
                showBasicGUI = true;
                return;
            }

            dialog.SetCharacter(character);

            dialog.ShowDialog(true);

            if (voiceOverClip != null)
            {
                MusicController.GetInstance().PlaySound(voiceOverClip, 1f);
            }

            dialog.Say(storyText, delegate {
                dialog.ShowDialog(false);
                Continue();
            });
        }
Esempio n. 2
0
        public override void OnEnter()
        {
            if (!showAlways && executionCount >= showCount)
            {
                Continue();
                return;
            }

            executionCount++;

            SayDialog sayDialog = SetSayDialog.GetActiveSayDialog();

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

            FungusScript fungusScript = GetFungusScript();

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

            sayDialog.ShowDialog(true);

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

            string subbedText = fungusScript.SubstituteVariables(storyText);

            sayDialog.Say(subbedText, waitForInput, delegate {
                if (waitForInput)
                {
                    sayDialog.ShowDialog(false);
                }
                Continue();
            });
        }
Esempio n. 3
0
        public virtual bool AddOption(string text, Sequence targetSequence)
        {
            gameObject.SetActive(true);

            bool addedOption = false;

            foreach (Button button in cachedButtons)
            {
                if (!button.gameObject.activeSelf)
                {
                    button.gameObject.SetActive(true);

                    Text textComponent = button.GetComponentInChildren <Text>();
                    if (textComponent != null)
                    {
                        textComponent.text = text;
                    }

                    Sequence sequence = targetSequence;

                    button.onClick.AddListener(delegate {
                        StopAllCoroutines();                         // Stop timeout
                        Clear();
                        gameObject.SetActive(false);

                        // Hide the active Say dialog in case it's still being displayed
                        SayDialog activeSayDialog = SetSayDialog.GetActiveSayDialog();
                        if (activeSayDialog != null)
                        {
                            activeSayDialog.ShowDialog(false);
                        }

                        if (sequence != null)
                        {
                                                        #if UNITY_EDITOR
                            // Select the new target sequence in the Fungus Script window
                            FungusScript fungusScript     = sequence.GetFungusScript();
                            fungusScript.selectedSequence = sequence;
                                                        #endif

                            sequence.ExecuteCommand(0);
                        }
                    });

                    addedOption = true;
                    break;
                }
            }

            return(addedOption);
        }
        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);
                }
            }
        }
Esempio n. 5
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();
            });
        }
Esempio n. 6
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();
            });
        }