mirror of
				https://github.com/tobspr/shapez.io.git
				synced 2025-06-13 13:04:03 +00:00 
			
		
		
		
	Fix ad provider
This commit is contained in:
		
							parent
							
								
									f61f25934f
								
							
						
					
					
						commit
						4546ca63c1
					
				@ -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.
 | 
			
		||||
 | 
			
		||||
@ -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"));
 | 
			
		||||
            });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
                        });
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user