blob: e6f6e9d2c3635b813486285086f1ac81bae9eabf (
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
|
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();
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));
};
|