引擎例子 - 定时HelloWorld

当虚拟时钟秒值 == 3 时会显示HelloWorld;
虚拟时钟:0 (s)


  源代码:

    var world = new JadeEngine.World();
    world.getClock().timeUnit.CONST_MILLISECOND_TO_SECOND = 200;
    JadeEngine.run(world);

    var world2 = world.getRuntime().getWorldTable().findById(world.id);

    world.onClockEvent = function (e) {
        if (e.code == JadeEngine.Toolkit.TimeUnit.CONST_SECOND) {
            document.getElementById("clock").innerHTML = e.context.params + 1;
            if (e.context.params == 2) {
                document.getElementById("show-area").innerHTML = "HelloWorld";
            }
        }
    }

    var start = function () {
        document.getElementById("show-area").innerHTML = "";
        world.stop();
        world.start();
    }