mirror of
https://github.com/mehotkhan/BandersnatchInteractive.git
synced 2025-07-28 01:33:23 +00:00
assets/scripts.js: Implement disableImmediateSceneTransition
Allow navigating from dead-end segments without waiting for the segment to end.
This commit is contained in:
parent
e7b80f431a
commit
d228a13031
1 changed files with 6 additions and 5 deletions
|
@ -166,16 +166,15 @@ function addZones(segmentId) {
|
||||||
setNextSegment(defaultSegmentId);
|
setNextSegment(defaultSegmentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentChoices = [];
|
var currentChoiceMoment = null;
|
||||||
|
|
||||||
function addChoices(r) {
|
function addChoices(r) {
|
||||||
currentChoices = [];
|
currentChoiceMoment = r;
|
||||||
nextChoice = -1;
|
nextChoice = -1;
|
||||||
var ul = newList("choices");
|
var ul = newList("choices");
|
||||||
document.getElementById("choiceCaption").innerHTML = '';
|
document.getElementById("choiceCaption").innerHTML = '';
|
||||||
if (!r) return;
|
if (!r) return;
|
||||||
|
|
||||||
currentChoices = r.choices;
|
|
||||||
nextChoice = r.defaultChoiceIndex;
|
nextChoice = r.defaultChoiceIndex;
|
||||||
|
|
||||||
let index = 0;
|
let index = 0;
|
||||||
|
@ -209,7 +208,7 @@ function momentUpdate(m, ms) {
|
||||||
function momentEnd(m, seeked) {
|
function momentEnd(m, seeked) {
|
||||||
console.log('momentEnd', m, seeked);
|
console.log('momentEnd', m, seeked);
|
||||||
if (m.choices) {
|
if (m.choices) {
|
||||||
addChoices(0);
|
addChoices(null);
|
||||||
document.getElementById("progress").style.width = 0;
|
document.getElementById("progress").style.width = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -322,7 +321,7 @@ function ontimeupdate(evt) {
|
||||||
|
|
||||||
function playNextSegment() {
|
function playNextSegment() {
|
||||||
if (nextChoice >= 0) {
|
if (nextChoice >= 0) {
|
||||||
let x = currentChoices[nextChoice];
|
let x = currentChoiceMoment.choices[nextChoice];
|
||||||
let choiceId = x.segmentId ? x.segmentId : (x.sg ? x.sg : x.id);
|
let choiceId = x.segmentId ? x.segmentId : (x.sg ? x.sg : x.id);
|
||||||
var segmentId = findSegment(choiceId);
|
var segmentId = findSegment(choiceId);
|
||||||
console.log('choice', choiceId, 'nextSegment', segmentId);
|
console.log('choice', choiceId, 'nextSegment', segmentId);
|
||||||
|
@ -475,6 +474,8 @@ function seek(ms) {
|
||||||
function choice(choiceIndex) {
|
function choice(choiceIndex) {
|
||||||
nextChoice = choiceIndex;
|
nextChoice = choiceIndex;
|
||||||
newList("choices");
|
newList("choices");
|
||||||
|
if (!currentChoiceMoment.config.disableImmediateSceneTransition)
|
||||||
|
playNextSegment();
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyImpression(impressionData) {
|
function applyImpression(impressionData) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue