<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();
var WashScreen = 0;
$(function () {
player.playerUrl = "https://www.reallusion.com/crazytalk/Unity/samplecode/CTWebPlayer.unity3d";
player.init($("#unityPlayer"), function () {
var urls = ["https://www.reallusion.com/crazytalk/Unity/samplecode/SampleCode17_1/Cute_Dog.uctProject",
"https://www.reallusion.com/crazytalk/Unity/samplecode/SampleCode17_1/CTDefWebPreview.uctidle",
"https://www.reallusion.com/crazytalk/Unity/samplecode/SampleCode17_1/CarFront.png",
"https://www.reallusion.com/crazytalk/Unity/samplecode/SampleCode17_1/Night.png",
"https://www.reallusion.com/crazytalk/Unity/samplecode/SampleCode17_1/Bars.png",
"https://www.reallusion.com/crazytalk/Unity/samplecode/SampleCode17_1/BrickWall.jpg",
"https://www.reallusion.com/crazytalk/Unity/samplecode/SampleCode17_1/NeverDrinkAndDrive.uctScript"];
player.preLoadFiles(urls, {
thread: 7,
loaded: function() {
player.loadProject("https://www.reallusion.com/crazytalk/Unity/samplecode/SampleCode17_1/Cute_Dog.uctProject", {
playerAfter:-1,
showActor: false,
idleMotionUrl:"https://www.reallusion.com/crazytalk/Unity/samplecode/SampleCode17_1/CTDefWebPreview.uctidle"
});
initialForeBack();
player.loadScript("https://www.reallusion.com/crazytalk/Unity/samplecode/SampleCode17_1/NeverDrinkAndDrive.uctScript", {
playAfter:-1,
loaded: function(){
actorInitialPosition();
player.showActor(true, 0);
}
});
}//executed after loaded
});//pre-loading
player.bind( "playerstatus", function (event) {
if( event.status == "startplay" )
{
if (WashScreen == 1)
{
player.showActor(false, 0);
initialForeBack();
actorInitialPosition();
player.showActor(true, 0);
WashScreen = 0;
}
}
else if( event.status == "playing" )
{
if (event.time > 5.5 && event.time < 5.52)
{
player.showProgressbar(false);
player.loadBackground("https://www.reallusion.com/crazytalk/Unity/samplecode/SampleCode17_1/BrickWall.jpg", {
name: "BrickWall",
alpha: 1,
fit: "fill",
});
player.showForeground("CarFront", false, 2);
actorInJail();
}
if (event.time > 6.5 && event.time < 6.6)
{
player.showForeground ("Bars", true, 0.5);
}
}
else if( event.status == "pause" )
{
WashScreen = 0;
}
else if( event.status == "stop" || event.time == event.length)
{
if (event.time == event.length)
{
player.showProgressbar(true);
}
WashScreen = 1;
}
});//bind
});//initial
})//$function
function initialForeBack(){
player.loadForeground("https://www.reallusion.com/crazytalk/Unity/samplecode/SampleCode17_1/Bars.png", {
name: "Bars",
zOrder: 0,
alpha : 0,
x: 0, y: -5, width: 100, height: 100,
loaded: function(){
player.showForeground("Bars", false, 0);
}
});
player.loadForeground("https://www.reallusion.com/crazytalk/Unity/samplecode/SampleCode17_1/CarFront.png", {
name: "CarFront",
zOrder: 1,
alpha : 1,
x: 0, y: 0, width: 100, height: 100,
loaded: function(){
player.showForeground("CarFront", true, 0);
}
});
player.loadBackground("https://www.reallusion.com/crazytalk/Unity/samplecode/SampleCode17_1/Night.png", {
name: "Night",
alpha: 1,
fit: "fill"
});
}
function actorInitialPosition() {
player.actorTransform({
scale: 50,
positionX: 60,
positionY: 45,
duration: 0
});
}
function actorInJail() {
player.actorTransform({
scale: 30,
positionX: 22,
positionY: 68,
duration: 1
});
}
</script>