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

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

1. 输入设备-摇一摇 [ 100%]

... startShake() { Shake.instance.start(5, 500); Shake.instance.on(Laya.Event.CHANGE, this, onShake); console.text = '开始接收设备摇动\n'; } function onShake() { shakeCount++; console.text += "设备摇晃了" + shakeCount + "次\n"; if (shakeCount >= 3) { Shake.instance.stop(); console.text +=...

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

2. 输入设备-指南针 [ 83%]

...建显示角度的文本 createDegreesText(); Gyroscope.instance.on(Event.CHANGE, this, onOrientationChange); } function createCompass() { compassImg = new Sprite(); Laya.stage.addChild(compassImg); compassImg.loadImage(compassImgPath); compassImg.pivot(compassImg.width / 2, compassImg.height / 2); ...

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

3. UI-CheckBox [ 83%]

...ckBox添加事件使其能够切换标签 if (i == 0) { cb.y += 20; cb.on("change", this, this.updateLabel, [cb]); this.updateLabel(cb); } } } } private createCheckBox(skin: string): CheckBox { var cb: CheckBox = new CheckBox(skin); Laya.stage.addChild(cb); cb.labelColors = "white"; cb.labelSize = 2...

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

4. 输入设备-贪吃蛇(重力感应) [ 83%]

... initSnake(); // 监视加速器状态 Accelerator.instance.on(Laya.Event.CHANGE, this, monitorAccelerator); // 游戏循环 Laya.timer.frameLoop(1, this, animate); // 食物生产 Laya.timer.loop(3000, this, produceFood); // 游戏开始时有一个食物 produceFood(); })() function initSnake() { ...

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