Unity3D高级手册0903:自定义Unity WEB播放器的行为

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

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

Unity Manual > Advanced > Web Player Deployment > Customizing the Unity Web Player's Behavior

Unity手册->高级->web播放器部署->自定义Unity WEB播放器的行为

The Unity Web Player allows developers to use a few optional object and embed tag parameters to easily control its behavior in a few ways:

在Unity 的Web Player允许开发人员使用一些可选的object和embed标签的参数去易于控制其在数个方面的行为:

*       disableContextMenu: This parameter controls whether or not the Unity Web Player displays a context menu when the user right- or control-clicks on the content. Setting it to true prevents the context menu from appearing and allows content to utilize right-mouse behavior, the default is false.

*       禁用上下文菜单:此参数控制是否Unity Web播放器显示上下文菜单当用户权限或控制的内容点击时。将它设置为true,防止出现上下文菜单,允许内容利用右鼠标行为,默认为false。

*       disableExternalCall: This parameter controls whether or not the Unity Web Player allows content to communicate with browser-based JavaScript. Setting it to true prevents browser communication and so content cannot call or execute JavaScript in the browser, the default is false.

*       禁用外部调用:此参数控制是否Unity Web播放器允许内容沟通基于浏览器的JavaScript。设置为true防止浏览器的通信而且内容不能调用,或在浏览器中执行JavaScript的,默认为false。

*       disableFullscreen: This parameter controls whether or not the Unity Web Player allows content to be viewed in fullscreen mode. Setting it to true prevents fullscreen viewing and removes the "Go Fullscreen" entry from the context menu, the default is false.

*       禁用全屏:此参数控制是否Unity Web播放器允许内容将在全屏模式浏览。设置为true防止全屏查看和删除“到全屏”从上下文菜单项,默认为false。

Here is an example set of object and embed tags that limit the behavior of the Unity Web Player, the context menu will not be shown and fullscreen viewing is not allowed:

这里是object和embed标签设置,限制了Unity web 播放器的行为,在上下文菜单将不会被显示和全屏观看是不允许的:

<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="disableContextMenu" value="true" />

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

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

        disableContextMenu="true" />

</object>

In the above example you'll notice that neither disableExternalCall nor disableFullscreen are specified, therefore their default values are used. You'll also notice that disableContextMenu is specified and included in both the object and embed tag blocks. It is important to include all tag parameters in both locations in order to ensure that all users are offered the same functionality regardless of the browser they are using.

在上面的例子中,你会发现,既不是disableExternalCall也不是disableFullscreen指定,因此,他们将使用默认值。你还会发现disableContextMenu被指定以及包含在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高级手册0903:自定义Unity WEB播放器的行为