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

大约有 16 项符合查询结果, 库内数据总量为 30,778 项。 (搜索耗时: 0.0026 秒)

1. IDE-显示IDE创建的界面 [ 100%]

...,代码里面能直接使用,并且有代码提示 this.btn.on(Event.CLICK, this, onBtnClick); this.btn2.on(Event.CLICK, this, onBtn2Click); function onBtnClick() { //手动控制组件属性 this.radio.selectedIndex = 1; this.clip.index = 8; this.tab.selectedIndex = 2; this.combobox.selectedInd...

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

2. 鼠标交互-鼠标交互 [ 99%]

...eHandler); rect.on(Event.MOUSE_UP, this, this.mouseHandler); rect.on(Event.CLICK, this, this.mouseHandler); rect.on(Event.RIGHT_MOUSE_DOWN, this, this.mouseHandler); rect.on(Event.RIGHT_MOUSE_UP, this, this.mouseHandler); rect.on(Event.RIGHT_CLICK, this, this.mouseHandler); rect.on(Event.MOUSE_MOVE,...

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

3. 计时器-延迟执行 [ 97%]

...Laya.stage.height - this.button1.height - vGap) / 2; this.button1.on(Event.CLICK, this, this.onDecreaseAlpha1); this.button2 =this. createButton("点我60帧之后 alpha - 0.5"); this.button2.pos(this.button1.x, this.button1.y + vGap); this.button2.on(Event.CLICK, this, this.onDecreaseAlpha2); } cre...

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

4. 屏幕适配-屏幕适配 [ 97%]

...xt.bold = true; this.txt.pos(0, 200); this.txt.fontSize = 30; this.txt.on("click", this, this.onTxtClick); Laya.stage.addChild(this.txt); //实例一个小人,放到右上角,并相对布局 let boy1 = new Image(); boy1.skin = "res/cartoonCharacters/1.png"; boy1.top = 0; boy1.right = 0; boy1.on(...

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

5. 音频-播放演示 [ 88%]

...p + soundButton.width; musicButton.y = soundButton.y; soundButton.on(Event.CLICK, this, this.onPlaySound); musicButton.on(Event.CLICK, this, this.onPlayMusic); } createButton(labelText) { let w = 110, h = 40; const Sprite = Laya.Sprite; let btn = new Sprite(); Laya.stage.addChild(btn); btn.size(w, h...

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

6. 2D物理-仿生机器人 [ 83%]

...e(revoluteJoint); } eventListener() { Laya.Laya.stage.on(Laya.Event.DOUBLE_CLICK, this, () => { this.motorJoint.motorSpeed = -this.motorJoint.motorSpeed; }); Laya.Laya.stage.on(Laya.Event.CLICK, this, () => { const chassisBody = this.chassis.getComponent(Laya.RigidBody); const chassisPos = chassisBo...

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

7. 2D物理-复合碰撞器 [ 78%]

...ntSize = 16; label.color = "#e69999"; Laya.Laya.stage.on(Laya.Event.DOUBLE_CLICK, this, () => { this.totalBox += 100; }); Laya.Laya.timer.frameLoop(1, this, this.addMiniBox); } dispose() { Laya.Laya.stage.offAll(Laya.Event.DOUBLE_CLICK); Laya.Laya.stage.removeChild(this.label); } } new Physics_Physi...

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

8. 鼠标交互-自定义事件 [ 77%]

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

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

9. Sprite-切换纹理 [ 76%]

... / 2, Laya.stage.height / 2); this.switchTexture(); this.ape.on(Laya.Event.CLICK, this, this.switchTexture); } switchTexture() { let monkey = (this.flag = !this.flag) ? monkey1Res : monkey2Res; this.ape.graphics.clear(); this.ape.graphics.drawTexture(monkey, 0, 0); this.ape.size(monkey.width, monkey...

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

10. 区块地图-等角地图 [ 73%]

...Laya.stage.bgColor = "#232628"; this.createMap(); Laya.stage.on(Laya.Event.CLICK, this, this.onStageClick); } createMap() { const TiledMap = Laya.TiledMap, Rectangle = Laya.Rectangle, Point = Laya.Point; this.tiledMap = new TiledMap(); this.tiledMap.createMap("res/tiledMap/isometric_grass_and_water....

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