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

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

1. 加载-错误处理和进度 [ 100%]

...aded), Handler.create(this, this.onLoading, null, false), Loader.TEXT); // 侦听加载失败 Laya.loader.on(Event.ERROR, this, this.onError); } onAssetLoaded(texture) { // 使用texture console.log("加载结束"); } // 加载进度侦听器 onLoading(progress) { console.log("加载进度: " + prog...

来源: Laya2.0_示例 发布时间: 20251209

2. 鼠标交互-自定义事件 [ 81%]

... Laya.stage.addChild(this.sp); this.sp.on(ROTATE, this, this.onRotate); // 侦听自定义的事件 this.sp.on(Event.CLICK, this, this.onSpriteClick); } onSpriteClick(e) { let randomAngle = Math.random() * 180; //发送自定义事件 this.sp.event(ROTATE, [randomAngle]); } // 触发自定义的rota...

来源: Laya2.0_示例 发布时间: 20251209

3. UI-RefreshList [ 73%]

...* * 处理列表刷新数据时的限制 * @paramthis.eventName = null; 要侦听的事件名 * @paramthis.moveLimit = null; 移动距离的上限,达到上限后才会抛出要侦听的事件 * @paramthis.distance = null; 相对布局,位于父节点的距离 * @paramthis.time = null; 需要加...

来源: Laya2.0_示例 发布时间: 20251209

4. 加载-销毁Texture使用的图片资源 [ 72%]

...d(this.txt); this.btn.pos(20, 160); Laya.stage.addChild(this.btn); //添加侦听 this.btn.on(Event.MOUSE_UP, this, this.onMouseUp); } /** * 鼠标事件响应函数 * @param evt */ onMouseUp(evt) { if (this.isDestroyed) { //通过设置 visible=true ,来触发渲染,然后引擎会自动恢复...

来源: Laya2.0_示例 发布时间: 20251209

5. 鼠标交互-修正交互区域 [ 72%]

...fontSize = 20; logger.color = "#FFFFFF"; Laya.stage.addChild(logger); } /**侦听处理方法*/ onDown(e) { logger.text += "点击 - " + e.target.name + "\n"; } } new Interaction_FixInteractiveRegion();module laya { import Sprite = Laya.Sprite; import Stage = Laya.Stage; import Text = Laya.Text; imp...

来源: Laya2.0_示例 发布时间: 20251209

6. 屏幕适配-屏幕适配 [ 71%]

...= 0; boy2.on("click", this, this.onBoyClick); Laya.stage.addChild(boy2); //侦听点击事件,输出坐标信息 Laya.stage.on("click", this, this.onClick); Laya.stage.on("resize", this, this.onResize); } onBoyClick(e) { //点击后小人会放大缩小 let boy = e.target; if (boy.scaleX === 1) { ...

来源: Laya2.0_示例 发布时间: 20251209

7. 鼠标交互-滑动 [ 69%]

...件处理*/ onMouseDown(e) { const Event = Laya.Event; //添加鼠标移到侦听 Laya.stage.on(Event.MOUSE_MOVE, this, this.onMouseMove); buttonPosition = this.button.x; Laya.stage.on(Event.MOUSE_UP, this, this.onMouseUp); Laya.stage.on(Event.MOUSE_OUT, this, this.onMouseUp); } /**移到事件处...

来源: Laya2.0_示例 发布时间: 20251209