content/hifi-content/caitlyn/dev/scratch/unityUITests/index.html
2022-02-13 22:19:19 +01:00

84 lines
3.3 KiB
HTML

<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Unity WebGL Player | New Unity Project</title>
<link rel="stylesheet" href="TemplateData/style.css">
<link rel="shortcut icon" href="TemplateData/favicon.ico" />
<script src="./webBridgeTest_files/jquery-1.11.1.min.js.download"></script>
<script src="./webBridgeTest_files/jquery.mobile-1.4.5.min.js.download"></script>
<!----- BEGIN PASTE --->
<script>
$(document).ready(function () {
// hook up a handler for events that come from hifi.
EventBridge.scriptEventReceived.connect(function (msg) { // GET MESSAGES FROM HIFI
console.log("WEB: recv script event = " + JSON.stringify(msg));
if (msg === "button-1-done") { // Send a message to Unity that it was successfully played
// re-enable the button now that the audio is complete
$("#button-1").removeClass("ui-disabled"); // Replace with a message for Unity
} else if (msg === "button-2-done") {
// re-enable the button now that the audio is complete
$("#button-2").removeClass("ui-disabled");
}
});
// hook up a click handler for button-1
$("#button-1").click(function () { // SEND MESSAGES TO HIGH FIDELITY
// OK so it looks like this function is maybe evaluated? I still don't understand where eventbridge is gcreated or the emitWebEvent thing lives.
console.log("WEB: emit web event = " + JSON.stringify("button-1-play"));
// disable the button until we receive a done message.
$("#button-1").addClass("ui-disabled");
// send a play event to hifi
EventBridge.emitWebEvent("button-1-play"); // WHENCE DO EMIT WEB EVENT COME?
});
// hook up a click handler for button-2
$("#button-2").click(function () {
console.log("WEB: emit web event = " + JSON.stringify("button-2-play"));
// disable the button until we receive a done message.
$("#button-2").addClass("ui-disabled");
// send a play event to hifi
EventBridge.emitWebEvent("button-2-play");
});
});
<!----- END PASTE --->
<script src="TemplateData/UnityProgress.js"></script>
</head>
<body class="template">
<div class="template-wrap clear">
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()" height="1024px" width="768px"></canvas>
<br>
<div class="logo"></div>
<div class="fullscreen"><img src="TemplateData/fullscreen.png" width="38" height="38" alt="Fullscreen" title="Fullscreen" onclick="SetFullscreen(1);" /></div>
<div class="title">New Unity Project</div>
</div>
<script type='text/javascript'>
var Module = {
TOTAL_MEMORY: 268435456,
errorhandler: null, // arguments: err, url, line. This function must return 'true' if the error is handled, otherwise 'false'
compatibilitycheck: null,
backgroundColor: "#80858B",
splashStyle: "Dark",
dataUrl: "Release/unityUITests.data",
codeUrl: "Release/unityUITests.js",
asmUrl: "Release/unityUITests.asm.js",
memUrl: "Release/unityUITests.mem",
};
</script>
<script src="Release/UnityLoader.js"></script>
</body>
</html>