Unity3D高级手册0902:自定义Unity WEB播放器的加载界面

2014-09-17 20:02:02|?次阅读|上传:huigezrx【已有?条评论】发表评论

关键词:Unity3D, 虚拟现实, 游戏|来源:唯设编程网

Unity Manual> Advanced> Web Player Deployment > Customizing the Unity Web Player loading screen

Unity手册->高级->web播放器部署->自定义Unity WEB播放器的加载界面

By default the Unity Web Player displays a small Unity logo and a progress bar while loading web player content. It is possible to customize the appearance of that loading screen, including both the logo and progress bar display.

默认情况下,Unity Web播放器显示一个小Unity标识和进度条,而载入网页播放器的内容。它可以自定义的装载屏幕的外观,包括徽标和进度条显示。

Please note that modifying the loader images is only possible with Unity Pro.

请注意,仅Unity专业版可以修改加载图像。

There are six optional object and embed tag parameters that can be used to customize the appearance of the Unity Web Player loading screen. Those optional tag parameters are:

有6个可选的object和embed标签,可用于自定义的Unity Web播放器加载屏幕外观参数。这些可选标记的参数是:

*       backgroundcolor: The background color of the web player content display region during loading, the default is white.  

*       背景颜色:在加载的网页内容显示区域播放背景颜色,默认为白色。

*       bordercolor: The color of the one pixel border drawn around the web player content display region during loading, the default is white.

*       边框颜色:一个像素的边框颜色绘制围绕Web播放器内容显示区域在装载过程中,默认为白色。

*       textcolor: The color of error message text (when data file fails to load for example). The default is black or white, depending on the background color.

*       文字颜色:该错误消息的文本颜色(当数据文件加载失败的例子)。默认的是黑色或白色,依据背景颜色。

*       logoimage: The path to a custom logo image, the logo image is drawn centered within the web player content display region during loading.

*       徽标图像:自定义徽标图像路径,徽标图像绘制在web播放器的内容显示在装载地区为中心。

*       progressbarimage: The path to a custom image used as the progress bar during loading. The progress bar image's width is clipped based on the amount of file loading completed, therefore it starts with a zero pixel width and animates to its original width when the loading is complete. The progress bar is drawn beneath the logo image.

*       装载进度条:在自定义的图像在装载进度条使用的路径。进度条图片的宽度被剪辑基于文件的装载量完成,因此,它开始以零像素的宽度和动画去它自己的宽度当加载完成时。进度条被绘制下方标志图片。

*       progressframeimage: The path to a custom image used to frame the progress bar during loading.

*       进度帧图像:在自定义图像路径用于装载过程中的进度条。

All color values provided must be 6-digit hexidecimal colors, (eg. FFFFFF, 020F16, etc.). The image paths provided can be either relative or absolute links and all image files must be RGB (without transparency) or RGBA (with transparency) 8-bit/channel PNG files. Finally, the progressframeimage and the progressbarimage should be the same height.

所有颜色值提供必须是6位十六进制颜色,(例如:000000,020F16等)。所提供的图像路径可以是相对或绝对的连接,所有的图像文件必须是RGB(不透明度)或RGBA(透明)8-位/通道 PNG文件。最后,进度帧图像和进度条图像应该是相同的高度。

Here is an example set of object and embed tags that customize the appearance of the Unity Web Player loading screen. The background color is set to light gray (A0A0A0), border color to black (000000), text color to white (FFFFFF) and loader images to MyLogo.png, MyProgressBar.png and MyProgressFrame.png.

这里是一个例子设置object和embed标签自定义Unity Web播放器加载屏幕的外观。背景色设置为浅灰色(A0A0A0),边框颜色为黑色(000000),文本颜色为白色(000000)和装载图像为MyLogo.png,MyProgressBar.png和MyProgressFrame.png。

<object id="UnityObject" classid="clsid:444785F1-DE89-4295-863A-D46C3A781394"

    width="600" height="450"

    codebase="http://webplayer.unity3d.com/download_webplayer/UnityWebPlayer.cab#version=2,0,0,0">

    <param name="src" value="MyDataFile.unity3d" />

    <param name="backgroundcolor" value="A0A0A0" />

    <param name="bordercolor" value="000000" />

    <param name="textcolor" value="FFFFFF" />

    <param name="logoimage" value="MyLogo.png" />

    <param name="progressbarimage" value="MyProgressBar.png" />

    <param name="progressframeimage" value="MyProgressFrame.png" />

    <embed id="UnityEmbed" src="MyDataFile.unity3d" width="600" height="450"

        type="application/vnd.unity" pluginspage="http://www.unity3d.com/unity-web-player-2.x"

        backgroundcolor="A0A0A0" bordercolor="000000" textcolor="FFFFFF" logoimage="MyLogo.png"

        progressbarimage="MyProgressBar.png" progressframeimage="MyProgressFrame.png" />

</object>

Notice that in the above example, the optional tag parameters are included in both the object and embed tag blocks as name/value pairs. It is important to include all tag parameters in both locations in order to ensure that all users see the same loading screen regardless of the browser they are using.

请注意,在上面的例子中,可选的标签参数均包含object和embed标签块作为对应的名称/值。重要的是包括在这两个地点的所有标签的参数,以确保所有用户看到相同的加载屏幕无论他们使用的浏览器。

Note: developers that modify the default HTML file created by Unity must be sure to make edits in a few locations due to how that HTML file is structured. The first section to modify is the JavaScript block that detects the Unity Web Player, and if found writes out the object and embed tags. The second section to modify is the noscript block at the end in case the page is viewed by a user with JavaScript disabled. Editing both sections, and both the object and embed tags in each section, will ensure that all users, in all browsers will have the same experience.

注:开发人员修改默认的HTML文件的通过Unity创造的必须确保作出应有怎样的HTML文件的结构是少数部分的修改。第一部分修改是JavaScript块检测的Unity Web播放器,如果发现写出的object和embed标签。第二部分修改,是在底部的NoScript的情况下,页面是由用户查看一个禁用JavaScript。编辑两部分,两者的object和embed标签在每一节里,将确保所有用户,在所有浏览器都会有相同的体验。

发表评论0条 】
网友评论(共?条评论)..
Unity3D高级手册0902:自定义Unity WEB播放器的加载界面