added homebutton message and scripts cleanup

This commit is contained in:
Dante Ruiz 2017-11-01 11:03:48 -07:00
parent cde5208151
commit abb6f786fa
8 changed files with 25 additions and 18 deletions

View file

@ -168,7 +168,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
var pointer = (hand === RIGHT_HAND) ? _this.rightControllerPointer : _this.leftControllerPointer;
var targetID = laserLockInfo.targetID;
var targetIsOverlay = laserLockInfo.isOverlay;
Pointers.setLockEndUUID(pointer, targetID, targetIsOverlay);
Pointers.setLockEndUid(pointer, targetID, targetIsOverlay);
_this.laserLockStatus[hand] = targetID;
}
} else {
@ -634,7 +634,14 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
Pointers.removePointer(_this.leftControllerHudRayPick);
};
}
function mouseReleaseOnOverlay(overlayID, event) {
if (overlayID === HMD.homeButtonID) {
print(JSON.stringify(event));
print("---------> go home <--------");
Messages.sendLocalMessage("home", overlayID);
}
}
Overlays.mouseReleaseOnOverlay.connect(mouseReleaseOnOverlay);
var controllerDispatcher = new ControllerDispatcher();
Messages.subscribe('Hifi-Hand-RayPick-Blacklist');
Messages.messageReceived.connect(controllerDispatcher.handleHandMessage);

View file

@ -53,7 +53,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
enableDispatcherModule("LeftDisableModules", leftDisableModules);
enableDispatcherModule("RightDisableModules", rightDisableModules);
this.handleMessage = function(channel, message, sender) {
function handleMessage(channel, message, sender) {
if (sender === MyAvatar.sessionUUID) {
if (channel === 'Hifi-Hand-Disabler') {
if (message === 'left') {
@ -76,10 +76,10 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
};
Messages.subscribe('Hifi-Hand-Disabler');
this.cleanup = function() {
function cleanup() {
disableDispatcherModule("LeftDisableModules");
disableDispatcherModule("RightDisableModules");
};
Messages.messageReceived.connect(this.handleMessage);
Script.scriptEnding.connect(this.cleanup);
Messages.messageReceived.connect(handleMessage);
Script.scriptEnding.connect(cleanup);
}());

View file

@ -475,11 +475,11 @@ Script.include("/~/system/libraries/controllers.js");
enableDispatcherModule("LeftFarActionGrabEntity", leftFarActionGrabEntity);
enableDispatcherModule("RightFarActionGrabEntity", rightFarActionGrabEntity);
this.cleanup = function () {
function cleanup() {
leftFarActionGrabEntity.cleanup();
rightFarActionGrabEntity.cleanup();
disableDispatcherModule("LeftFarActionGrabEntity");
disableDispatcherModule("RightFarActionGrabEntity");
};
Script.scriptEnding.connect(this.cleanup);
Script.scriptEnding.connect(cleanup);
}());

View file

@ -256,11 +256,11 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
enableDispatcherModule("LeftNearActionGrabEntity", leftNearActionGrabEntity);
enableDispatcherModule("RightNearActionGrabEntity", rightNearActionGrabEntity);
this.cleanup = function () {
function cleanup() {
leftNearActionGrabEntity.cleanup();
rightNearActionGrabEntity.cleanup();
disableDispatcherModule("LeftNearActionGrabEntity");
disableDispatcherModule("RightNearActionGrabEntity");
};
Script.scriptEnding.connect(this.cleanup);
Script.scriptEnding.connect(cleanup);
}());

View file

@ -338,11 +338,11 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
enableDispatcherModule("LeftNearParentingGrabEntity", leftNearParentingGrabEntity);
enableDispatcherModule("RightNearParentingGrabEntity", rightNearParentingGrabEntity);
this.cleanup = function () {
function cleanup() {
leftNearParentingGrabEntity.cleanup();
rightNearParentingGrabEntity.cleanup();
disableDispatcherModule("LeftNearParentingGrabEntity");
disableDispatcherModule("RightNearParentingGrabEntity");
};
Script.scriptEnding.connect(this.cleanup);
Script.scriptEnding.connect(cleanup);
}());

View file

@ -224,11 +224,11 @@ Script.include("/~/system/libraries/utils.js");
enableDispatcherModule("LeftNearParentingGrabOverlay", leftNearParentingGrabOverlay);
enableDispatcherModule("RightNearParentingGrabOverlay", rightNearParentingGrabOverlay);
this.cleanup = function () {
function cleanup() {
leftNearParentingGrabOverlay.cleanup();
rightNearParentingGrabOverlay.cleanup();
disableDispatcherModule("LeftNearParentingGrabOverlay");
disableDispatcherModule("RightNearParentingGrabOverlay");
};
Script.scriptEnding.connect(this.cleanup);
Script.scriptEnding.connect(cleanup);
}());

View file

@ -110,11 +110,11 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
enableDispatcherModule("LeftNearTriggerEntity", leftNearTriggerEntity);
enableDispatcherModule("RightNearTriggerEntity", rightNearTriggerEntity);
this.cleanup = function () {
function cleanup() {
leftNearTriggerEntity.cleanup();
rightNearTriggerEntity.cleanup();
disableDispatcherModule("LeftNearTriggerEntity");
disableDispatcherModule("RightNearTriggerEntity");
};
Script.scriptEnding.connect(this.cleanup);
Script.scriptEnding.connect(cleanup);
}());

View file

@ -98,9 +98,9 @@
dispatcherUtils.enableDispatcherModule("LeftScaleEntity", leftScaleEntity);
dispatcherUtils.enableDispatcherModule("RightScaleEntity", rightScaleEntity);
this.cleanup = function() {
function cleanup() {
dispatcherUtils.disableDispatcherModule("LeftScaleEntity");
dispatcherUtils.disableDispatcherModule("RightScaleEntity");
};
Script.scriptEnding.connect(this.cleanup);
Script.scriptEnding.connect(cleanup);
})();