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

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

21. 区块地图-滚动地图 [ 80%]

...ALL; Laya.stage.bgColor = "#232628"; this.createMap(); Laya.stage.on(Event.MOUSE_DOWN, this, this.mouseDown); Laya.stage.on(Event.MOUSE_UP, this, this.mouseUp); Stat.show(); } // 创建地图 createMap() { const TiledMap = Laya.TiledMap, Rectangle = Laya.Rectangle, Handler = Laya.Handler, Browser = ...

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

22. Laya.stage.mouseX; Laya.stage.mouseY取到的坐标用来赋给画曲线方法的起点;在左顶点正常,越往右下角起点就越偏移了 [ 80%]

...bgColor = "#000000"; this.ps = new Laya.Sprite(); Laya.stage.on(Laya.Event.MOUSE_DOWN, this, this.down2) Laya.stage.on(Laya.Event.MOUSE_UP, this, this.up2) Laya.stage.addChild(this.ps); } down2() { this.a = Laya.stage.mouseX; this.b = Laya.stage.mouseY; console.log("鼠标点击的点" + this.a, thi...

来源: Laya_社区 发布时间: 20170721

23. 鼠标交互-双指缩放(多点触控) [ 80%]

...ge.width / 2, Laya.stage.height / 2); Laya.stage.addChild(sp); sp.on(Event.MOUSE_DOWN, this, onMouseDown); } function onMouseDown(e) { var touches = e.touches; if (touches && touches.length == 2) { lastDistance = getDistance(touches); Laya.stage.on(Event.MOUSE_MOVE, this, onMouseMove); } } function ...

来源: Laya_示例 发布时间: 20240929

24. 鼠标交互-Hold [ 79%]

....8, 0.8); Laya.stage.addChild(this.ape); // 鼠标交互 this.ape.on(Event.MOUSE_DOWN, this, this.onApePress); } onApePress(e) { const Event = Laya.Event; // 鼠标按下后,HOLD_TRIGGER_TIME毫秒后hold Laya.timer.once(HOLD_TRIGGER_TIME, this, this.onHold); Laya.stage.on(Event.MOUSE_UP, this, th...

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

25. 鼠标交互-双指缩放(多点触控) [ 79%]

...this.sp.pos(Laya.stage.width / 2, Laya.stage.height / 2); this.sp.on(Event.MOUSE_DOWN, this, this.onMouseDown); } onMouseDown(e) { const Event = Laya.Event; // 手机上才有 touches 属性 let touches = e.touches; if (touches && touches.length == 2) { lastDistance = this.getDistance(touches); Laya...

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

26. 鼠标交互-Hold [ 79%]

...pe.scale(0.8, 0.8); Laya.stage.addChild(ape); // 鼠标交互 ape.on(Event.MOUSE_DOWN, this, onApePress); } function onApePress(e) { // 鼠标按下后,HOLD_TRIGGER_TIME毫秒后hold Laya.timer.once(HOLD_TRIGGER_TIME, this, onHold); Laya.stage.on(Event.MOUSE_UP, this, onApeRelease); } function onH...

来源: Laya_示例 发布时间: 20240929

27. 点击拖动图片,当鼠标移出再移回舞台中时如何保持点击状态 [ 78%]

...中时如何保持点击状态 比如这个打砖块的游戏。用Event.MOUSE_DOWN + startDrag来实现拖动底部的拍子,在电脑上玩时我快速左右拖动来档球,就很容易将鼠标移出舞台,当再移进舞台时,发现拍子不和鼠标走了,需要重新点击,这就...

来源: Laya_社区 发布时间: 20170106

28. on和off的bug [ 78%]

...n和off的bug 是这样的,我写了类似这样的代码a.on(Laya.Event.MOUSE_DOWN, this, onStartDrag); 之后我想去掉拖动,就写了a.off(Laya.Event.MOUSE_DOWN, this, onStartDrag); 但发现不行,于是我改成a.offAll(); 就可以了。 需要说明的是onStartDrag是函数内定义...

来源: Laya_社区 发布时间: 20180828

29. 在微信分享成功的回调函数里,Laya播放音效失败。 [ 78%]

... test.create();  // var test = new Q1Buff1();  Laya.stage.off(Laya.Event.MOUSE_DOWN); Laya.stage.off(Laya.Event.MOUSE_MOVE); Laya.stage.off(Laya.Event.MOUSE_UP) Laya.stage.off(Laya.Event.MOUSE_OUT);  // 鼠标按下事件 Laya.stage.on(Laya.Event.MOUSE_DOWN, this.snakeSelf, this.snakeSelf.onMouse...

来源: Laya_社区 发布时间: 20180514

30. 循环添加一组按钮事件无法正常使用 [ 78%]

...       Laya.stage.addChild(b);                 b.on(Event.MOUSE_DOWN, this, mouseHandler);                 b.on(Event.MOUSE_MOVE, this, mouseHandler);                 b.on(Event.MOUSE_UP, this, mouseHandler);                 trace("addEvent");  ...

来源: Laya_社区 发布时间: 20170517