<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ssl-webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/UnityObject2.js"></script>
<script type="text/javascript" src="https://www.reallusion.com/crazytalk/Unity/samplecode/CTWebPlayer.min.js"></script>
<script type="text/javascript">
var player = new CTWebPlayer();
$(function () {
player.playerUrl = "https://www.reallusion.com/crazytalk/Unity/samplecode/CTWebPlayer.unity3d";
player.init($("#unityPlayer"), function () {
player.loadProject("https://www.reallusion.com/crazytalk/Unity/samplecode/SampleCode16/Interaction_mouse_event.uctproject",
{
playAfter: 0,
idleMotionUrl:
"https://www.reallusion.com/crazytalk/Unity/samplecode/SampleCode16/Affirmative.uctidle"
});
player.bind("mousemove", function (event) {
$("#labX").text(event.clientX);
$("#labY").text(event.clientY);
});
player.bind("click", function (event) {
var Action;
switch (event.button) {
case 0:
Action = "Left mouse button pressed.";
break;
case 1:
Action = "Middle mouse button pressed.";
break;
case 2:
Action = "Right mouse button pressed.";
break;
default:
Action = "No button pressed.";
break;
}
$("#labAction").text(Action);
});
});
});
</script>
</head>
<body>
<table style="text-align:center;margin-left:auto; margin-right:auto;">
<tr>
<td>
<div id="unityPlayer" style="width: 640px; height: 480px;">
</div>
</td>
</tr>
<tr>
<td>
Mouse Action:<label id="labAction" style="color:red"></label>
X:<label id="labX" style="color:red"></label>
Y:<label id="labY" style="color:red"></label>
</td>
</tr>
</table>
</body>
</html>