Merge pull request #14284 from ctrlaltdavid/M19404

Fix interstitial page not displaying at Interface start-up
This commit is contained in:
Brad Hefta-Gaub 2018-11-13 10:38:38 -08:00 committed by GitHub
commit 63e52ba8bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 14 deletions

View file

@ -41,6 +41,8 @@
* <em>Read-only.</em>
* @property {number} y - The y display coordinate of the top left corner of the drawable area of the Interface window.
* <em>Read-only.</em>
* @property {boolean} interstitialModeEnabled=true - <code>true</code> if the interstitial graphics are displayed when the
* domain is loading, otherwise <code>false</code>.
*/
class WindowScriptingInterface : public QObject, public Dependency {
@ -620,9 +622,10 @@ signals:
void redirectErrorStateChanged(bool isInErrorState);
/**jsdoc
* Triggered when interstitial mode changes.
* Triggered when the interstitial mode changes.
* @function Window.interstitialModeChanged
* @param {bool} interstitialMode - The mode of the interstitial is changed to.
* @param {bool} interstitialMode - The new interstitial mode value. If <code>true</code>, the interstitial graphics are
* displayed when the domain is loading.
* @returns {Signal}
*/
void interstitialModeChanged(bool interstitialMode);

View file

@ -40,8 +40,8 @@ var DEFAULT_SCRIPTS_SEPARATE = [
];
if (Window.interstitialModeEnabled) {
DEFAULT_SCRIPTS_COMBINED.push("system/interstitialPage.js");
DEFAULT_SCRIPTS_COMBINED.push("system/redirectOverlays.js");
// Insert interstitial scripts at front so that they're started first.
DEFAULT_SCRIPTS_COMBINED.splice(0, 0, "system/interstitialPage.js", "system/redirectOverlays.js");
}
// add a menu item for debugging

View file

@ -62,11 +62,23 @@
var DEFAULT_DIMENSIONS = { x: 24, y: 24, z: 24 };
var BLACK_SPHERE = Script.resolvePath("/~/system/assets/models/black-sphere.fbx");
var BUTTON = Script.resourcesPath() + "images/interstitialPage/button.png";
var BUTTON_HOVER = Script.resourcesPath() + "images/interstitialPage/button_hover.png";
var LOADING_BAR_PLACARD = Script.resourcesPath() + "images/loadingBar_placard.png";
var LOADING_BAR_PROGRESS = Script.resourcesPath() + "images/loadingBar_progress.png";
ModelCache.prefetch(BLACK_SPHERE);
TextureCache.prefetch(BUTTON);
TextureCache.prefetch(BUTTON_HOVER);
TextureCache.prefetch(LOADING_BAR_PLACARD);
TextureCache.prefetch(LOADING_BAR_PROGRESS);
var loadingSphereID = Overlays.addOverlay("model", {
name: "Loading-Sphere",
position: Vec3.sum(Vec3.sum(MyAvatar.position, { x: 0.0, y: -1.0, z: 0.0 }), Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0.95, z: 0 })),
orientation: Quat.multiply(Quat.fromVec3Degrees({ x: 0, y: 180, z: 0 }), MyAvatar.orientation),
url: Script.resolvePath("/~/system/assets/models/black-sphere.fbx"),
url: BLACK_SPHERE,
dimensions: DEFAULT_DIMENSIONS,
alpha: 1,
visible: isVisible,
@ -157,7 +169,7 @@
var loadingToTheSpotID = Overlays.addOverlay("image3d", {
name: "Loading-Destination-Card-GoTo-Image",
localPosition: { x: 0.0, y: -1.75, z: -0.3 },
url: Script.resourcesPath() + "images/interstitialPage/button.png",
url: BUTTON,
alpha: 1,
visible: isVisible,
emissive: true,
@ -171,7 +183,7 @@
var loadingToTheSpotHoverID = Overlays.addOverlay("image3d", {
name: "Loading-Destination-Card-GoTo-Image-Hover",
localPosition: { x: 0.0, y: -1.75, z: -0.3 },
url: Script.resourcesPath() + "images/interstitialPage/button_hover.png",
url: BUTTON_HOVER,
alpha: 1,
visible: false,
emissive: true,
@ -186,7 +198,7 @@
var loadingBarProgress = Overlays.addOverlay("image3d", {
name: "Loading-Bar-Progress",
localPosition: { x: 0.0, y: -0.86, z: 0.0 },
url: Script.resourcesPath() + "images/loadingBar_progress.png",
url: LOADING_BAR_PROGRESS,
alpha: 1,
dimensions: { x: TOTAL_LOADING_PROGRESS, y: 0.3},
visible: isVisible,
@ -202,7 +214,7 @@
var loadingBarPlacard = Overlays.addOverlay("image3d", {
name: "Loading-Bar-Placard",
localPosition: { x: 0.0, y: -0.99, z: 0.4 },
url: Script.resourcesPath() + "images/loadingBar_placard.png",
url: LOADING_BAR_PLACARD,
alpha: 1,
dimensions: { x: 4, y: 2.8 },
visible: isVisible,
@ -273,12 +285,21 @@
}
}
function restartAudio() {
tune.ready.disconnect(restartAudio);
startAudio();
}
function startAudio() {
sample = Audio.playSound(tune, {
localOnly: true,
position: MyAvatar.getHeadPosition(),
volume: VOLUME
});
if (tune.downloaded) {
sample = Audio.playSound(tune, {
localOnly: true,
position: MyAvatar.getHeadPosition(),
volume: VOLUME
});
} else {
tune.ready.connect(restartAudio);
}
}
function endAudio() {
@ -614,5 +635,11 @@
}
}
// location.hostname may already be set by the time the script is loaded.
// Show the interstitial page if the domain isn't loaded.
if (!location.isConnected) {
domainChanged(location.hostname);
}
Script.scriptEnding.connect(cleanup);
}());