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

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

1. 事件管理 · LayaAir3.4 · 引擎文档 · LAYABOX [ 100%]

...ble(): void { console.log("IndexRT onEnable") //侦听ui按钮点击事件 this.uiBtn.on(Laya.Event.CLICK, this, () => { //点击后,打开UI场景示例 console.log("uiBtn"); Laya.Scene.open("scenes/UiMain.ls"); }); //侦听物理按钮点击事件 this.phyBtn.on(Laya.Event.CLICK, this, () =&g...

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

2. WebSocket通信 · LayaAir3.4 · 引擎文档 · LAYABOX [ 95%]

...ROR:连接出错时触发。 示例代码: // 注册事件监听示例 this.socket.on(Laya.Event.OPEN, this, this.onSocketOpen); this.socket.on(Laya.Event.MESSAGE, this, this.onMessageReceived); this.socket.on(Laya.Event.CLOSE, this, this.onSocketClose); this.socket.on(Laya.Event.ERROR, this, th...

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

3. 内置骨骼动画 · LayaAir3.4 · 引擎文档 · LAYABOX [ 92%]

...en((templet: Laya.Templet) => { //创建模式为1,可以启用换装 this.mArmature = templet.buildArmature(0); this.mArmature.x = 300; this.mArmature.y = 350; this.mArmature.scale(0.5, 0.5); this.owner.addChild(this.mArmature); //设置动画播放完成后,调用completeHandler继续播放...

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

4. 陀螺仪与加速计 · LayaAir3.4 · 引擎文档 · LAYABOX [ 91%]

...ope_Sample { private info: Laya.Text; constructor() { Laya.init(550, 400); this.info = new Laya.Text(); this.info.fontSize = 50; this.info.color = "#FFFFFF"; this.info.size(Laya.stage.width, Laya.stage.height); Laya.stage.addChild(this.info); Laya.Gyroscope.instance.on(Laya.Event.CHANGE, this, this....

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

5. 视频节点 · LayaAir3.4 · 引擎文档 · LAYABOX [ 89%]

...DOWN, () => { Laya.loader.load("resources/layaAir.mp4").then(() => { this.video.play(); //播放视频 }); }) } } 如果是在LayaAir IDE中运行,则VideoNode无需通过事件触发播放。但是在Chrome中,自动播放只允许静音自动播放。只有用户进行交互(单击、...

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

6. 使用百度地图 · LayaAir3.4 · 引擎文档 · LAYABOX [ 86%]

...div容器 二、接着是构造函数: constructor() { Laya.init(1, 1); this.init(); // 使用高精度位置 Laya.Geolocation.enableHighAccuracy = true; Laya.Geolocation.watchPosition(Laya.Handler.create(this, this.updatePosition), Laya.Handler.create(this, this.onError)); // 绑定convertToBaidu...

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

7. UI运行时 · LayaAir3.4 · 引擎文档 · LAYABOX [ 86%]

...件脚本中,使用此场景中已经勾选过的UI组件,直接使用this.即可使用。例如下面的代码: onAwake(): void { // Button添加鼠标事件,让Image不显示 this.Button.on( Laya.Event.MOUSE_DOWN, this, ()=>{ this.Image.visible = false; }); } 运行此场景来看看效...

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

8. 音频 · LayaAir3.4 · 引擎文档 · LAYABOX [ 85%]

...去舞台焦点(切出游戏)的处理 Laya.stage.on(Laya.Event.BLUR, this, () => { _sound.stop(); }); //获得舞台焦点(切回游戏)的处理 Laya.stage.on(Laya.Event.FOCUS, this, () => { _sound.play(0); }); …… Copyright ©Layabox 2026 all right reserved,powered by LayaAir E...

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

9. 弹窗视图组件 · LayaAir3.4 · 引擎文档 · LAYABOX [ 85%]

...) export class RuntimeScript extends RuntimeScriptBase { onAwake(): void { this.closeBtn.on(Laya.Event.CLICK, this, () => { this.close(); }); } } 1.3.3 关联场景 设置好弹窗之后,需要用代码将Dialog与所需要用到该Dialog的场景管关联起来。回到初始场景Scene,在S...

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

10. TiledMap地图 · LayaAir3.4 · 引擎文档 · LAYABOX [ 84%]

...aya.Script { private tMap:Laya.TiledMap; onEnable() { //创建地图对象 this.tMap = new Laya.TiledMap(); //创建Rectangle实例,视口区域 var viewRect:Laya.Rectangle = new Laya.Rectangle(0, 0, Laya.stage.designWidth, Laya.stage.designHeight); //创建TiledMap地图 this.tMap.createMap("reso...

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