mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-23 19:04:29 +02:00
Reset player details when domain restarts or user teleports
This commit is contained in:
parent
7dddd266ba
commit
8bbce53f74
1 changed files with 26 additions and 0 deletions
|
@ -19,6 +19,7 @@
|
||||||
isDialogDisplayed = false,
|
isDialogDisplayed = false,
|
||||||
tablet,
|
tablet,
|
||||||
button,
|
button,
|
||||||
|
isConnected,
|
||||||
|
|
||||||
CountdownTimer,
|
CountdownTimer,
|
||||||
RecordingIndicator,
|
RecordingIndicator,
|
||||||
|
@ -436,6 +437,14 @@
|
||||||
Dialog.updatePlayerDetails(playerIsPlayings, playerRecordings, playerIDs);
|
Dialog.updatePlayerDetails(playerIsPlayings, playerRecordings, playerIDs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function reset() {
|
||||||
|
playerIDs = [];
|
||||||
|
playerIsPlayings = [];
|
||||||
|
playerRecordings = [];
|
||||||
|
playerTimestamps = [];
|
||||||
|
Dialog.updatePlayerDetails(playerIsPlayings, playerRecordings, playerIDs);
|
||||||
|
}
|
||||||
|
|
||||||
function setUp() {
|
function setUp() {
|
||||||
// Messaging with AC scripts.
|
// Messaging with AC scripts.
|
||||||
Messages.messageReceived.connect(onMessageReceived);
|
Messages.messageReceived.connect(onMessageReceived);
|
||||||
|
@ -455,6 +464,7 @@
|
||||||
playRecording: playRecording,
|
playRecording: playRecording,
|
||||||
stopPlayingRecording: stopPlayingRecording,
|
stopPlayingRecording: stopPlayingRecording,
|
||||||
numberOfPlayers: numberOfPlayers,
|
numberOfPlayers: numberOfPlayers,
|
||||||
|
reset: reset,
|
||||||
setUp: setUp,
|
setUp: setUp,
|
||||||
tearDown: tearDown
|
tearDown: tearDown
|
||||||
};
|
};
|
||||||
|
@ -584,6 +594,17 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onUpdate() {
|
||||||
|
if (isConnected !== Window.location.isConnected) {
|
||||||
|
// Server restarted or domain changed.
|
||||||
|
isConnected = !isConnected;
|
||||||
|
if (!isConnected) {
|
||||||
|
// Clear dialog.
|
||||||
|
Player.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function setUp() {
|
function setUp() {
|
||||||
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
if (!tablet) {
|
if (!tablet) {
|
||||||
|
@ -606,6 +627,9 @@
|
||||||
Dialog.setUp();
|
Dialog.setUp();
|
||||||
Player.setUp();
|
Player.setUp();
|
||||||
Recorder.setUp(Player.playRecording);
|
Recorder.setUp(Player.playRecording);
|
||||||
|
|
||||||
|
isConnected = Window.location.isConnected;
|
||||||
|
Script.update.connect(onUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
function tearDown() {
|
function tearDown() {
|
||||||
|
@ -613,6 +637,8 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Script.update.disconnect(onUpdate);
|
||||||
|
|
||||||
Recorder.tearDown();
|
Recorder.tearDown();
|
||||||
Player.tearDown();
|
Player.tearDown();
|
||||||
Dialog.tearDown();
|
Dialog.tearDown();
|
||||||
|
|
Loading…
Reference in a new issue