Revert onFirstRun.js to its original state.

This commit is contained in:
Kalila L 2021-02-19 07:42:01 -05:00
parent 01b65d134a
commit e296ea0b70

View file

@ -15,64 +15,21 @@
(function() { // BEGIN LOCAL_SCOPE
// Check to see if we should run this script or bail...
var SETTING_TO_CHECK = 'firstRun';
var DEFAULT_DISPLAY_NAME = '';
if (!Settings.getValue(SETTING_TO_CHECK, false)) {
return;
}
// If this is our first run then proceed...
var configWizardEntityID;
var DEFAULT_DISPLAY_NAME = '';
// If this is our first run, then proceed...
if (!PlatformInfo.has3DHTML()) {
if (MyAvatar.displayName === '') {
var selectedDisplayName = Window.prompt('Enter a display name.', MyAvatar.displayName);
setDisplayName(selectedDisplayName);
}
} else {
configWizardEntityID = Entities.addEntity({
type: 'Web',
sourceUrl: Script.resolvePath("./configWizard/dist/index.html"),
maxFPS: 60,
dpi: 20,
useBackground: false,
grab: {
grabbable: false
},
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -2.25 })),
rotation: MyAvatar.orientation,
dimensions: { x: 1.4, y: 0.75, z: 0 }
}, 'local');
if (MyAvatar.displayName === '') {
var selectedDisplayName = Window.prompt('Enter a display name.', MyAvatar.displayName);
Entities.webEventReceived.connect(onWebAppEventReceived);
}
function setDisplayName(displayName) {
if (displayName === '') {
if (selectedDisplayName === '') {
MyAvatar.displayName = DEFAULT_DISPLAY_NAME;
} else {
MyAvatar.displayName = displayName;
MyAvatar.displayName = selectedDisplayName;
}
}
function onWebAppEventReceived(sendingEntityID, event) {
if (sendingEntityID === configWizardEntityID) {
var eventJSON = JSON.parse(event);
if (eventJSON.command === "complete-wizard") {
Performance.setPerformancePreset(eventJSON.data.performancePreset);
Performance.setRefreshRateProfile(eventJSON.data.refreshRateProfile);
setDisplayName(eventJSON.data.displayName);
Entities.deleteEntity(configWizardEntityID);
Entities.webEventReceived.disconnect(onWebAppEventReceived);
}
}
}
Script.scriptEnding.connect(function () {
if (configWizardEntityID) {
Entities.deleteEntity(configWizardEntityID);
Entities.webEventReceived.disconnect(onWebAppEventReceived);
}
});
}());