• 首页
  • 动态
  • 案例
  • 引擎社区
  • API
  • 文档
  • 示例
  • 引擎下载

大约有 23 项符合查询结果, 库内数据总量为 31,560 项。 (搜索耗时: 0.0119 秒)

1. 获取位置信息 · LayaAir3.3 · 引擎文档 · LAYABOX [ 100%]

...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_文档 发布时间: 20251010

2. WebSocket通信 · LayaAir3.3 · 引擎文档 · LAYABOX [ 98%]

...功回调,发送字符串数据 */ 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_文档 发布时间: 20251010

3. 组件脚本的内置方法 · LayaAir3.3 · 引擎文档 · LAYABOX [ 97%]

...wake同的是即使节点未激活onAdded也会调用 onAdded(): void { console.log("Game onAdded"); } //组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次 onAwake(): void { console.log("Game onAwake"); } //组件被启用后执行,比如节点...

来源: Laya3.0_文档 发布时间: 20251010

4. 实体组件系统 · LayaAir3.3 · 引擎文档 · LAYABOX [ 95%]

...wake同的是即使节点未激活onAdded也会调用 onAdded(): void { console.log("Game onAdded"); } //重置组件参数到默认值,如果实现了这个函数,则组件会被重置并且自动回收到对象池,方便下次复用。如果没有重置,则进行回收复用 onReset(...

来源: Laya3.0_文档 发布时间: 20251010

5. 开放数据域组件 · LayaAir3.3 · 引擎文档 · LAYABOX [ 85%]

...gnore wx.setUserCloudStorage({ KVDataList: KVDataList, success: () => { console.log("数据保存成功") }, fail: () => { console.log("数据保存失败") }, complete: () => { console.log("执行调用结束回调") } }); } } 然后是getFriendCloudStorage方法,来到开放数据域的...

来源: Laya3.0_文档 发布时间: 20251010

6. 事件管理 · LayaAir3.3 · 引擎文档 · LAYABOX [ 83%]

...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_文档 发布时间: 20251010

7. 定时器 · LayaAir3.3 · 引擎文档 · LAYABOX [ 80%]

...10; i++) Laya.timer.callLater(this, this.hideImage); } hideImage(): void { console.log("hideImage"); this.Image.visible = false; } } 5. 清理定时器 Laya.timer.clear:清理指定的定时器。定义如下: /** * 清理定时器。 * @param caller 执行域(this)。 * @param method 定时器...

来源: Laya3.0_文档 发布时间: 20251010

8. 精灵 · LayaAir3.3 · 引擎文档 · LAYABOX [ 76%]

...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_文档 发布时间: 20251010

9. 程序蓝图 · LayaAir3.3 · 引擎文档 · LAYABOX [ 72%]

...}) get testParams():string{ return "test"; } set testParams(value:string){ console.log(value); } // 静态 get & set @bpAccessor({ "type":"string", "modifiers": { "isStatic": true } }) static get testStaParams():string{ return "test"; } static set testStaParams(value:string){ console.log(value);...

来源: Laya3.0_文档 发布时间: 20251010

10. 网络通信 · LayaAir3文档 · LAYABOX [ 72%]

...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