上一篇文章我们了解了 在网页中引用unity3d播放器
这篇文章和大家说下自定义unity3d载入页面。
先看代码:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>unity3d test</title>
<script type=”text/javascript” src=”http://webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/UnityObject.js”></script><!–引用通用js文件–>
<script>var params = {
backgroundcolor: “0a0a0a”,
bordercolor: “ffffff”,
textcolor: “ffffff”,
logoimage: “logo.png”,
progressbarimage: “lodin.png”,
progressframeimage: “lodbg.png”
};unityObject.embedUnity(“unityPlayer”,”http://test.cityofsteam.com/Uploads/test.unity3d”,419,237,params);//
</script>
</head><body>
<div id=”unityPlayer”><!–这个id要和上面js中的id匹配–>
<div><!–这是首次装载unity3d的时候显示。让你下载unity3d–>
<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 style=”color:#000066″></div>
</div>
</body>
</html>
自定义unity3d载入界面其实就是 :
var params = {
backgroundcolor: “0a0a0a”,//背景色
bordercolor: “ffffff”,//边框颜色
textcolor: “ffffff”,//文本颜色
logoimage: “logo.png”,//logo路径
progressbarimage: “lodin.png”,//载入条图片
progressframeimage: “lodbg.png”//载入条背景
};
然后用
unityObject.embedUnity(“unityPlayer”,”http://test.cityofsteam.com/Uploads/test.unity3d”,419,237,params);//
最有一个参数调用!
这里载入条和载入图片一定要同等的高。同等宽,然后要能向X轴方向循环的。
下面看一下我做的: