1//init the interstitial 2 3var iAd; 4cpmstarAPI(function (api) { 5 //console.log("Setting iAD") 6 iAd = new api.game.InterstitialView("interstitial"); 7 iAd.load(); 8 iAd.addEventListener("ad_opened", function (e) { 9 iAdPause(); //Pause the game when ad is open 10 }); 11 12 iAd.addEventListener("ad_closed", function (e) { 13 setTimeout(function () { 14 iAdUnpause(); //Unpause when ad closed. 15 }, 700); 16 iAd.load(); //Preload another ad. 17 }); 18}); 19 20function iAdPause() { 21 22} 23function iAdUnpause() { 24 unityAdFinishedCallback() 25} 26 27 28function requestNewAd() { 29 //console.log("requested AD") 30 //console.log(iAd) 31 if (iAd && iAd.isLoaded()) { 32 iAd.show(); //Show loaded ad 33 } 34 else { 35 if (iAd) iAd.load(); //If no ad available, load another 36 unityAdFinishedCallback() 37 } 38} 39 40// This function calls Unity to tell the ad finished 41function unityAdFinishedCallback() { 42 try { 43 if (gameInstance) 44 gameInstance.SendMessage('MainMenuManagers', 'OnWebCallback'); 45 } 46 catch (error) { 47 console.log(error); 48 } 49}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.