Unity 发布web版本自定义logo进度条和全屏显示

首先,Unity官方有一个Web Player Deployment :http://docs.unity3d.com/Manual/WorkingwithUnityObject.html,就讲了怎样自定义logo和屏蔽右键等一系列的东西,读完了估计也了解的差不多了。

下面是我的找到的一些方法,自定义logo:

var config = {
width: window.innerWidth,
height: window.innerHeight,
params: {
backgroundcolor: "FFFFFF",
bordercolor: "FFFFFF",
textcolor: "FFFFFF",
logoimage: "bunny-welcome.png",
progressbarimage: "bar_frame.png",
progressframeimage: "bar.png",
enableDebugging:"0", 
disableContextMenu:true //屏蔽右键
}

};
var u = new UnityObject2(config);

或者是这种方法:

//config其实可以不用要

var config = {
width: window.innerWidth,
height: window.innerHeight,
params: {     enableDebugging:"0"    }
};

var params = {
   
backgroundcolor: "FFFFFF",
bordercolor: "FFFFFF",
textcolor: "FFFFFF",
logoimage: "bunny-welcome.png",
progressbarimage: "bar_frame.png",
progressframeimage: "bar.png",

disableContextMenu:true
};
var u = UnityObject2({ params: params });

自定义logo其实就是这么简单,接下来看全屏显示:

先转载一篇详细的:http://unitycoder.com/blog/2013/03/31/webplayer-100-width-height/

  • You are now viewing the HTML source, find lines:
    var config = {
    width: 960,
    height: 600,
  • Replace those numbers with:
    var config = {
    width: window.innerWidth,
    height: window.innerHeight,
  • Go down a bit, find lines:
    body {
    font-family: Helvetica, Verdana, Arial, sans-serif;
    background-color: white;
    color: black;
    text-align: center;
    }
  • After line “text-align: center;”, add these lines:
    margin:0px;
    padding:0px;
    width:100%;
    height:100%;
  • Next find line:
    div.content {
    margin: auto;
    width: 960px;
    }
  • Modify that style to:
    div.content {
    margin: auto;
    width: 100%;
    height:100%;
    }
  • Find this part:
    div#unityPlayer {
    cursor: default;
    height: 600px;
    width: 960px;
    }
  • Modify it to:
    div#unityPlayer {
    cursor: default;
    height: 100%;
    width: 100%;
    }
  • *NEW: Insert this style also, to override embed object width:
    embed
    {
    width:100% !important;
    }
  • Next we just remove the extra elements from the page, so that only the player is left
  • Find this line, and delete it:
    <p><span>Unity Web Player | </span>v4d</p>
  • Same here, remove this line:
    <p>&laquo; created with <a href=”http://unity3d.com/unity/” title=”Go to unity3d.com”>Unity</a> &raquo;</p>
  • Save the html file and test it!
其实大概的意思就是把config的宽高值变成 window.innerWidth和window.innerHeight,找到body,content,unityPlayer,把他们的宽高变成100%,根据情况把margin和padding变成 0px。删除不用的文字和链接,然后保存就可以看到已经全屏了。具体来阅读上面的吧,写的非常详细。

最后进度条出来的效果:







  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值