mirror of
https://github.com/mehotkhan/BandersnatchInteractive.git
synced 2025-07-27 17:23:22 +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);
|
||||
}
|
||||
|
||||
var currentChoices = [];
|
||||
var currentChoiceMoment = null;
|
||||
|
||||
function addChoices(r) {
|
||||
currentChoices = [];
|
||||
currentChoiceMoment = r;
|
||||
nextChoice = -1;
|
||||
var ul = newList("choices");
|
||||
document.getElementById("choiceCaption").innerHTML = '';
|
||||
if (!r) return;
|
||||
|
||||
currentChoices = r.choices;
|
||||
nextChoice = r.defaultChoiceIndex;
|
||||
|
||||
let index = 0;
|
||||
|
@ -209,7 +208,7 @@ function momentUpdate(m, ms) {
|
|||
function momentEnd(m, seeked) {
|
||||
console.log('momentEnd', m, seeked);
|
||||
if (m.choices) {
|
||||
addChoices(0);
|
||||
addChoices(null);
|
||||
document.getElementById("progress").style.width = 0;
|
||||
}
|
||||
}
|
||||
|
@ -322,7 +321,7 @@ function ontimeupdate(evt) {
|
|||
|
||||
function playNextSegment() {
|
||||
if (nextChoice >= 0) {
|
||||
let x = currentChoices[nextChoice];
|
||||
let x = currentChoiceMoment.choices[nextChoice];
|
||||
let choiceId = x.segmentId ? x.segmentId : (x.sg ? x.sg : x.id);
|
||||
var segmentId = findSegment(choiceId);
|
||||
console.log('choice', choiceId, 'nextSegment', segmentId);
|
||||
|
@ -475,6 +474,8 @@ function seek(ms) {
|
|||
function choice(choiceIndex) {
|
||||
nextChoice = choiceIndex;
|
||||
newList("choices");
|
||||
if (!currentChoiceMoment.config.disableImmediateSceneTransition)
|
||||
playNextSegment();
|
||||
}
|
||||
|
||||
function applyImpression(impressionData) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue