unity3d webplayer 16:9 居中显示模板
时间:2014-05-12 17:05:09
收藏:0
阅读:447
原地址:http://www.cnblogs.com/88999660/archive/2013/04/12/3016773.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Unity Web Player | Shadow_Demo</title> <script type=‘text/javascript‘ src=‘jquery.min.js‘></script> <script type="text/javascript"> <!-- var unityObjectUrl = "UnityObject2.js"; if (document.location.protocol == ‘https:‘) unityObjectUrl = unityObjectUrl.replace("http://", "https://ssl-"); document.write(‘<script type="text\/javascript" src="‘ + unityObjectUrl + ‘"><\/script>‘); --> </script> <script type="text/javascript"> <!-- var screenWidth = parseInt($(document).width()*0.8); var screenHeight = parseInt(screenWidth*0.56); var config = { width: screenWidth, height: screenHeight, params: { enableDebugging:"0" } }; config.params["disableContextMenu"] = true; config.params["backgroundcolor"] = "FFFFFF"; config.params["bordercolor"] = "FFFFFF"; config.params["textcolor"] = "FFFFFF"; config.params["logoimage"] = "Logo.png"; config.params["progressbarimage"] = "front.png"; config.params["progressframeimage"] = "black.png"; var u = new UnityObject2(config); function Login(msg){ var user =getCookie("tourism_up"); if(user !=""){ u.getUnity().SendMessage("Login", "LoginFromWebpage", user); } } function getCookie(c_name) { if(document.cookie.length>0){ c_start=document.cookie.indexOf(c_name + "=") if(c_start!=-1){ c_start=c_start + c_name.length+1 c_end=document.cookie.indexOf(";",c_start) if(c_end==-1) c_end=document.cookie.length return unescape(document.cookie.substring(c_start,c_end)) } } return "" } jQuery(function() { var $missingScreen = jQuery("#unityPlayer").find(".missing"); var $brokenScreen = jQuery("#unityPlayer").find(".broken"); var $unityPlayer = jQuery("#unityPlayer"); var $content = jQuery(".content"); $content.height($(document).height()); $content.width($(document).width()); $missingScreen.hide(); $brokenScreen.hide(); u.observeProgress(function (progress) { switch(progress.pluginStatus) { case "broken": $brokenScreen.find("a").click(function (e) { e.stopPropagation(); e.preventDefault(); u.installPlugin(); return false; }); $brokenScreen.show(); break; case "missing": $missingScreen.find("a").click(function (e) { e.stopPropagation(); e.preventDefault(); u.installPlugin(); return false; }); $missingScreen.show(); break; case "installed": $missingScreen.remove(); break; case "first": break; } }); u.initPlugin(jQuery("#unityPlayer")[0], "0409.unity3d"); var $embed = $("embed"); if(typeof($embed.css("display")) == "undefined"){ $embed = $("object") } $embed.css("display",""); }); --> </script> <style type="text/css"> <!-- *{margin:0} body { font-family: Helvetica, Verdana, Arial, sans-serif; background-color: white; color: black; } a:link, a:visited { color: #000; } a:active, a:hover { color: #666; } p.header { font-size: small; } p.header span { font-weight: bold; } p.footer { font-size: x-small; } div.content { position: relative; display: table-cell; vertical-align:middle; text-align:center; } div.broken, div.missing { margin: auto; position: relative; top: 50%; width: 193px; } div.broken a, div.missing a { height: 63px; position: relative; top: -31px; } div.broken img, div.missing img { border-width: 0px; } div.broken { display: none; } div#unityPlayer { cursor: default; } --> </style> </head> <body> <div class="content"> <div id="unityPlayer"> <div class="missing"> <a href="http://unity3d.com/webplayer/" title="Unity Web Player. Install now!"> <img alt="Unity Web Player. Install now!" src="http://webplayer.unity3d.com/installation/getunity.png" width="193" height="63" /> </a> </div> </div> </div> </body> </html>
弄了2个小时,拿去用的时候记得给个好评哦,亲~~~~~~~~~~~~~~~~~~。
评论(0)