Tutorial Auto Starts

This commit is contained in:
Luis Fernando Molina committed 2020-09-21 13:23:25 +02:00
1 parent bbdab16eab
commit 6f5ab3a3ab
6 files changed
+34 -2

No files matched your search

@@ -152,6 +152,7 @@ function newNodeCloning() {
arrangementStyle: (node.payload.floatingObject.arrangementStyle)
},
uiObject: {
isPlaying: node.payload.uiObject.isPlaying,
isRunning: node.payload.uiObject.isRunning,
shortcutKey: node.payload.uiObject.shortcutKey
}
@@ -162,6 +162,7 @@ function newProtocolNode() {
arrangementStyle: (node.payload.floatingObject.arrangementStyle)
},
uiObject: {
isPlaying: node.payload.uiObject.isPlaying,
isRunning: node.payload.uiObject.isRunning,
shortcutKey: node.payload.uiObject.shortcutKey
}
@@ -2,6 +2,7 @@ function newUiObjectsFromNodes() {
thisObject = {
runTasks: runTasks,
runSessions: runSessions,
playTutorials: playTutorials,
recreateWorkspace: recreateWorkspace,
getNodeById: getNodeById,
tryToConnectChildrenWithReferenceParents: tryToConnectChildrenWithReferenceParents,
@@ -14,6 +15,7 @@ function newUiObjectsFromNodes() {
let mapOfNodes
let tasksToRun
let sessionsToRun
let tutorialsToPlay
return thisObject
@@ -25,6 +27,7 @@ function newUiObjectsFromNodes() {
mapOfNodes = new Map()
tasksToRun = []
sessionsToRun = []
tutorialsToPlay = []
removeNullRootNodes()
@@ -163,6 +166,14 @@ function newUiObjectsFromNodes() {
sessionsToRun = undefined
}
function playTutorials() {
for (let i = 0; i < tutorialsToPlay.length; i++) {
let node = tutorialsToPlay[i]
node.payload.uiObject.menu.internalClick('Play Tutorial')
}
tutorialsToPlay = undefined
}
function tryToConnectChildrenWithReferenceParents() {
/* We reconstruct here the reference relationships. */
for (const [key, node] of mapOfNodes) {
@@ -637,5 +648,16 @@ function newUiObjectsFromNodes() {
}
}
}
/* Check if there are tutorials to play */
if (userAddingNew === false && node.savedPayload !== undefined) {
if (uiObjectType === 'Tutorial') {
if (node.savedPayload.uiObject.isPlaying === true) {
if (tutorialsToPlay !== undefined) { // it might be undefined when you are spawning a tutorial that was playing while backed up
tutorialsToPlay.push(node)
}
}
}
}
}
}
+6 -2
View File
@@ -140,10 +140,14 @@ function newWorkspace() {
setTimeout(functionLibraryUiObjectsFromNodes.runTasks, 70000)
// We give a few seconds for the tasks to start
setTimeout(functionLibraryUiObjectsFromNodes.runSessions, 80000)
// We give a few seconds
setTimeout(functionLibraryUiObjectsFromNodes.playTutorials, 3000)
} else {
functionLibraryUiObjectsFromNodes.runTasks()
// We give a few seconds for the tasks to start
setTimeout(functionLibraryUiObjectsFromNodes.runSessions, 10000)
// We give a few seconds
setTimeout(functionLibraryUiObjectsFromNodes.playTutorials, 1000)
}
}
@@ -412,7 +416,7 @@ function newWorkspace() {
function replaceWorkspaceByLoadingOne(name) {
let webCommand
let webCommand
if (name.indexOf('Included -> ') >= 0) {
name = name.replace('Included -> ', '')
webCommand = 'LoadIncludedWorkspace'
@@ -420,7 +424,7 @@ function newWorkspace() {
webCommand = 'LoadWorkspace'
}
let blobService = newFileStorage()
let blobService = newFileStorage()
blobService.getFileFromHost(webCommand + '/' + name, onFileReceived, true)
function onFileReceived(err, text, response) {
if (err && err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
+1
View File
@@ -21,6 +21,7 @@ function newUiObject() {
uiObjectTitle: undefined,
circularProgressBar: undefined,
isRunning: undefined,
isPlaying: undefined,
shortcutKey: undefined,
isShowing: undefined,
hasError: undefined,
+3
View File
@@ -300,6 +300,7 @@ function newTutorialSpace() {
}
function playTutorial(node) {
node.payload.uiObject.isPlaying = true
tutorialRootNode = node
currentNode = node
currentStatus = 'Playing Tutorial'
@@ -307,6 +308,7 @@ function newTutorialSpace() {
}
function resumeTutorial(node) {
node.payload.uiObject.isPlaying = true
tutorialRootNode = node
currentNode = node
currentStatus = 'Playing Tutorial'
@@ -315,6 +317,7 @@ function newTutorialSpace() {
}
function stop() {
tutorialRootNode.payload.uiObject.isPlaying = false
tutorialRootNode = undefined
currentStatus = 'Stopped'
}