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); } }
private IEnumerator UpdateDialogue(bool firstEntryOfNode, bool dialogueStepped, bool fromCheckpoint, Action onFinish) { if (!fromCheckpoint) { // If the following lines of code are put into a new coroutine, one frame's delay will be introduced, // so don't do that currentDialogueEntry.ExecuteAction(DialogueActionStage.BeforeCheckpoint, isRestoring); while (actionPauseLock.isLocked) { yield return(null); } } DialogueSaveCheckpoint(firstEntryOfNode, dialogueStepped, out var isReached, out var isReachedAnyHistory); dialogueWillChange.Invoke(new DialogueWillChangeData()); currentDialogueEntry.ExecuteAction(DialogueActionStage.Default, isRestoring); while (actionPauseLock.isLocked) { yield return(null); } dialogueChanged.Invoke(new DialogueChangedData(nodeHistory.Last(), currentIndex, currentDialogueEntry.GetDisplayData(), new Dictionary <string, VoiceEntry>(voicesNextDialogue), isReached, isReachedAnyHistory)); voicesNextDialogue.Clear(); currentDialogueEntry.ExecuteAction(DialogueActionStage.AfterDialogue, isRestoring); while (actionPauseLock.isLocked) { yield return(null); } if (advancedDialogueHelper.GetFallThrough()) { Step(Utils.WrapActionWithParameter <bool>(onFinish)); yield break; } var pendingJumpTarget = advancedDialogueHelper.GetJump(); if (pendingJumpTarget != null) { var node = flowChartTree.GetNode(pendingJumpTarget); this.RuntimeAssert(node != null, $"Node {pendingJumpTarget} not found."); MoveToNextNode(node, onFinish); yield break; } onFinish?.Invoke(); }
static int GetJump(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Nova.AdvancedDialogueHelper obj = (Nova.AdvancedDialogueHelper)ToLua.CheckObject <Nova.AdvancedDialogueHelper>(L, 1); string o = obj.GetJump(); LuaDLL.lua_pushstring(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }