mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 05:43:36 +02:00
Add wentToEntry step to tutorial
This commit is contained in:
parent
e3ee7a2a11
commit
dd4e06e5de
2 changed files with 36 additions and 6 deletions
|
@ -972,12 +972,17 @@ TutorialManager = function() {
|
||||||
var startedTutorialAt = 0;
|
var startedTutorialAt = 0;
|
||||||
var startedLastStepAt = 0;
|
var startedLastStepAt = 0;
|
||||||
|
|
||||||
|
var WENT_TO_ENTRY_STEP_NUM = 20;
|
||||||
|
var VERSION = 1;
|
||||||
|
var tutorialID;
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this.startTutorial = function() {
|
this.startTutorial = function() {
|
||||||
currentStepNum = -1;
|
currentStepNum = -1;
|
||||||
currentStep = null;
|
currentStep = null;
|
||||||
startedTutorialAt = Date.now();
|
startedTutorialAt = Date.now();
|
||||||
|
tutorialID = Script.generateUUID();
|
||||||
STEPS = [
|
STEPS = [
|
||||||
new stepStart("start"),
|
new stepStart("start"),
|
||||||
new stepOrient("orient"),
|
new stepOrient("orient"),
|
||||||
|
@ -999,10 +1004,7 @@ TutorialManager = function() {
|
||||||
this.onFinish = function() {
|
this.onFinish = function() {
|
||||||
debug("onFinish", currentStepNum);
|
debug("onFinish", currentStepNum);
|
||||||
if (currentStep && currentStep.shouldLog !== false) {
|
if (currentStep && currentStep.shouldLog !== false) {
|
||||||
var timeToFinishStep = (Date.now() - startedLastStepAt) / 1000;
|
self.trackStep(currentStep.tag, currentStepNum);
|
||||||
var tutorialTimeElapsed = (Date.now() - startedTutorialAt) / 1000;
|
|
||||||
UserActivityLogger.tutorialProgress(
|
|
||||||
currentStep.tag, currentStepNum, timeToFinishStep, tutorialTimeElapsed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.startNextStep();
|
self.startNextStep();
|
||||||
|
@ -1015,6 +1017,12 @@ TutorialManager = function() {
|
||||||
|
|
||||||
++currentStepNum;
|
++currentStepNum;
|
||||||
|
|
||||||
|
// This always needs to be set because we use this value when
|
||||||
|
// tracking that the user has gone through the entry portal. When the
|
||||||
|
// tutorial finishes, there is a last "pseudo" step that the user
|
||||||
|
// finishes when stepping into the portal.
|
||||||
|
startedLastStepAt = Date.now();
|
||||||
|
|
||||||
if (currentStepNum >= STEPS.length) {
|
if (currentStepNum >= STEPS.length) {
|
||||||
// Done
|
// Done
|
||||||
info("DONE WITH TUTORIAL");
|
info("DONE WITH TUTORIAL");
|
||||||
|
@ -1024,7 +1032,6 @@ TutorialManager = function() {
|
||||||
} else {
|
} else {
|
||||||
info("Starting step", currentStepNum);
|
info("Starting step", currentStepNum);
|
||||||
currentStep = STEPS[currentStepNum];
|
currentStep = STEPS[currentStepNum];
|
||||||
startedLastStepAt = Date.now();
|
|
||||||
currentStep.start(this.onFinish);
|
currentStep.start(this.onFinish);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1046,6 +1053,21 @@ TutorialManager = function() {
|
||||||
currentStepNum = -1;
|
currentStepNum = -1;
|
||||||
currentStep = null;
|
currentStep = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.trackStep = function(name, stepNum) {
|
||||||
|
var timeToFinishStep = (Date.now() - startedLastStepAt) / 1000;
|
||||||
|
var tutorialTimeElapsed = (Date.now() - startedTutorialAt) / 1000;
|
||||||
|
UserActivityLogger.tutorialProgress(
|
||||||
|
name, stepNum, timeToFinishStep, tutorialTimeElapsed,
|
||||||
|
tutorialID, VERSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is a message sent from the "entry" portal in the courtyard,
|
||||||
|
// after the tutorial has finished.
|
||||||
|
this.enteredEntryPortal = function() {
|
||||||
|
info("Got enteredEntryPortal, tracking");
|
||||||
|
this.trackStep("wentToEntry", WENT_TO_ENTRY_STEP_NUM);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// To run the tutorial:
|
// To run the tutorial:
|
||||||
|
|
|
@ -113,6 +113,14 @@ if (!Function.prototype.bind) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onEnteredEntryPortal: function() {
|
||||||
|
print("TutorialZone | Got onEnteredEntryPortal");
|
||||||
|
if (this.tutorialManager) {
|
||||||
|
print("TutorialZone | Calling enteredEntryPortal");
|
||||||
|
this.tutorialManager.enteredEntryPortal();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
enterEntity: function() {
|
enterEntity: function() {
|
||||||
print("TutorialZone | ENTERED THE TUTORIAL AREA");
|
print("TutorialZone | ENTERED THE TUTORIAL AREA");
|
||||||
},
|
},
|
||||||
|
@ -125,7 +133,7 @@ if (!Function.prototype.bind) {
|
||||||
}
|
}
|
||||||
if (this.tutorialManager) {
|
if (this.tutorialManager) {
|
||||||
this.tutorialManager.stopTutorial();
|
this.tutorialManager.stopTutorial();
|
||||||
this.tutorialManager = null;
|
//this.tutorialManager = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue