赶项目遇到个需求需要在网页打开一个网页的应用因为不想在Unity场景中在编辑,所以产生了这么奇怪的需求
参考网页:http://www.studyofnet.com/news/27.html
http://www.java123.net/v/959099.html
http://www.java123.net/v/892812.html
http://blog.csdn.net/riconyi/article/details/5540557
http://www.jb51.net/article/48938.htm
http://blog.sina.com.cn/s/blog_49c16fee0100cn87.html
1unity中UI增加触发代码(用ugui触发下列方法)
public void Button_DaoYou()//导游
{
_UiGameObject[6].active = !_UiGameObject[6].active;//导游界面显示
}
public void Button_ZhengZhuiCaoZuo()//针锥操作练习
{
Application.ExternalCall("MyFunction1", "Hello from Unity!");//web窗体显示Hello from Unity
}
public void Button_ZhiZhiXiuFu()//纸质修复练习
{
Application.ExternalCall("MyFunction2", "Hello from Unity!");//web窗体显示Hello from Unity
}
public void Button_GuJiXiuFu()//古籍修复练习
{
Application.ExternalCall("MyFunction3", "Hello from Unity!");//web窗体显示Hello from Unity
}
public void Button_QuanSeTaoLun()//诠色讨论
{
Application.ExternalCall("MyFunction4", "Hello from Unity!");//web窗体显示Hello from Unity
}
2在unity发布的web端的html右击编辑
3在<script type="text/javascript">下面增加如下代码:
function MyFunction1( arg )
{
window.showModelessDialog("../1/zhuangding.html",arg, "scroll:0;status:0;help:0;resizable:0;dialogWidth:1280px; dialogHeight:700px");
}
function MyFunction2( arg )
{
window.showModelessDialog("../2/zhengzhui.html","arg", "scroll:0;status:0;help:0;resizable:0;dialogWidth:1280px; dialogHeight:700px");
}
function MyFunction3( arg )
{
window.showModelessDialog("../3/zhuangding.html","", "scroll:0;status:0;help:0;resizable:0;dialogWidth:1280px; dialogHeight:700px");
}
function MyFunction4( arg )
{
window.showModelessDialog("../4/zhuangding.html","", "scroll:0;status:0;help:0;resizable:0;dialogWidth:1280px; dialogHeight:700px");
}
下面分享一下其他的方法(把window.showModelessDialog("../2/zhengzhui.html","arg", "scroll:0;status:0;help:0;resizable:0;dialogWidth:1280px; dialogHeight:700px");换成下面代码)
window.open("../1/zhuangding.html","_blank","height=700,width=1280,scrollbars=no,location=no","bReplace");
window.showModalDialog("../1/zhuangding.html",arg, "scroll:0;status:0;help:0;resizable:0;dialogWidth:1280px; dialogHeight:700px");
window.showModelessDialog("../2/zhengzhui.html","arg", "scroll:0;status:0;help:0;resizable:0;dialogWidth:1280px; dialogHeight:700px");
新手如有错误请指正,谢谢!有什么好的方法也请指点一下,谢谢了!