Merge pull request #999 from digisomni/feature/onboarding-config

Add onboarding configuration wizard to tutorial serverless
This commit is contained in:
Kalila 2021-02-25 20:49:22 -05:00 committed by GitHub
commit 14292a042b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 103 additions and 18 deletions

View file

@ -112,8 +112,7 @@ MessageBox {
popup.button1text = 'CANCEL'
popup.titleText = 'Get Avatars'
popup.bodyText = 'Get avatars from <b><a href="app://marketplace">Marketplace.</a></b>' + '<br/>' +
'Wear avatars in <b><a href="app://purchases">Inventory.</a></b>'
popup.bodyText = 'Get avatars from the Community Bazaar. (Coming soon!)'
popup.onLinkClicked = function(link) {
popup.close();

View file

@ -4,6 +4,56 @@
"/": "/0.155245,-0.941538,23.9289/0,0.791589,0,0.611053"
},
"Entities": [
{
"id": "{0a199807-4a83-4286-b09c-f21124627c3e}",
"type": "Box",
"name": "Config Wizard Loader",
"lastEdited": 1613737207915514,
"visible": false,
"position": {
"x": -1.2722,
"y": 0.4266,
"z": 24.2307
},
"dimensions": {
"x": 0.20000000298023224,
"y": 0.20000000298023224,
"z": 0.20000000298023224
},
"rotation": {
"x": 0,
"y": -0.7660443782806396,
"z": 0,
"w": -0.6427876949310303
},
"created": 1613736996738696,
"lastEditedBy": "{ff9b500e-e450-4127-b41f-1c42be16f71b}",
"queryAACube": {
"x": -0.17320507764816284,
"y": -0.17320507764816284,
"z": -0.17320507764816284,
"scale": 0.3464101552963257
},
"grab": {
"grabbable": false
},
"damping": 0,
"angularDamping": 0,
"collisionless": true,
"ignoreForCollisions": true,
"script": "https://cdn-1.vircadia.com/us-e-1/DomainContent/Tutorial/Apps/configWizard/dist/wizardLoader.js",
"color": {
"red": 0,
"green": 180,
"blue": 239
},
"shape": "Cube",
"clientOnly": false,
"avatarEntity": false,
"localEntity": false,
"faceCamera": false,
"isFacingAvatar": false
},
{
"id": "{eb485a2d-2040-42f6-a960-51c88e2434b9}",
"type": "Box",

View file

@ -36,6 +36,7 @@ var DEFAULT_SCRIPTS_COMBINED = [
"system/inspect.js",
"system/keyboardShortcuts/keyboardShortcuts.js",
"system/checkForUpdates.js",
"system/onEscape.js",
"system/onFirstRun.js",
"system/appreciate/appreciate_app.js"
];

View file

@ -3,10 +3,9 @@
//
// away.js
//
// examples
//
// Created by Howard Stearns 11/3/15
// Copyright 2015 High Fidelity, Inc.
// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@ -255,17 +254,6 @@ function setActiveProperties() {
Script.clearInterval(avatarMovedInterval);
}
function maybeGoActive(event) {
if (event.isAutoRepeat) { // isAutoRepeat is true when held down (or when Windows feels like it)
return;
}
if (!isAway && (event.text === 'ESC')) {
goAway();
} else {
goActive();
}
}
var wasHmdActive = HMD.active;
var wasMouseCaptured = Reticle.mouseCaptured;
@ -329,12 +317,24 @@ var CHANNEL_AWAY_ENABLE = "Hifi-Away-Enable";
var handleMessage = function(channel, message, sender) {
if (channel === CHANNEL_AWAY_ENABLE && sender === MyAvatar.sessionUUID) {
print("away.js | Got message on Hifi-Away-Enable: ", message);
setEnabled(message === 'enable');
if (message === 'enable') {
setEnabled(true);
} else if (message === 'toggle') {
toggleAway();
}
}
};
Messages.subscribe(CHANNEL_AWAY_ENABLE);
Messages.messageReceived.connect(handleMessage);
function toggleAway() {
if (!isAway) {
goAway();
} else {
goActive();
}
}
var maybeIntervalTimer = Script.setInterval(function() {
maybeMoveOverlay();
maybeGoAway();
@ -343,7 +343,6 @@ var maybeIntervalTimer = Script.setInterval(function() {
Controller.mousePressEvent.connect(goActive);
Controller.keyPressEvent.connect(maybeGoActive);
// Note peek() so as to not interfere with other mappings.
eventMapping.from(Controller.Standard.LeftPrimaryThumb).peek().to(goActive);
eventMapping.from(Controller.Standard.RightPrimaryThumb).peek().to(goActive);
@ -371,7 +370,6 @@ Script.scriptEnding.connect(function () {
HMD.awayStateWhenFocusLostInVRChanged.disconnect(awayStateWhenFocusLostInVRChanged);
Controller.disableMapping(eventMappingName);
Controller.mousePressEvent.disconnect(goActive);
Controller.keyPressEvent.disconnect(maybeGoActive);
Messages.messageReceived.disconnect(handleMessage);
Messages.unsubscribe(CHANNEL_AWAY_ENABLE);
});

View file

@ -0,0 +1,34 @@
'use strict';
//
// onEscape.js
//
// Created by Kalila L. on Feb 3 2021.
// Copyright 2021 Vircadia contributors.
//
// This script manages actions when the user triggers an "escape" key or action.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
(function() { // BEGIN LOCAL_SCOPE
function maybeEscapeKeyPressed (event) {
if (event.isAutoRepeat) { // isAutoRepeat is true when held down (or when Windows feels like it)
return;
}
if (event.text === 'ESC') {
var CHANNEL_AWAY_ENABLE = 'Hifi-Away-Enable';
Messages.sendMessage(CHANNEL_AWAY_ENABLE, 'toggle', true);
}
}
Controller.keyPressEvent.connect(maybeEscapeKeyPressed);
Script.scriptEnding.connect(function () {
Controller.keyPressEvent.disconnect(maybeEscapeKeyPressed);
});
}());

View file

@ -13,6 +13,7 @@
//
(function() { // BEGIN LOCAL_SCOPE
// Check to see if we should run this script or bail...
var SETTING_TO_CHECK = 'firstRun';
var DEFAULT_DISPLAY_NAME = '';
@ -20,6 +21,8 @@
return;
}
// If this is our first run, then proceed...
if (MyAvatar.displayName === '') {
var selectedDisplayName = Window.prompt('Enter a display name.', MyAvatar.displayName);