mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 22:47:07 +02:00
Add extra logging to tutorial zones
This commit is contained in:
parent
09d9cd8311
commit
504295cdcf
2 changed files with 36 additions and 19 deletions
|
@ -1,28 +1,42 @@
|
||||||
(function() {
|
(function() {
|
||||||
var TutorialStartZone = function() {
|
var TutorialStartZone = function() {
|
||||||
|
print("TutorialStartZone | Creating");
|
||||||
};
|
};
|
||||||
|
|
||||||
TutorialStartZone.prototype = {
|
TutorialStartZone.prototype = {
|
||||||
preload: function(entityID) {
|
preload: function(entityID) {
|
||||||
|
print("TutorialStartZone | Preload");
|
||||||
this.entityID = entityID;
|
this.entityID = entityID;
|
||||||
|
this.sendStartIntervalID = null;
|
||||||
},
|
},
|
||||||
enterEntity: function() {
|
enterEntity: function() {
|
||||||
|
var self = this;
|
||||||
// send message to outer zone
|
// send message to outer zone
|
||||||
print("Entered the tutorial start area");
|
print("TutorialStartZone | Entered the tutorial start area");
|
||||||
if (HMD.isHMDAvailable() && HMD.isHandControllerAvailable()) {
|
if (HMD.isHMDAvailable() && HMD.isHandControllerAvailable()) {
|
||||||
var parentID = Entities.getEntityProperties(this.entityID, 'parentID').parentID;
|
function sendStart() {
|
||||||
if (parentID) {
|
print("TutorialStartZone | Checking parent ID");
|
||||||
Entities.callEntityMethod(parentID, 'start');
|
var parentID = Entities.getEntityProperties(self.entityID, 'parentID').parentID;
|
||||||
} else {
|
print("TutorialStartZone | Parent ID is: ", parentID);
|
||||||
print("ERROR: No parent id found on tutorial start zone");
|
if (parentID) {
|
||||||
|
print("TutorialStartZone | Entered the tutorial start area");
|
||||||
|
Entities.callEntityMethod(parentID, 'start');
|
||||||
|
} else {
|
||||||
|
print("TutorialStartZone | ERROR: No parent id found on tutorial start zone");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
this.sendStartIntervalID = Script.setInterval(sendStart, 1500);
|
||||||
} else {
|
} else {
|
||||||
|
print("TutorialStartZone | User tried to go to tutorial with HMD and hand controllers, sending back to /");
|
||||||
Window.alert("To proceed with this tutorial, please connect your VR headset and hand controllers.");
|
Window.alert("To proceed with this tutorial, please connect your VR headset and hand controllers.");
|
||||||
location = "/";
|
location = "/";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
leaveEntity: function() {
|
leaveEntity: function() {
|
||||||
print("Exited the tutorial start area");
|
print("TutorialStartZone | Exited the tutorial start area");
|
||||||
|
if (this.sendStartIntervalID) {
|
||||||
|
Script.clearInterval(this.sendStartIntervalID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ if (!Function.prototype.bind) {
|
||||||
Script.include(tutorialPath);
|
Script.include(tutorialPath);
|
||||||
|
|
||||||
var TutorialZone = function() {
|
var TutorialZone = function() {
|
||||||
|
print("TutorialZone | Creating");
|
||||||
this.token = null;
|
this.token = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -55,34 +56,36 @@ if (!Function.prototype.bind) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
preload: function(entityID) {
|
preload: function(entityID) {
|
||||||
|
print("TutorialZone | Preload");
|
||||||
this.entityID = entityID;
|
this.entityID = entityID;
|
||||||
},
|
},
|
||||||
start: function() {
|
start: function() {
|
||||||
print("Got start");
|
print("TutorialZone | Got start");
|
||||||
var self = this;
|
var self = this;
|
||||||
if (!this.token) {
|
if (!this.token) {
|
||||||
|
print("TutorialZone | Creating token");
|
||||||
this.token = new OwnershipToken(Math.random() * 100000, this.entityID, {
|
this.token = new OwnershipToken(Math.random() * 100000, this.entityID, {
|
||||||
onGainedOwnership: function(token) {
|
onGainedOwnership: function(token) {
|
||||||
print("GOT OWNERSHIP");
|
print("TutorialZone | GOT OWNERSHIP");
|
||||||
if (!self.tutorialManager) {
|
if (!self.tutorialManager) {
|
||||||
self.tutorialManager = new TutorialManager();
|
self.tutorialManager = new TutorialManager();
|
||||||
}
|
}
|
||||||
self.tutorialManager.startTutorial();
|
self.tutorialManager.startTutorial();
|
||||||
print("making bound release handler");
|
print("TutorialZone | making bound release handler");
|
||||||
self.keyReleaseHandlerBound = self.keyReleaseHandler.bind(self);
|
self.keyReleaseHandlerBound = self.keyReleaseHandler.bind(self);
|
||||||
print("binding");
|
print("TutorialZone | binding");
|
||||||
Controller.keyReleaseEvent.connect(self.keyReleaseHandlerBound);
|
Controller.keyReleaseEvent.connect(self.keyReleaseHandlerBound);
|
||||||
print("done");
|
print("TutorialZone | done");
|
||||||
},
|
},
|
||||||
onLostOwnership: function(token) {
|
onLostOwnership: function(token) {
|
||||||
print("LOST OWNERSHIP");
|
print("TutorialZone | LOST OWNERSHIP");
|
||||||
if (self.tutorialManager) {
|
if (self.tutorialManager) {
|
||||||
print("stopping tutorial..");
|
print("TutorialZone | stopping tutorial..");
|
||||||
self.tutorialManager.stopTutorial();
|
self.tutorialManager.stopTutorial();
|
||||||
print("done");
|
print("TutorialZone | done");
|
||||||
Controller.keyReleaseEvent.disconnect(self.keyReleaseHandlerBound);
|
Controller.keyReleaseEvent.disconnect(self.keyReleaseHandlerBound);
|
||||||
} else {
|
} else {
|
||||||
print("no tutorial manager...");
|
print("TutorialZone | no tutorial manager...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -90,12 +93,12 @@ if (!Function.prototype.bind) {
|
||||||
},
|
},
|
||||||
|
|
||||||
enterEntity: function() {
|
enterEntity: function() {
|
||||||
print("ENTERED THE TUTORIAL AREA");
|
print("TutorialZone | ENTERED THE TUTORIAL AREA");
|
||||||
},
|
},
|
||||||
leaveEntity: function() {
|
leaveEntity: function() {
|
||||||
print("EXITED THE TUTORIAL AREA");
|
print("TutorialZone | EXITED THE TUTORIAL AREA");
|
||||||
if (this.token) {
|
if (this.token) {
|
||||||
print("destroying token");
|
print("TutorialZone | Destroying token");
|
||||||
this.token.destroy();
|
this.token.destroy();
|
||||||
this.token = null;
|
this.token = null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue