diff --git a/src/js/core/game_state.js b/src/js/core/game_state.js index cee962f5..b08bef77 100644 --- a/src/js/core/game_state.js +++ b/src/js/core/game_state.js @@ -91,26 +91,6 @@ export class GameState { } } - /** - * - * @param {string} nextStateId - * @param {object=} nextStatePayload - */ - watchAdAndMoveToState(nextStateId, nextStatePayload = {}) { - if (this.app.adProvider.getCanShowVideoAd() && this.app.isRenderable()) { - this.moveToState( - "WatchAdState", - { - nextStateId, - nextStatePayload, - }, - true - ); - } else { - this.moveToState(nextStateId, nextStatePayload); - } - } - /** * Tracks clicks on a given element and calls the given callback *on this state*. * If you want to call another function wrap it inside a lambda. diff --git a/src/js/platform/ad_providers/gamedistribution.js b/src/js/platform/ad_providers/gamedistribution.js index 6ff031f0..5a91646f 100644 --- a/src/js/platform/ad_providers/gamedistribution.js +++ b/src/js/platform/ad_providers/gamedistribution.js @@ -95,6 +95,10 @@ export class GamedistributionAdProvider extends AdProviderInterface { document.body.classList.add("externalAdOpen"); + logger.log("Set sound volume to 0"); + this.app.sound.setMusicVolume(0); + this.app.sound.setSoundVolume(0); + return new Promise(resolve => { // So, wait for the remove call but also remove after N seconds this.videoAdResolveFunction = () => { @@ -119,6 +123,11 @@ export class GamedistributionAdProvider extends AdProviderInterface { }) .then(() => { document.body.classList.remove("externalAdOpen"); + + logger.log("Restored sound volume"); + + this.app.sound.setMusicVolume(this.app.settings.getSetting("musicVolume")); + this.app.sound.setSoundVolume(this.app.settings.getSetting("soundVolume")); }); } } diff --git a/src/js/states/preload.js b/src/js/states/preload.js index b0dbda86..dd44970a 100644 --- a/src/js/states/preload.js +++ b/src/js/states/preload.js @@ -81,9 +81,11 @@ export class PreloadState extends GameState { } catch (ex) { logger.error("Failed to read/write local storage:", ex); return new Promise(() => { - alert(`Your brower does not support thirdparty cookies or you have disabled it in your security settings.\n\n - In Chrome this setting is called "Block third-party cookies and site data".\n\n - Please allow third party cookies and then reload the page.`); + alert( + "Your brower does not support thirdparty cookies or you have disabled it in your security settings.\n\n" + + "In Chrome this setting is called 'Block third-party cookies and site data'.\n\n" + + "Please allow third party cookies and then reload the page." + ); // Never return }); }