mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 12:23:24 +02:00
Remove countdown overlays
This commit is contained in:
parent
afd82f09c0
commit
c369b1314a
1 changed files with 3 additions and 89 deletions
|
@ -38,113 +38,28 @@
|
|||
}
|
||||
|
||||
CountdownTimer = (function () {
|
||||
// Displays countdown overlay.
|
||||
|
||||
// Counts down a few seconds.
|
||||
var countdownTimer,
|
||||
countdownSeconds,
|
||||
COUNTDOWN_SECONDS = 3,
|
||||
finishCallback,
|
||||
isHMD = false,
|
||||
desktopOverlay,
|
||||
desktopOverlayAdjust,
|
||||
DESKTOP_FONT_SIZE = 200,
|
||||
hmdOverlay,
|
||||
HMD_FONT_SIZE = 0.25;
|
||||
|
||||
function displayOverlay() {
|
||||
// Create both overlays in case user switches desktop/HMD mode during countdown.
|
||||
var screenSize = Controller.getViewportDimensions(),
|
||||
AVATAR_SELF_ID = "{00000000-0000-0000-0000-000000000001}";
|
||||
|
||||
isHMD = HMD.active;
|
||||
|
||||
desktopOverlayAdjust = { // Adjust overlay position to cater to font rendering.
|
||||
x: -DESKTOP_FONT_SIZE / 4,
|
||||
y: -DESKTOP_FONT_SIZE / 2 - 50
|
||||
|
||||
};
|
||||
|
||||
desktopOverlay = Overlays.addOverlay("text", {
|
||||
text: countdownSeconds,
|
||||
width: DESKTOP_FONT_SIZE,
|
||||
height: DESKTOP_FONT_SIZE + 20,
|
||||
x: screenSize.x / 2 + desktopOverlayAdjust.x,
|
||||
y: screenSize.y / 2 + desktopOverlayAdjust.y,
|
||||
font: { size: DESKTOP_FONT_SIZE },
|
||||
color: { red: 255, green: 255, blue: 255 },
|
||||
alpha: 0.9,
|
||||
backgroundAlpha: 0,
|
||||
visible: !isHMD
|
||||
});
|
||||
|
||||
hmdOverlay = Overlays.addOverlay("text3d", {
|
||||
text: countdownSeconds,
|
||||
dimensions: { x: HMD_FONT_SIZE, y: HMD_FONT_SIZE },
|
||||
parentID: AVATAR_SELF_ID,
|
||||
localPosition: { x: 0, y: 0.6, z: 2.0 },
|
||||
color: { red: 255, green: 255, blue: 255 },
|
||||
alpha: 0.9,
|
||||
lineHeight: HMD_FONT_SIZE,
|
||||
backgroundAlpha: 0,
|
||||
ignoreRayIntersection: true,
|
||||
isFacingAvatar: true,
|
||||
drawInFront: true,
|
||||
visible: isHMD
|
||||
});
|
||||
}
|
||||
|
||||
function updateOverlay() {
|
||||
var screenSize;
|
||||
|
||||
if (isHMD !== HMD.active) {
|
||||
if (isHMD) {
|
||||
Overlays.editOverlay(hmdOverlay, { visible: false });
|
||||
} else {
|
||||
Overlays.editOverlay(desktopOverlay, { visible: false });
|
||||
}
|
||||
isHMD = HMD.active;
|
||||
}
|
||||
|
||||
if (isHMD) {
|
||||
Overlays.editOverlay(hmdOverlay, {
|
||||
text: countdownSeconds,
|
||||
visible: true
|
||||
});
|
||||
} else {
|
||||
screenSize = Controller.getViewportDimensions();
|
||||
Overlays.editOverlay(desktopOverlay, {
|
||||
x: screenSize.x / 2 + desktopOverlayAdjust.x,
|
||||
y: screenSize.y / 2 + desktopOverlayAdjust.y,
|
||||
text: countdownSeconds,
|
||||
visible: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function deleteOverlay() {
|
||||
Overlays.deleteOverlay(desktopOverlay);
|
||||
Overlays.deleteOverlay(hmdOverlay);
|
||||
}
|
||||
finishCallback;
|
||||
|
||||
function start(onFinishCallback) {
|
||||
finishCallback = onFinishCallback;
|
||||
countdownSeconds = COUNTDOWN_SECONDS;
|
||||
displayOverlay();
|
||||
countdownTimer = Script.setInterval(function () {
|
||||
countdownSeconds -= 1;
|
||||
if (countdownSeconds <= 0) {
|
||||
Script.clearInterval(countdownTimer);
|
||||
deleteOverlay();
|
||||
finishCallback();
|
||||
} else {
|
||||
updateOverlay();
|
||||
// TODO: Tick.
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
Script.clearInterval(countdownTimer);
|
||||
deleteOverlay();
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -217,7 +132,6 @@
|
|||
|
||||
Recorder = (function () {
|
||||
// Makes the recording and uploads it to the domain's Asset Server.
|
||||
|
||||
var IDLE = 0,
|
||||
COUNTING_DOWN = 1,
|
||||
RECORDING = 2,
|
||||
|
|
Loading…
Reference in a new issue