feat(dialogues): add opt-in dialogue choice paging (>8 choices) #35
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add Opt-In Dialogue Choice Paging (>8 Choices)
Summary
This PR introduces an opt-in UI utility that enables dialogue choice paging when a dialogue node contains more than 8 choices (vanilla prefab limit). It keeps compatibility with both Mono and IL2CPP by avoiding transpilers and only patches the dialogue UI (
DialogueCanvas).Paging behavior:
Motivation / Problem
Schedule I’s dialogue UI prefab provides a fixed list of 8 choice entries. Mods that inject additional choices (e.g., adding more hire locations, quest options, etc.) can exceed this limit and either:
An API-level, opt-in solution helps modders safely expose more than 8 choices without rebuilding UI prefabs.
Design Goals
DialogueCanvasmethods; do not patch dialogue handlers/controllers.Public API (S1API)
Implementation Notes
Patch only
DialogueCanvas:DisplayDialogueNode(...)(prefix): ifchoices.Count > MaxVisibleChoices, cache the full list and replace the passed-in list with the current page slice + “More (x/y)”.DisplayDialogueNode(...)(postfix): restoreDialogueHandler.CurrentChoicesto the full list (ensures downstream logic sees the real list).ChoiceSelected(int)(prefix): if the selected index is “More”, advance page and re-render the same node; otherwise remap visible index → real index.IsChoiceValid(int, out string)(prefix): when paging is active, validate using the real index (pageStart + visibleIndex); “More” always valid.EndDialogue()(postfix): clear cached paging state.Behavior Details
choices.Count > MaxVisibleChoices(default 8).ceil(totalChoices / ChoicesPerPage).Notes / Bug Avoidance
Vanilla
DialogueCanvas.IsChoiceValidindexes intoDialogueHandler.CurrentChoices[choiceIndex]. When paging, the visible index is no longer the same as the real index, so the patch remaps visible index → real index for validity checks. This avoids showing incorrect validity reasons (e.g. mismatch between the displayed option and the “invalid reason” text).Compatibility / Risk
DialogueCanvas).Testing
<= MaxVisibleChoicesremains unchangedDocs:
S1API/docs/dialogue-system.md(Advanced Features → Large Choice Lists (Paging))