文档
脚本

脚本

⚠️

本页面正在建设中

⚠️

测试功能,可能会有变动

脚本 允许您执行脚本并与游戏进行交互。

scene.action([
    new Script((ctx) => {
        console.log("This script is being executed.");
    })
]);

公共方法

constructor

  • handler: (ctx: ScriptCtx) => void - 当脚本被执行时,将调用此处理程序。处理程序将接收一个 ScriptCtx 对象。
const script = new Script((ctx) => {
    console.log(ctx.gameState);
});