frontend/basketrandom/index.html
2023-12-04 18:29:05 -05:00

145 lines
4.4 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Basket Random</title>
<script src="/js/all.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<meta name="generator" content="Scirra Construct">
<meta name="author" content="RHM Interactive">
<meta name="description" content="Basket Random - Twoplayergames.org">
<link rel="manifest" href="appmanifest.json">
<link rel="stylesheet" href="style.css">
<script>
window.addEventListener("keydown", function(e) {
// space and arrow keys
if([32, 37, 38, 39, 40].indexOf(e.keyCode) > -1) {
e.preventDefault();
}
}, false);
</script>
<script>
function initSDK() {
// Game start logic
let adConfigPromise =
new Promise((resolve, reject) => adConfig({
preloadAdBreaks: 'on',
onReady: () => resolve(true)
}));
let timeoutPromise =
new Promise((resolve, reject) => {
setTimeout(() => {
console.log("Ad timeout");
resolve(false);
}, 2000);
});
// Whatever happens first resolves this promise.
Promise.race([
adConfigPromise,
timeoutPromise
]).then((shouldShowPreRoll) => {
if (shouldShowPreRoll) {
showPreRoll();
} else {
c3_callFunction("startGame");
}
});
}
function showPreRoll() {
// Show ad
// adBreak({
// type: 'start',
// adBreakDone: function() {
c3_callFunction("startGame");
// }, // always called, unblocks the game logic
//});
}
</script>
<script>
function CallInterstitialAds()
{
adBreak({
type: 'next',
name: 'restart-game',
beforeAd: () => {
console.log("Ad Started!");
c3_callFunction("adStarted");
},
afterAd: () => {
c3_callFunction("onClose");
console.log("After Ad Finished");
},
adBreakDone: () => {
console.log('adBreakDone');
c3_callFunction("onClose");
}
});
}
var rewardReadyShowAds = null;
function CallRewardedAds()
{
adBreak({
type: "reward",
name: "test-reward",
beforeReward: (showAdFn) => {
rewardReadyShowAds = showAdFn;
if(this.rewardReadyShowAds)
{
c3_callFunction("adStarted");
c3_runtimeInterface._GetLocalRuntime().SetSuspended(true);
this.rewardReadyShowAds();
}
},
adViewed: () => {
rewardReadyShowAds = null;
c3_runtimeInterface._GetLocalRuntime().SetSuspended(false);
c3_callFunction("onClose");
c3_callFunction("OnRewardedCompleted");
// ad viewed, resume the game!
},
adDismissed: () => {
rewardReadyShowAds = null;
c3_runtimeInterface._GetLocalRuntime().SetSuspended(false);
c3_callFunction("onClose");
// ad dismissed, go to the Home screen
}
});
}
</script>
</head>
<body>
<script>
if (location.protocol.substr(0, 4) === "file")
{
alert("Web exports won't work until you upload them. (When running on the file: protocol, browsers block many features from working for security reasons.)");
}
</script>
<script src="box2d.wasm.js"></script>
<noscript>
<div id="notSupportedWrap">
<h2 id="notSupportedTitle">This content requires JavaScript</h2>
<p class="notSupportedMessage">JavaScript appears to be disabled. Please enable it to view this content.</p>
</div>
</noscript>
<script src="scripts/supportcheck.js"></script>
<script src="scripts/offlineclient.js" type="module"></script>
<script src="scripts/main.js" type="module"></script>
<script src="scripts/register-sw.js" type="module"></script>
</body>
</html>