This commit is contained in:
Ethan 2023-04-15 16:39:32 -05:00
parent 700b981868
commit 6c99efb228

42
js/gameBreakBeta.js Normal file
View file

@ -0,0 +1,42 @@
window.adsbygoogle = window.adsbygoogle || [];
const adBreak = adConfig = function(o) {adsbygoogle.push(o);}
adConfig({
preloadAdBreaks: 'on',
sound: 'on', // This game has sound
onReady: () => {
console.log("ready");
}, // Called when API has initialised and adBreak() is ready
});
function showNextAd()
{
console.log("showNextAd")
adBreak({
type: 'next', // ad shows at start of next level
name: 'next-game',
beforeAd: () => {
console.log("beforeAd")
passBeforeAdData()
}, // You may also want to mute thegame's sound.
afterAd: () => {
console.log("afterAd")
}, // resume the game flow.
adBreakDone: (placementInfo) => {
console.log("adBreak complete ");
adBreakDoneData()
console.log(placementInfo.breakType);
console.log(placementInfo.breakName);
console.log(placementInfo.breakFormat);
console.log(placementInfo.breakStatus);
},
});
}
function passBeforeAdData()
{
myGameInstance.SendMessage('Canvas', 'pauseGame');
}
function adBreakDoneData()
{
myGameInstance.SendMessage('Canvas', 'resumeGame');
}