mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-03-02 03:39:21 +00:00
Prepare for the release on gamedistribution
This commit is contained in:
85
artwork/gamedistribution/iframe/index.html
Normal file
85
artwork/gamedistribution/iframe/index.html
Normal file
@@ -0,0 +1,85 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>shapez.io</title>
|
||||
<script type="text/javascript">
|
||||
function postToGameFrame(msg) {
|
||||
var handle = document.getElementById("gameframe");
|
||||
if (handle) {
|
||||
handle.contentWindow.postMessage(msg, "*");
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener("message", function (event) {
|
||||
if (event.data === "shapezio://gd.game_loaded") {
|
||||
console.log("Game loaded");
|
||||
}
|
||||
|
||||
if (event.data === "shapezio://gd.show_ad") {
|
||||
console.log("Got ad message");
|
||||
gdsdk.showAd();
|
||||
}
|
||||
});
|
||||
|
||||
window["GD_OPTIONS"] = {
|
||||
gameId: "ac8e6fc04a6f46f990ac6a317bb4d74e",
|
||||
onEvent: function (event) {
|
||||
switch (event.name) {
|
||||
case "SDK_GAME_START":
|
||||
console.log("GDSDK: ad finished");
|
||||
postToGameFrame("shapezio://gd.ad_finished");
|
||||
setTimeout(function () {
|
||||
document.getElementById("gameframe").focus();
|
||||
console.log("(GD-PARENT_FRAME) successfully focused frame");
|
||||
}, 500);
|
||||
break;
|
||||
case "SDK_GAME_PAUSE":
|
||||
// pause game logic / mute audio
|
||||
console.log("GDSDK: ad started");
|
||||
postToGameFrame("shapezio://gd.ad_started");
|
||||
break;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
(function (d, s, id) {
|
||||
var js,
|
||||
fjs = d.getElementsByTagName(s)[0];
|
||||
if (d.getElementById(id)) return;
|
||||
js = d.createElement(s);
|
||||
js.id = id;
|
||||
js.src = "https://html5.api.gamedistribution.com/main.min.js";
|
||||
fjs.parentNode.insertBefore(js, fjs);
|
||||
})(document, "script", "gamedistribution-jssdk");
|
||||
</script>
|
||||
|
||||
<style>
|
||||
body {
|
||||
background: #222428;
|
||||
text-align: center;
|
||||
font-family: Arial;
|
||||
color: #eee;
|
||||
}
|
||||
|
||||
#gameframe {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 0;
|
||||
display: block;
|
||||
z-index: 1;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body style="background: #333;">
|
||||
<iframe
|
||||
onclick="this.focus()"
|
||||
src="https://beta.shapez.io?embed=gamedistribution"
|
||||
id="gameframe"
|
||||
allowfullscreen
|
||||
></iframe>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user