begining to remove hud items

This commit is contained in:
Dante Ruiz 2017-01-12 18:48:19 +00:00
parent 6c2cae8749
commit a16b229c65
4 changed files with 31 additions and 104 deletions

View file

@ -38,7 +38,7 @@
defaultTab = "gamepad";
}
var queryParameters = "handControllerName=" + handControllerName + "&defaultTab=" + defaultTab;
tablet.gotoWebScreen(HELP_URL + "?" + queryParameters);
Menu.triggerOption('Help...');
}
button.clicked.connect(onClicked);

View file

@ -23,6 +23,7 @@ var CAMERA_MATRIX = -7;
var ROT_Y_180 = {x: 0, y: 1, z: 0, w: 0};
var TABLET_URL = "http://hifi-content.s3.amazonaws.com/alan/dev/Tablet-Model-v1-x.fbx";
var HOME_BUTTON_URL = "http://hifi-content.s3.amazonaws.com/alan/dev/tablet-home-button.fbx";
// returns object with two fields:
// * position - position in front of the user
// * rotation - rotation of entity so it faces the user.
@ -98,10 +99,10 @@ WebTablet = function (url, width, dpi, hand, clientOnly) {
var HOME_BUTTON_Y_OFFSET = -0.25;
this.homeButtonEntity = Entities.addEntity({
name: "homeButton",
type: "Sphere",
type: "Model",
modelURL: HOME_BUTTON_URL,
collisionless: true,
localPosition: {x: 0, y: HOME_BUTTON_Y_OFFSET, z: 0},
dimensions: {x: 0.05, y: 0.05, z: 0.05},
parentID: this.tabletEntityID,
script: Script.resolvePath("../tablet-ui/HomeButton.js")
}, clientOnly);
@ -110,13 +111,6 @@ WebTablet = function (url, width, dpi, hand, clientOnly) {
this.receive = function (channel, senderID, senderUUID, localOnly) {
if (_this.homeButtonEntity == senderID) {
if (_this.clicked) {
Entities.editEntity(_this.homeButtonEntity, {color: {red: 0, green: 255, blue: 255}});
_this.clicked = false;
} else {
Entities.editEntity(_this.homeButtonEntity, {color: {red: 255, green: 255, blue: 0}});
_this.clicked = true;
}
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
tablet.gotoHomeScreen();
}

View file

@ -58,94 +58,37 @@ var marketplaceWebTablet;
// To keep things consistent, we pickle the tablet data in Settings, and kill any existing such on restart and domain change.
var persistenceKey = "io.highfidelity.lastDomainTablet";
function shouldShowWebTablet() {
var rightPose = Controller.getPoseValue(Controller.Standard.RightHand);
var leftPose = Controller.getPoseValue(Controller.Standard.LeftHand);
var hasHydra = !!Controller.Hardware.Hydra;
return HMD.active && (leftPose.valid || rightPose.valid || hasHydra);
}
function showMarketplace() {
if (shouldShowWebTablet()) {
updateButtonState(true);
marketplaceWebTablet = new WebTablet(MARKETPLACE_URL_INITIAL, null, null, true);
Settings.setValue(persistenceKey, marketplaceWebTablet.pickle());
marketplaceWebTablet.setScriptURL(MARKETPLACES_INJECT_SCRIPT_URL);
marketplaceWebTablet.getOverlayObject().webEventReceived.connect(function (message) {
if (message === GOTO_DIRECTORY) {
marketplaceWebTablet.setURL(MARKETPLACES_URL);
}
if (message === QUERY_CAN_WRITE_ASSETS) {
marketplaceWebTablet.getOverlayObject().emitScriptEvent(CAN_WRITE_ASSETS + " " + Entities.canWriteAssets());
}
if (message === WARN_USER_NO_PERMISSIONS) {
Window.alert(NO_PERMISSIONS_ERROR_MESSAGE);
}
});
} else {
marketplaceWindow.setURL(MARKETPLACE_URL_INITIAL);
marketplaceWindow.setVisible(true);
}
tablet.gotoWebScreen(MARKETPLACE_URL_INITIAL);
tablet.setScriptURL(MARKETPLACES_INJECT_SCRIPT_URL);
tablet.webEventRecieved(function (message) {
if (message === GOTO_DIRECTORY) {
tablet.gotoWebScreen(MATKETPLACES_URL);
}
marketplaceVisible = true;
if (message === QUERY_CAN_WRITE_ASSESTS) {
tablet.emitScriptEvent(CAN_WRITE_ASSETS + " " + Entities.canWriteAssets());
}
if (message === WARN_USER_NO_PERMISSIONS) {
Window.alert(NO_PERMISSIONS_ERROR_MESSAGE);
}
});
UserActivityLogger.openedMarketplace();
}
function hideTablet(tablet) {
if (!tablet) {
return;
}
updateButtonState(false);
tablet.destroy();
marketplaceWebTablet = null;
Settings.setValue(persistenceKey, "");
}
function clearOldTablet() { // If there was a tablet from previous domain or session, kill it and let it be recreated
var tablet = WebTablet.unpickle(Settings.getValue(persistenceKey, ""));
hideTablet(tablet);
}
function hideMarketplace() {
if (marketplaceWindow.visible) {
marketplaceWindow.setVisible(false);
marketplaceWindow.setURL("about:blank");
} else if (marketplaceWebTablet) {
hideTablet(marketplaceWebTablet);
}
marketplaceVisible = false;
}
marketplaceWindow.closed.connect(function () {
marketplaceWindow.setURL("about:blank");
});
function toggleMarketplace() {
if (marketplaceVisible) {
hideMarketplace();
} else {
showMarketplace();
}
showMarketplace();
}
var toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system");
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var browseExamplesButton = toolBar.addButton({
imageURL: toolIconUrl + "market.svg",
objectName: "marketplace",
buttonState: 1,
defaultState: 1,
hoverState: 3,
alpha: 0.9
var browseExamplesButton = tablet.addButton({
icon: "icons/tablet-icons/market-i.svg",
text: "MARKETPLACE"
});
function updateButtonState(visible) {
browseExamplesButton.writeProperty('buttonState', visible ? 0 : 1);
browseExamplesButton.writeProperty('defaultState', visible ? 0 : 1);
browseExamplesButton.writeProperty('hoverState', visible ? 2 : 3);
}
function onMarketplaceWindowVisibilityChanged() {
updateButtonState(marketplaceWindow.visible);
marketplaceVisible = marketplaceWindow.visible;
}
function onCanWriteAssetsChanged() {
var message = CAN_WRITE_ASSETS + " " + Entities.canWriteAssets();
if (marketplaceWindow.visible) {
@ -161,16 +104,11 @@ function onClick() {
}
browseExamplesButton.clicked.connect(onClick);
marketplaceWindow.visibleChanged.connect(onMarketplaceWindowVisibilityChanged);
Entities.canWriteAssetsChanged.connect(onCanWriteAssetsChanged);
clearOldTablet(); // Run once at startup, in case there's anything laying around from a crash.
// We could also optionally do something like Window.domainChanged.connect(function () {Script.setTimeout(clearOldTablet, 2000)}),
// but the HUD version stays around, so lets do the same.
Script.scriptEnding.connect(function () {
toolBar.removeButton("marketplace");
browseExamplesButton.clicked.disconnect(onClick);
tablet.removeButton(browseExamplesButton);
marketplaceWindow.visibleChanged.disconnect(onMarketplaceWindowVisibilityChanged);
Entities.canWriteAssetsChanged.disconnect(onCanWriteAssetsChanged);
});

View file

@ -361,16 +361,11 @@ triggerMapping.from(Controller.Standard.LTClick).peek().to(makeClickHandler(Cont
//
// Manage the connection between the button and the window.
//
var toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system");
var buttonName = "pal";
var button = toolBar.addButton({
objectName: buttonName,
imageURL: Script.resolvePath("assets/images/tools/people.svg"),
visible: true,
hoverState: 2,
defaultState: 1,
buttonState: 1,
alpha: 0.9
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var buttonName = "PAL";
var button = tablet.addButton({
text: buttonName,
icon: "icons/tablet-icons/people-i.svg"
});
var isWired = false;
function off() {
@ -502,7 +497,7 @@ Window.domainConnectionRefused.connect(clearIgnoredInQMLAndClosePAL);
//
Script.scriptEnding.connect(function () {
button.clicked.disconnect(onClicked);
toolBar.removeButton(buttonName);
tablet.removeButton(buttonName);
pal.visibleChanged.disconnect(onVisibleChanged);
pal.closed.disconnect(off);
Users.usernameFromIDReply.disconnect(usernameFromIDReply);