mirror of
https://github.com/overte-org/overte.git
synced 2025-08-16 09:31:57 +02:00
Provide instructions on running the AC player script
This commit is contained in:
parent
e21e15c064
commit
afd82f09c0
3 changed files with 74 additions and 5 deletions
|
@ -7,3 +7,7 @@
|
|||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
*/
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
|
|
@ -11,10 +11,15 @@
|
|||
//
|
||||
|
||||
var isUsingToolbar = false,
|
||||
isDisplayingInstructions = false,
|
||||
numberOfPlayers = 0,
|
||||
recordingsBeingPlayed = [],
|
||||
elRecordingsPlaying,
|
||||
elRecordings,
|
||||
elInstructions,
|
||||
elPlayersUnused,
|
||||
elHideInfoButton,
|
||||
elShowInfoButton,
|
||||
elLoadButton,
|
||||
elRecordButton,
|
||||
EVENT_BRIDGE_TYPE = "record",
|
||||
|
@ -54,6 +59,7 @@ function updateRecordings() {
|
|||
recordingsBeingPlayed.sort(orderRecording);
|
||||
|
||||
tbody = document.createElement("tbody");
|
||||
tbody.id = "recordings";
|
||||
|
||||
for (i = 0, length = recordingsBeingPlayed.length; i < length; i += 1) {
|
||||
tr = document.createElement("tr");
|
||||
|
@ -82,7 +88,38 @@ function updateRecordings() {
|
|||
tbody.appendChild(tr);
|
||||
}
|
||||
|
||||
elRecordingsPlaying.replaceChild(tbody, elRecordingsPlaying.getElementsByTagName("tbody")[0]);
|
||||
elRecordingsPlaying.replaceChild(tbody, elRecordings);
|
||||
elRecordings = document.getElementById("recordings");
|
||||
}
|
||||
|
||||
function updateInstructions() {
|
||||
// Display show/hide instructions buttons if players are available.
|
||||
if (numberOfPlayers === 0) {
|
||||
elHideInfoButton.classList.add("hidden");
|
||||
elShowInfoButton.classList.add("hidden");
|
||||
} else {
|
||||
elHideInfoButton.classList.remove("hidden");
|
||||
elShowInfoButton.classList.remove("hidden");
|
||||
}
|
||||
|
||||
// Display instructions if user requested or no players available.
|
||||
if (isDisplayingInstructions || numberOfPlayers === 0) {
|
||||
elRecordings.classList.add("hidden");
|
||||
elInstructions.classList.remove("hidden");
|
||||
} else {
|
||||
elInstructions.classList.add("hidden");
|
||||
elRecordings.classList.remove("hidden");
|
||||
}
|
||||
}
|
||||
|
||||
function showInstructions() {
|
||||
isDisplayingInstructions = true;
|
||||
updateInstructions();
|
||||
}
|
||||
|
||||
function hideInstructions() {
|
||||
isDisplayingInstructions = false;
|
||||
updateInstructions();
|
||||
}
|
||||
|
||||
function updateLoadButton() {
|
||||
|
@ -101,12 +138,14 @@ function onScriptEventReceived(data) {
|
|||
recordingsBeingPlayed = JSON.parse(message.value);
|
||||
updateRecordings();
|
||||
updatePlayersUnused();
|
||||
updateInstructions();
|
||||
updateLoadButton();
|
||||
break;
|
||||
case NUMBER_OF_PLAYERS_ACTION:
|
||||
numberOfPlayers = message.value;
|
||||
updateRecordings();
|
||||
updatePlayersUnused();
|
||||
updateInstructions();
|
||||
updateLoadButton();
|
||||
break;
|
||||
}
|
||||
|
@ -118,15 +157,22 @@ function onBodyLoaded() {
|
|||
EventBridge.scriptEventReceived.connect(onScriptEventReceived);
|
||||
|
||||
elRecordingsPlaying = document.getElementById("recordings-playing");
|
||||
elRecordings = document.getElementById("recordings");
|
||||
elInstructions = document.getElementById("instructions");
|
||||
elPlayersUnused = document.getElementById("players-unused");
|
||||
|
||||
elHideInfoButton = document.getElementById("hide-info-button");
|
||||
elHideInfoButton.onclick = hideInstructions;
|
||||
elShowInfoButton = document.getElementById("show-info-button");
|
||||
elShowInfoButton.onclick = showInstructions;
|
||||
|
||||
elLoadButton = document.getElementById("load-button");
|
||||
elLoadButton.onclick = function () {
|
||||
EventBridge.emitWebEvent(JSON.stringify({
|
||||
type: EVENT_BRIDGE_TYPE,
|
||||
action: LOAD_RECORDING_ACTION
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
elRecordButton = document.getElementById("record-button");
|
||||
elRecordButton.onclick = function () {
|
||||
|
@ -134,7 +180,7 @@ function onBodyLoaded() {
|
|||
type: EVENT_BRIDGE_TYPE,
|
||||
action: START_RECORDING_ACTION
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
EventBridge.emitWebEvent(JSON.stringify({
|
||||
type: EVENT_BRIDGE_TYPE,
|
||||
|
|
|
@ -27,11 +27,30 @@
|
|||
<th>Unload</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tbody id="recordings">
|
||||
</tbody>
|
||||
<tbody id="instructions" class="hidden">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<p>
|
||||
If you're in your own sandbox or are a domain administrator:<br />
|
||||
Right-click the High Fidelity Sandbox icon in your system tray <br />and click "Settings".<br />
|
||||
In the "Scripts" section add a new Script URL, <br />playRecordingAC.js, and set # instances to 1 or more.<br />
|
||||
Click "Save and restart".<br />
|
||||
Now you can play recordings in the domain!
|
||||
</p>
|
||||
<p>
|
||||
<input id="hide-info-button" type="button" value="OK" />
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td id="footer-text" colspan="2">Number of available instances: <span id="players-unused"></span></td>
|
||||
<td id="footer-text" colspan="2">
|
||||
Number of available instances: <span id="players-unused"></span>
|
||||
<input id="show-info-button" type="button" value="i" />
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
|
Loading…
Reference in a new issue