Exemplo n.º 1
0
 public void ActivateDialog(Dialog dialog, MapObject dismissReference)
 {
     this.dismissReference = dismissReference;
     currentDialog = dialog;
     dialogActive = true;
     NextMessage();
 }
Exemplo n.º 2
0
        public void NextMessage()
        {
            if (IsDialogActive())
            {
                // Resets animation index
                animationIndex = 0;
                animatedText = "";

                // If there's animation, just show the whole text
                if (isAnimating)
                {
                    isAnimating = false;
                    return;
                }
                
                // Checks if there's a remaining text
                if (remainingText != null && remainingText != "")
                {
                    currentText = GetCurrentText(remainingText);
                    remainingText = null;
                    return;
                }

                // Finishes the dialog
                if (nextTextIndex >= currentDialog.Messages.Count())
                {
                    nextTextIndex = 0;
                    dialogActive = false;
                    currentDialog = null;
                    currentText = "";

                    if (ScriptInterpreter.Instance.IsScriptRunning())
                    {
                        ScriptInterpreter.Instance.FinishedCommand();
                    } else
                    {
                        if (dismissReference != null)
                            dismissReference.Dismiss();

                        dismissReference = null;
                    }
                } else // or shows the next message
                {
                    currentText = GetCurrentText(currentDialog.Messages[nextTextIndex]);
                    nextTextIndex++;
                }
            }
        }