public void MoveBackAndFastForward(NodeHistoryEntry nodeHistoryEntry, int dialogueIndex, int stepCount, bool clearFuture, Action onFinish) { isRestoring = true; MoveBackTo(nodeHistoryEntry, dialogueIndex, clearFuture); if (actionPauseLock.isLocked) { Debug.LogWarning("Nova: GameState paused by action when restoring"); isRestoring = false; return; } for (var i = 0; i < stepCount; ++i) { var isLast = i == stepCount - 1; if (isLast) { isRestoring = false; } NovaAnimation.StopAll(AnimationType.PerDialogue | AnimationType.Text); Step(); if (actionPauseLock.isLocked) { Debug.LogWarning("Nova: GameState paused by action when restoring"); isRestoring = false; return; } if (isLast) { onFinish?.Invoke(); } } }
public LogParam(DialogueDisplayData displayData, NodeHistoryEntry nodeHistoryEntry, int dialogueIndex, IReadOnlyDictionary <string, VoiceEntry> voices, int logEntryIndex) { this.displayData = displayData; this.nodeHistoryEntry = nodeHistoryEntry; this.dialogueIndex = dialogueIndex; this.voices = voices; this.logEntryIndex = logEntryIndex; }
private void _onGoBackButtonClicked(NodeHistoryEntry nodeHistoryEntry, int dialogueIndex) { gameState.MoveBackTo(nodeHistoryEntry, dialogueIndex); // Debug.LogFormat("Remain log entries count: {0}", logEntries.Count); if (hideOnGoBackButtonClicked) { Hide(); } }
public DialogueChangedData(NodeHistoryEntry nodeHistoryEntry, int dialogueIndex, DialogueDisplayData displayData, IReadOnlyDictionary <string, VoiceEntry> voicesNextDialogue, bool isReached, bool isReachedAnyHistory) { this.nodeHistoryEntry = nodeHistoryEntry; this.dialogueIndex = dialogueIndex; this.displayData = displayData; this.voicesNextDialogue = voicesNextDialogue; this.isReached = isReached; this.isReachedAnyHistory = isReachedAnyHistory; }
public void MoveBackTo(NodeHistoryEntry nodeHistoryEntry, int dialogueIndex, bool clearFuture = false, Action onFinish = null) { // Debug.Log($"MoveBackTo begin {nodeHistoryEntry.Key} {nodeHistoryEntry.Value} {dialogueIndex}"); CancelAction(); // Animation should stop NovaAnimation.StopAll(AnimationType.All ^ AnimationType.UI); // Restore history var backNodeIndex = nodeHistory.FindLastIndex(x => x.Equals(nodeHistoryEntry)); if (backNodeIndex < 0) { Debug.LogWarning($"Nova: Move back to node {nodeHistoryEntry.Key} that has not been walked through."); } if (clearFuture) { // All save data of nodes to be removed are deleted for (var i = backNodeIndex + 1; i < nodeHistory.Count; ++i) { checkpointManager.UnsetReached(nodeHistory.GetHashULong(0, i + 1)); } // All save data of later dialogues are deleted checkpointManager.UnsetReachedAfter(nodeHistory, dialogueIndex); } nodeHistory.RemoveRange(backNodeIndex + 1, nodeHistory.Count - (backNodeIndex + 1)); if (backNodeIndex < 0) { nodeHistory.Add(nodeHistoryEntry.Key); } nodeHistory.RemoveInterruptsAfter(backNodeIndex, dialogueIndex); currentNode = flowChartTree.GetNode(nodeHistoryEntry.Key); currentIndex = dialogueIndex; // Restore data var entry = checkpointManager.GetReached(nodeHistory, dialogueIndex); this.RuntimeAssert(entry != null, $"Unable to find restore entry with {nodeHistory} {nodeHistory.Hash}, dialogueIndex {dialogueIndex}"); Restore(entry, onFinish); // Debug.Log($"MoveBackTo end {nodeHistoryEntry.Key} {nodeHistoryEntry.Value} {dialogueIndex}"); }
private void OnGoBackButtonClicked(NodeHistoryEntry nodeHistoryEntry, int dialogueIndex, int logEntryIndex) { if (logEntryIndex == lastClickedLogIndex) { Alert.Show( null, I18n.__("log.back.confirm"), () => _onGoBackButtonClicked(nodeHistoryEntry, dialogueIndex), null, "LogBack" ); } else { lastClickedLogIndex = logEntryIndex; } }
/// <summary> /// Get the node name, the visit count, and the dialogue index before specified steps /// </summary> /// <param name="steps">number to step back</param> /// <param name="nodeHistoryEntry">node name and visit count at given steps before</param> /// <param name="dialogueIndex">dialogue index at given steps before</param> /// <returns>true when succeed, false when steps is too large or a negative number</returns> public bool SeekBackStep(int steps, out NodeHistoryEntry nodeHistoryEntry, out int dialogueIndex) { if (steps < 0) { nodeHistoryEntry = new NodeHistoryEntry("", -1); dialogueIndex = -1; return(false); } if (currentIndex >= steps) { nodeHistoryEntry = nodeHistory.Last(); dialogueIndex = currentIndex - steps; return(true); } // The following code won't be frequently executed, since there is always a checkpoint at the // start of the node, and the step number in the restore entry never steps across node // boundaries. steps -= currentIndex; for (var i = nodeHistory.Count - 2; i >= 0; i--) { var node = flowChartTree.GetNode(nodeHistory[i].Key); if (node.dialogueEntryCount >= steps) { nodeHistoryEntry = nodeHistory[i]; dialogueIndex = node.dialogueEntryCount - steps; return(true); } steps -= node.dialogueEntryCount; } nodeHistoryEntry = new NodeHistoryEntry("", -1); dialogueIndex = -1; return(false); }
public NodeChangedData(NodeHistoryEntry nodeHistoryEntry) { this.nodeHistoryEntry = nodeHistoryEntry; }