Esempio n. 1
0
        private IEnumerator WaitActionEnd(bool hasBeenReached)
        {
            while (actionPauseLock.isLocked)
            {
                yield return(null);
            }

            state = State.Normal;

            // everything that makes game state pause has ended, change dialogue
            // TODO: use advancedDialogueHelper to override dialogue
            // The game author should define overriding dialogues for each locale
            // By the way, we don't need to store all dialogues in save data,
            // just those overriden
            DialogueChanged?.Invoke(new DialogueChangedData(currentNode.name, currentIndex,
                                                            currentDialogueEntry.displayData, new Dictionary <string, VoiceEntry>(voicesOfNextDialogue),
                                                            hasBeenReached));

            voicesOfNextDialogue.Clear();

            var pendingJumpTarget = advancedDialogueHelper.GetJump();

            if (pendingJumpTarget != null)
            {
                var node = flowChartTree.GetNode(pendingJumpTarget);
                this.RuntimeAssert(node != null, "Node " + pendingJumpTarget + " does not exist!");
                MoveToNextNode(node);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Plays the given dialogue set. If another is playing, it is overwritten by this one.
        /// </summary>
        public void PlayDialogueSet(string setName, AssetsManager assetsManagerWithDialogue)
        {
            currentText           = "";
            currentSubstringIndex = 0;

            currentDialogueSet  = new DialogueSetInstance(assetsManagerWithDialogue.GetAsset <DialogueSet>(setName));
            CurrentDialogueName = setName;
            currentDialogueSet.StartNextDialogue();

            DialogueSetStarted?.Invoke();
            DialogueChanged?.Invoke(currentDialogueSet);

            this.assetsManagerWithDialogue = assetsManagerWithDialogue;

            fullText = CurrentDialogueFullText();
        }
Esempio n. 3
0
        /// <summary>
        /// Continues playing the current dialogue set, if any.
        /// If the current dialogue instance is still running, completes it (does not continue.)
        /// Does nothing if no dialogue set is currently playing.
        /// </summary>
        public void ContinueDialogueSet()
        {
            if (currentDialogueSet != null)
            {
                currentText           = "";
                currentSubstringIndex = 0;

                if (currentDialogueSet.choosingBranch)
                {
                    PlayOrContinueDialogueSet(currentDialogueSet.GetDialogueBranch(currentlySelectedDialogueBranch), assetsManagerWithDialogue);
                    currentlySelectedDialogueBranch = 0;
                    return;
                }

                if (!currentFinished)
                {                       //if the current dialogue set is not finished, finish it
                    currentText           = fullText;
                    currentSubstringIndex = fullText.Length;

                    currentFinished = true;
                }
                else
                {
                    currentDialogueSet.StartNextDialogue();
                    DialogueChanged?.Invoke(currentDialogueSet);

                    fullText = CurrentDialogueFullText();

                    currentFinished = false;

                    if (currentDialogueSet.done)
                    {
                        if (currentDialogueSet.dialogueSet.information.stringsTo != null && currentDialogueSet.dialogueSet.information.stringsTo != "")
                        {
                            PlayDialogueSet(currentDialogueSet.dialogueSet.information.stringsTo, assetsManagerWithDialogue);
                        }
                        else
                        {
                            ForceStopDialogue();
                        }
                    }
                }
            }
        }
Esempio n. 4
0
    public void NextDialogue()
    {
        pause = false;
        if (dialogues.Count == 0 && started)
        {
            started = false;
            clicked = false;
            DialoguesCompleted?.Invoke();
            return;
        }
        if (dialogues[0].GetType() == typeof(Question))
        {
            pause = true;
        }
        started = true;
        Dialogue currentDialogue = dialogues[0];
        Sprite   currentPortret  = portrets[0];

        dialogues.RemoveAt(0);
        portrets.RemoveAt(0);
        DialogueChanged?.Invoke(currentDialogue, currentPortret);
    }