Support initial Ink start paths
This commit is contained in:
parent
03b18d67b1
commit
3e773b1374
2 changed files with 26 additions and 0 deletions
13
dist/sai.js
vendored
13
dist/sai.js
vendored
|
|
@ -995,6 +995,15 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
function initialStoryPath(container) {
|
||||
return (
|
||||
container.dataset.inkStartPath ||
|
||||
container.dataset.inkInitialPath ||
|
||||
container.dataset.inkStart ||
|
||||
""
|
||||
).trim();
|
||||
}
|
||||
|
||||
function renderAdventureGraph(stageState, manifest, story, metadata, render) {
|
||||
const graph = resolveAdventureGraph(manifest);
|
||||
if (!stageState.graphLayer || !graph) return;
|
||||
|
|
@ -1432,6 +1441,10 @@
|
|||
|
||||
function reset() {
|
||||
const story = new window.inkjs.Story(JSON.stringify(storyJson));
|
||||
const startPath = initialStoryPath(container);
|
||||
if (startPath) {
|
||||
chooseStoryPath(story, startPath);
|
||||
}
|
||||
status.textContent = container.dataset.inkTitle || "Interactive story";
|
||||
choices.replaceChildren();
|
||||
variables.replaceChildren();
|
||||
|
|
|
|||
13
src/sai.js
13
src/sai.js
|
|
@ -995,6 +995,15 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
function initialStoryPath(container) {
|
||||
return (
|
||||
container.dataset.inkStartPath ||
|
||||
container.dataset.inkInitialPath ||
|
||||
container.dataset.inkStart ||
|
||||
""
|
||||
).trim();
|
||||
}
|
||||
|
||||
function renderAdventureGraph(stageState, manifest, story, metadata, render) {
|
||||
const graph = resolveAdventureGraph(manifest);
|
||||
if (!stageState.graphLayer || !graph) return;
|
||||
|
|
@ -1432,6 +1441,10 @@
|
|||
|
||||
function reset() {
|
||||
const story = new window.inkjs.Story(JSON.stringify(storyJson));
|
||||
const startPath = initialStoryPath(container);
|
||||
if (startPath) {
|
||||
chooseStoryPath(story, startPath);
|
||||
}
|
||||
status.textContent = container.dataset.inkTitle || "Interactive story";
|
||||
choices.replaceChildren();
|
||||
variables.replaceChildren();
|
||||
|
|
|
|||
Loading…
Reference in a new issue