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

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

1. 绘制能力 · LayaAir3.3 · 引擎文档 · LAYABOX [ 100%]

...p.graphics.drawRect(20, 20, 100, 50, "#ffff00", "#00ff00", 5, false); this.owner.addChild(sp); 示例中的 20,20 是矩形起始点坐标,100是向右的宽度,如果是负数则是向左的宽度。50是向下的高度,如果是负数则是向上的高度。 运行效果: (图2-3) 2....

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

2. 位图切片组件 · LayaAir3.3 · 引擎文档 · LAYABOX [ 94%]

...dth - bg.width >> 1, Laya.stage.height - bg.height >> 1); this.owner.addChild(bg); } private createTimerAnimation(): void { this.counter = new Laya.Clip(this.clipSkin, 10, 1); this.counter.autoPlay = true; this.counter.interval = 1000; this.counter.x = (Laya.stage.width - this.counter.wi...

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

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

...如下代码: onAwake(): void { //侦听自定义的事件"Click" this.owner.on("Click",this,()=>{ console.log("侦听到自定义的“Click”事件"); }) } //鼠标点击后执行,发送Click事件。 onMouseClick(evt: Laya.Event): void { //自定义的事件 this.owner.event("Click"); } ...

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

4. TiledMap地图 · LayaAir3.3 · 引擎文档 · LAYABOX [ 86%]

...e2D下 private onLoaded(): void { this.tMap.mapSprite().removeSelf(); this.owner.addChild(this.tMap.mapSprite()); } //地图加载完成的回调 private completeHandler(e: any = null): void { this.onLoaded(); } } 编译运行代码,效果如图3-3所示,说明地图已创建成功。 (图3-3...

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

5. 显示文本组件 · LayaAir3.3 · 引擎文档 · LAYABOX [ 85%]

...aya; @regClass() export class LabelControl extends Laya.Script { //declare owner : Laya.Sprite3D; @property( { type : Laya.Label } ) public lab: Laya.Label; constructor() { super(); } /** * 组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次 */ onAwake...

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

6. UI运行时 · LayaAir3.3 · 引擎文档 · LAYABOX [ 82%]

... RuntimeScript; onStart() { // 获得场景的Runtime对象 this.ui = this.owner.scene as RuntimeScript; // Button添加鼠标事件,让Image不显示 this.ui.Button.on( Laya.Event.MOUSE_DOWN, null, ()=>{ this.ui.Image.visible = false; }); } } ui 属性直接从脚本中通过 this.owner.scene ...

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

7. HTTP通信 · LayaAir3.3 · 引擎文档 · LAYABOX [ 81%]

... this.text.align = "center"; this.text.y = 20; this.text.centerX = 0; this.owner.addChild(this.text); } /** * 发起HTTP连接请求 */ private connect(): void { //创建HttpRequest对象 this.hr = new HttpRequest(); //请求响应的进度改变时触发 this.hr.on(Event.PROGRESS, this, this.onHttp...

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

8. 多行输入文本组件 · LayaAir3.3 · 引擎文档 · LAYABOX [ 81%]

...; @regClass() export class TextAreaControl extends Laya.Script { //declare owner : Laya.Sprite3D; @property( { type : Laya.TextArea } ) public txtarea: Laya.TextArea; constructor() { super(); } /** * 组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次 ...

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

9. 精灵 · LayaAir3.3 · 引擎文档 · LAYABOX [ 80%]

...= Laya; @regClass() export class NewScript extends Laya.Script { //declare owner : Laya.Sprite3D; @property({ type: Laya.Sprite }) public sprite1: Laya.Sprite; @property({ type: Laya.Sprite }) public sprite2: Laya.Sprite; constructor() { super(); } /** * 组件被激活后执行,此时所有节点...

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

10. 使用二进制图片 · LayaAir3.0文档 · LAYABOX [ 78%]

... //加载Base64图片数据 sp1.loadImage(e.target.result as string); this.owner.addChild(sp1); } }); 上述代码中,用 Laya.loader.fetch 加载图片二进制数据,根据自定义的规则,可以解析数据加密方式,并获得完整图片数据。在这里我们更多的介绍一下 L...

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