ed
This commit is contained in:
parent
159fe87e92
commit
f19fdc73e6
31 changed files with 3271 additions and 0 deletions
32
resources/[housing]/renzu_motels/data/script.js
Normal file
32
resources/[housing]/renzu_motels/data/script.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
function playsound(table) {
|
||||
var file = table['file']
|
||||
var volume = table['volume']
|
||||
var audioPlayer = null;
|
||||
if (audioPlayer != null) {
|
||||
audioPlayer.pause();
|
||||
}
|
||||
if (volume == undefined) {
|
||||
volume = 0.2
|
||||
}
|
||||
audioPlayer = new Audio("./audio/" + file + ".ogg");
|
||||
audioPlayer.volume = volume;
|
||||
audioPlayer.play();
|
||||
}
|
||||
|
||||
window.addEventListener('message', function(event) {
|
||||
var data = event.data;
|
||||
if (event.data.type == 'playsound') {
|
||||
playsound(event.data.content)
|
||||
}
|
||||
if (event.data.type == 'door') {
|
||||
document.getElementById('door').innerHTML = `
|
||||
<video autoplay id="myVideo">
|
||||
<source src="audio/door.mp4" type="video/mp4">
|
||||
</video>
|
||||
`
|
||||
setTimeout(function() {
|
||||
document.getElementById('door').innerHTML = ''
|
||||
}, 7000)
|
||||
}
|
||||
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue