大约有 43 项符合查询结果, 库内数据总量为 30,902 项。 (搜索耗时: 0.0048 秒)
...功回调,发送字符串数据 */ private onSocketOpen(e: any): void { console.log("WebSocket 已连接"); // 发送字符串示例 this.socket.send("Hello, LayaAir WebSocket!"); } /** 接收数据回调 */ private onMessageReceived(msg: any): void { console.log("接收到消息:"); if (typeof ...
来源: Laya3.0_文档 发布时间: 20250214
...LICK 的(以下代码来自“2D入门示例”): onEnable(): void { console.log("IndexRT onEnable") //侦听ui按钮点击事件 this.uiBtn.on(Laya.Event.CLICK, this, () => { //点击后,打开UI场景示例 console.log("uiBtn"); Laya.Scene.open("scenes/UiMain.ls"); }); //侦听物理按...
来源: Laya3.0_文档 发布时间: 20240910
...r.create(this, this.onSuccess), Laya.Handler.create(this, this.onError) ); console.log("click"); } // 成功获取位置后触发 onSuccess(info: Laya.GeolocationInfo): void { console.log('经纬度: (' + info.longitude + '°, ' + info.latitude + '°),精确度:' + info.accuracy + 'm'); if (info...
来源: Laya3.0_文档 发布时间: 20240910
...SS, this, this.processHandler); } private processHandler(data:any): void { console.log("processHandler"); } private errorHandler(error:any): void { console.log("errorHandler"); } private completeHandler(data:any): void { console.log("completeHandler"); } } new LayaSample(); 2.2 GET 上面这个示...
来源: Laya3.0_文档 发布时间: 20250104
...@param e 事件对象 */ private onHttpRequestError(e: any = null): void { console.error("请求失败:", e); this.logger.text = "请求失败,请重试。\n"; } /** * 请求进度改变触发的回调 * @param e 事件对象 */ private onHttpRequestProgress(e: any = null): void { //进度的百...
来源: Laya3.0_文档 发布时间: 20250214
... 在workers/index.js中增加事件监听、图片处理与事件派发: console.log("worker/request/index.js") // 在 Worker 线程执行上下文会全局暴露一个 `worker` 对象,直接调用 worker.onMessage/postMessage 即可 worker.onMessage(function (data) { console.log("worker -------...
来源: Laya3.0_文档 发布时间: 20250103
...wake不同的是即使节点未激活onAdded也会调用 onAdded(): void { console.log("Game onAdded"); } //重置组件参数到默认值,如果实现了这个函数,则组件会被重置并且自动回收到对象池,方便下次复用。如果没有重置,则不进行回收复用 onReset(...
来源: Laya3.0_文档 发布时间: 20250103
...打开某个场景。代码示例如下: export async function main() { console.log("Hello LayaAir!"); } 如果开发者不使用启动脚本作为入口,仍然使用启动场景作为入口也是可以的,可以按照后面第二节的介绍设置脚本即可。 二、入口的逻辑脚本 ...
来源: Laya3.0_文档 发布时间: 20250103
...ent.MOUSE_DOWN, this, this.test2);//设置监听,sprite1或sprite2均可 console.log(this.sprite1.mouseEnabled);//打印父节点sprite1的MouseEnabled的值:true console.log(this.sprite2.mouseEnabled);//打印子节点sprite2的MouseEnabled的值:true } test2(e: Laya.Event) { console.log('mou...
来源: Laya3.0_文档 发布时间: 20250103
...port class NewScript extends Main { private ui: RuntimeScript; onStart() { console.log("Game start"); this.ui = this.owner.scene as RuntimeScript; super.baseUI(this.ui); } } import { Main } from "./Main"; import { ButtonRuntime } from "./ButtonRuntime"; const { regClass, property } = Laya; @regClass...
来源: Laya3.0_文档 发布时间: 20250217