Fixed idiocy not working when sound isn't initialised.
This commit is contained in:
parent
017b720f8d
commit
1e439b87c0
1 changed files with 7 additions and 2 deletions
|
@ -20,8 +20,13 @@ const MamiYouAreAnIdiot = function() {
|
||||||
const pub = {
|
const pub = {
|
||||||
getElement: () => html,
|
getElement: () => html,
|
||||||
onViewPush: () => {
|
onViewPush: () => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise(resolve => {
|
||||||
const soundMgr = mami.getSound();
|
const soundMgr = mami.getSound();
|
||||||
|
if(soundMgr === undefined || soundMgr === null) {
|
||||||
|
resolve();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const soundSrcs = mami.getSoundLibrary().getSound('misc:youare').getSources();
|
const soundSrcs = mami.getSoundLibrary().getSound('misc:youare').getSources();
|
||||||
soundMgr.load('youarebgm', soundSrcs, (success, buffer) => {
|
soundMgr.load('youarebgm', soundSrcs, (success, buffer) => {
|
||||||
if(success) {
|
if(success) {
|
||||||
|
@ -32,7 +37,7 @@ const MamiYouAreAnIdiot = function() {
|
||||||
soundSrc.setLoop();
|
soundSrc.setLoop();
|
||||||
soundSrc.play();
|
soundSrc.play();
|
||||||
resolve();
|
resolve();
|
||||||
} else reject();
|
} else resolve();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue