Skip to content

Commit

Permalink
fix (navigation): flow.next adjust
Browse files Browse the repository at this point in the history
  • Loading branch information
santanche committed Nov 24, 2021
1 parent 84394fb commit dfb4203
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
26 changes: 21 additions & 5 deletions src/adonisjs/public/player/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ class PlayerManager {
this._state.historyRecord(startKnot)
this.knotLoad(startKnot)
break
case 'knot/navigate/>': const nextKnot = this._state.nextKnot()
case 'knot/navigate/>':
const nextKnot = this._state.nextKnot()
this._state.historyRecord(nextKnot)
this.knotLoad(nextKnot)
break
case 'flow/navigate/>': const flowNext = this._nextFlowKnot()
case 'flow/navigate/>':
const flowNext = this._nextFlowKnot()
if (flowNext != null) {
// console.log('=== flow next')
// console.log(flowNext)
this._state.historyRecord(flowNext.target)
this.knotLoad(flowNext.target)
}
Expand Down Expand Up @@ -144,6 +144,7 @@ class PlayerManager {
result.message)
}
this._state.historyRecord(target)
this._updateFlowKnot(target)
if (message.value) {
this._state.parameter = message.value
this.knotLoad(target, message.value)
Expand Down Expand Up @@ -173,6 +174,20 @@ class PlayerManager {
return next
}

_updateFlowKnot (knot) {
console.log('=== knot & flow')
console.log(knot)
console.log(this._state.flow.slice())
if (this._state.flow) {
let next
do {
next = this._state.flow.shift()
} while (this._state.flow.length > 0 && next.target != knot)
if (this._state.flow.length == 0) { delete this._state.flow }
}
console.log(this._state.flow.slice())
}

async startPlayer (caseid) {
const preCaseOff = true
this._mainPanel = document.querySelector('#player-panel')
Expand Down Expand Up @@ -330,7 +345,8 @@ class PlayerManager {
}
c++
}
if (flow != null && flow.length > 0) { this._state.flow = flow }
if (flow != null && flow.length > 0)
this._state.flow = flow
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/adonisjs/public/translator/translator.js
Original file line number Diff line number Diff line change
Expand Up @@ -726,8 +726,6 @@ class Translator {
for (let c = 1; c < compiled.length; c++) {
const pr = (c > 1 && compiled[c - 1].type == 'linefeed') ? c - 2 : c - 1
if (compiled[c].type == 'option') {
console.log('=== previous')
console.log(compiled[pr])
let stype = compiled[c].subtype
if (compiled[pr].type == 'input' && compiled[pr].subtype &&
compiled[pr].subtype == 'choice' && compiled[pr].options == null) {
Expand Down

0 comments on commit dfb4203

Please sign in to comment.