Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
RimuruDev committed Sep 5, 2023
1 parent e877759 commit 100bf1c
Showing 1 changed file with 50 additions and 4 deletions.
54 changes: 50 additions & 4 deletions Assets/WebGLTemplates/PluginYG/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
<link rel="shortcut icon" href="TemplateData/favicon.ico">
<link rel="stylesheet" href="TemplateData/style.css">

<style>
canvas:focus {
outline: none;
}
</style>

<!-- Yandex Games SDK -->
<script src="https://yandex.ru/games/sdk/v2"></script>

Expand Down Expand Up @@ -91,6 +97,12 @@
</style>
#endif

<style>
body {
background-color: #20c5f9;
}
</style>

</head>
<body class="{{{ SPLASH_SCREEN_STYLE.toLowerCase() }}}">
<div id="unity-container" class="unity-desktop">
Expand Down Expand Up @@ -251,6 +263,11 @@
const progressBarFull = document.querySelector("#unity-progress-bar-full");
const spinner = document.querySelector('.spinner');

progressBarEmpty.style.width = "calc(25vw - 20px)";

const progressBarFill = document.querySelector("#unity-progress-bar-full");
progressBarFill.style.backgroundColor = "purple";

const canFullscreen = (function () {
for (const key of [
'exitFullscreen',
Expand All @@ -268,16 +285,45 @@

if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
container.className = "unity-mobile";
config.devicePixelRatio = 1;

}

var backgroundUnity = "url('" + buildUrl + "/{{{ BACKGROUND_FILENAME.replace(/'/g, '%27') }}}') center / cover";

canvas.style.background = "url('background.png') center / cover";
canvas.style.backgroundImage = "url('background.png')";
// canvas.style.backgroundSize = "contain";

loadingCover.style.display = "";

canvas.addEventListener("touchstart", () => { window.focus() });
canvas.addEventListener("pointerdown", () => { window.focus() });
canvas.addEventListener("touchstart", () => {
window.focus()
});
canvas.addEventListener("pointerdown", () => {
window.focus()
});

// Портретный режим
function updateAspectRatio() {
var windowWidth = window.innerWidth;
var windowHeight = window.innerHeight;
var containerAspectRatio = 9 / 16;

if (windowWidth / windowHeight > containerAspectRatio) {
container.style.width = windowHeight * containerAspectRatio + "px";
container.style.height = "100vh";
} else {
container.style.width = "100vw";
container.style.height = windowWidth / containerAspectRatio + "px";
}

container.style.top = "50%";
container.style.left = "50%";
container.style.transform = "translate(-50%, -50%)";
}

updateAspectRatio();
window.addEventListener("resize", updateAspectRatio);


let player;
let leaderboard;
Expand Down

0 comments on commit 100bf1c

Please sign in to comment.