blob: a545c979f610cd144989bf2efec04b63cee28b1a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
import { Testimony } from "../interfaces/Testimony";
import { client, UPDATE_INTERVAL } from "../../client";
/**
* Intialize testimony updater
*/
export const initTestimonyUpdater = () => {
const testimonyFilenames: Testimony = {
1: "witnesstestimony",
2: "crossexamination",
3: "notguilty",
4: "guilty",
};
const testimony = testimonyFilenames[client.testimonyID];
if (!testimony) {
console.warn(`Invalid testimony ID ${client.testimonyID}`);
return;
}
client.viewport.testimonyAudio.src = client.resources[testimony].sfx;
client.viewport.testimonyAudio.play().catch(() => {});
const testimonyOverlay = <HTMLImageElement>(
document.getElementById("client_testimony")
);
testimonyOverlay.src = client.resources[testimony].src;
testimonyOverlay.style.opacity = "1";
client.viewport.setTestimonyTimer(0);
client.viewport.setTestimonyUpdater(
setTimeout(() => client.viewport.updateTestimony(), UPDATE_INTERVAL),
);
};
|