Fixed idiocy not working when sound isn't initialised.

This commit is contained in:
flash 2024-01-23 02:25:49 +00:00
parent 017b720f8d
commit 1e439b87c0

View file

@ -20,8 +20,13 @@ const MamiYouAreAnIdiot = function() {
const pub = {
getElement: () => html,
onViewPush: () => {
return new Promise((resolve, reject) => {
return new Promise(resolve => {
const soundMgr = mami.getSound();
if(soundMgr === undefined || soundMgr === null) {
resolve();
return;
}
const soundSrcs = mami.getSoundLibrary().getSound('misc:youare').getSources();
soundMgr.load('youarebgm', soundSrcs, (success, buffer) => {
if(success) {
@ -32,7 +37,7 @@ const MamiYouAreAnIdiot = function() {
soundSrc.setLoop();
soundSrc.play();
resolve();
} else reject();
} else resolve();
});
});
},