move debug cursor in runtime
This commit is contained in:
1 parent
5200db1562
commit
9f86bdbb0c
2 files changed
+45
No files matched your search
@@ -308,6 +308,26 @@ namespace Cthangover.Mods.Dialog
|
|||||||
ScheduleWaitTimer();
|
ScheduleWaitTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Moves a running dialog to another action and holds it there
|
||||||
|
/// (<see cref="DialogRuntime.MoveTo"/>): a pending wait timer and an open
|
||||||
|
/// answer box are dropped, since they belong to the action left behind;
|
||||||
|
/// the shown text stays until the new action replaces it.
|
||||||
|
/// </summary>
|
||||||
|
public bool MoveTo(int queueIndex)
|
||||||
|
{
|
||||||
|
if (!IsRunning)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
ClearWaitTimer();
|
||||||
|
if (answerBox != null)
|
||||||
|
{
|
||||||
|
answerBox.Hide();
|
||||||
|
answerBox = null;
|
||||||
|
}
|
||||||
|
return Runtime.MoveTo(queueIndex);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stops the running dialog without finishing it (<see cref="DialogRuntime.Abort"/>)
|
/// Stops the running dialog without finishing it (<see cref="DialogRuntime.Abort"/>)
|
||||||
/// and frees the box for another queue: closes the answer box, hides
|
/// and frees the box for another queue: closes the answer box, hides
|
||||||
|
|||||||
@@ -187,6 +187,31 @@ namespace Cthangover.Mods.Dialog
|
|||||||
End();
|
End();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Debugger "set next statement": makes the action at
|
||||||
|
/// <paramref name="queueIndex"/> the next one to run and holds the
|
||||||
|
/// runtime before it (<see cref="IsHeld"/>), so nothing runs until
|
||||||
|
/// <see cref="DialogBox.Resume"/>. The current action is destructed like
|
||||||
|
/// on a goto; actions between the old and the new position neither run
|
||||||
|
/// nor roll back — variables and game state stay as they are. Jumping
|
||||||
|
/// back to an action that already ran re-runs it, exactly like a
|
||||||
|
/// looping goto does. Returns false for an index outside the queue.
|
||||||
|
/// </summary>
|
||||||
|
public bool MoveTo(int queueIndex)
|
||||||
|
{
|
||||||
|
if (Lists.IsEmpty(dialogQueue) || queueIndex < 0 || queueIndex >= dialogQueue.Count)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var current = index >= 0 && index < dialogQueue.Count ? dialogQueue[index] : null;
|
||||||
|
if (current != null && current.IsConstructed && current.DestructType == DestructType.OnEndAction)
|
||||||
|
current.Destruct();
|
||||||
|
|
||||||
|
index = queueIndex;
|
||||||
|
isLastGoTo = false;
|
||||||
|
IsHeld = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Main execution loop. Iterates through actions, calling <see cref="IActionCommand.Run"/> on each and advancing
|
/// Main execution loop. Iterates through actions, calling <see cref="IActionCommand.Run"/> on each and advancing
|
||||||
/// automatically for <see cref="WaitType.NoWait"/> actions. Stops the loop on any wait-type action (WaitClick, WaitSelect,
|
/// automatically for <see cref="WaitType.NoWait"/> actions. Stops the loop on any wait-type action (WaitClick, WaitSelect,
|
||||||
|
|||||||
Reference in new issue
Block a user