משתמש:שמואל חיים/ניסוי
> <html lang="en-us">
<head> <meta charset="utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Unity WebGL Player | carsRace</title> <link rel="shortcut icon" href="TemplateData/favicon.ico"> <link rel="stylesheet" href="TemplateData/style.css"> <script src="TemplateData/UnityProgress.js"></script>
<script src="Build/UnityLoader.js"></script> <script> var unityInstance = UnityLoader.instantiate("unityContainer", "Build/CAR_coll.json", {onProgress: UnityProgress}); </script> </head> <body>
</body>
<script> var baseWidth = 960; var baseHeight = 600; const urlParams = new URLSearchParams(window.location.search); var Idx = urlParams.get('Idx'); $(document).ready(function(){ checkGameResolution(); })
function checkGameResolution(){
if (localStorage.getItem(Idx+"GameFullscreen0")>1){
var val = localStorage.getItem(Idx+"GameFullscreen0");
setResolution(val);
}
}
$(".graphicBtn").click(function(){ var val = $(this).attr("value"); setResolution(val) })
function setResolution(val){ document.getElementById("unityContainer").style.width=baseWidth/val+"px"; document.getElementById("unityContainer").style.height=baseHeight/val+"px"; window.parent.document.getElementById('gameIf').style.transition="0s"; window.parent.document.getElementById('gameIf').style.transform="scale("+val+")"; document.getElementById('graphicChoose').style.transform="scale("+1/val+")"; // document.getElementById('graphicChoose').style.marginTop=22-(val*4)+"px"; $(".graphicBtn").removeClass("choosedBtn"); $(".graphicBtn[value='"+val+"']").addClass("choosedBtn"); localStorage.setItem(Idx+"GameFullscreen0",val) localStorage.setItem("GamesFullscreen",val) if (val>1){ $("#fullscreenUnity").addClass("fullhidden"); } else { $("#fullscreenUnity").removeClass("fullhidden"); }
}
</script> <style>
body{ overflow-x:hidden; }
*{ font-family:'Assistant', sans-serif !important; } #fullscreenUnity{ height: 40px !important; display: inline-block !important; position: absolute !important; right: 120px; }
#unityContainer{ margin: auto !important; }
#btnResolution{ margin-left:30px; background: green; border:none; color:white; font-size:18px; padding:7px 10px; transition:0s; }
- graphicChoose{
height:0px; } .graphicBtn{
color: #333; background-color: #fff; border-color: #ccc; padding: 6px 12px; font-size: 16px;
min-width:100px;
font-weight: 400; text-align: center; cursor: pointer; border: 1px solid transparent; border-radius: 0px;
} .choosedBtn{ background:#cc128b; color:white; } .fullhidden{ right: -200% !important; }
</style>
</html>