<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>test</title>
<link rel="shortcut icon" href="TemplateData/favicon.ico">
<link rel="stylesheet" href="TemplateData/style.css">
<script src="TemplateData/UnityProgress.js"></script>
<script src="Build/UnityLoader.js"></script>
<script type='text/javascript' src='../JS/settings.js'></script>
<script type='text/javascript'>
function test(arg)
{
alert(arg);
}
</script>
<script>
var gameInstance = UnityLoader.instantiate("gameContainer", "Build/Test.json", {onProgress: UnityProgress});
function getTest()
{
gameInstance.SendMessage("objName", "FunA", "hello world" );
gameInstance.SendMessage("objName", "FunB", 1 );
}
</script>
</head>
<body>
<div class="webgl-content">
<div id="gameContainer" style="width: 960px; height: 600px"></div>
<div class="footer">
<div class="webgl-logo"></div>
<div class="fullscreen" οnclick="gameInstance.SetFullscreen(1)"></div>
<div class="title">Test</div>
</div>
</div>
</body>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>test</title>
<link rel="shortcut icon" href="TemplateData/favicon.ico">
<link rel="stylesheet" href="TemplateData/style.css">
<script src="TemplateData/UnityProgress.js"></script>
<script src="Build/UnityLoader.js"></script>
<script type='text/javascript' src='../JS/settings.js'></script>
<script type='text/javascript'>
function test(arg)
{
alert(arg);
}
</script>
<script>
var gameInstance = UnityLoader.instantiate("gameContainer", "Build/Test.json", {onProgress: UnityProgress});
function getTest()
{
gameInstance.SendMessage("objName", "FunA", "hello world" );
gameInstance.SendMessage("objName", "FunB", 1 );
}
</script>
</head>
<body>
<div class="webgl-content">
<div id="gameContainer" style="width: 960px; height: 600px"></div>
<div class="footer">
<div class="webgl-logo"></div>
<div class="fullscreen" οnclick="gameInstance.SetFullscreen(1)"></div>
<div class="title">Test</div>
</div>
</div>
</body>
</html>
网页到U3D通过创建的gameInstance,SendMessage。其中参数是一是U3D中的节点名,参数二是接收函数的名称,参数3是发送数据。
U3D到网页通过,Application.ExternalCall("getAllUserInfo");