-
Creator 版本:
-
目标平台:
-
重现方式:频繁的操作TouchStart或者Move,Move按下就会没反应,得手在抬起来才会生效,安卓没有重现过,就只有ios 容易重现,没有固定的重现方式,就是频繁操作会重现
-
首个报错:
-
之前哪个版本是正常的: <–>
-
手机型号:
-
手机浏览器:
-
编辑器操作系统:
-
重现概率:
以下是轮盘的调用
this.bg.on(Node.EventType.TOUCH_START, this.CrossTouchMove, this)
this.bg.on(Node.EventType.TOUCH_MOVE, this.CrossTouchMove, this)
this.bg.on(Node.EventType.TOUCH_END, this.EndClick, this)
this.bg.on(Node.EventType.TOUCH_CANCEL, this.EndClick, this)
离开轮盘
EndClick(event: EventTouch) {
this.ElonRLSprite = this._Dir;
this._Dir = 0;
this.CrossLeft.getComponent(Sprite).spriteFrame = this.CrossDark;
this.CrossRight.getComponent(Sprite).spriteFrame = this.CrossDark;
}
按下和拖动轮盘
CrossTouchMove(event: EventTouch) {
try {
let Screen = event.getLocation();
let WorldPoint = this.camera.screenToWorld(new Vec3(Screen.x, Screen.y))
let pos = this.bg.getComponent(UITransformComponent).convertToNodeSpaceAR(new Vec3(WorldPoint.x + this.UICamera.position.x, WorldPoint.y + this.UICamera.position.y))
let pos_ = pos.normalize();
if (pos_.x > 0) {
this._Dir = 0.7;
this.IsMove = true;
}
else {
this._Dir = -0.7;
this.IsMove = true;
}
} catch (error) {
console.log("出错", error);
}
}
以下是 按键调用
this.JumpButtonClick.on(Node.EventType.TOUCH_START, this.TouchStartJump, this);
this.JumpButtonClick.on(Node.EventType.TOUCH_END, this.TouchEndJump, this);
this.BombButtonClick.on(Node.EventType.TOUCH_START, this.createBomb, this)
this.TimingButtonClick.on(Node.EventType.TOUCH_START, this.TimingBomb, this)
生成炸弹的按键
createBomb() {
if (this.Bombparet.children.length < Player.BombNum) {
let bombPosX = Math.ceil(this.player.position.x/78)*78;
let bombposY = Math.ceil(this.player.position.y/78)*78;
let bombpos = new Vec2(bombPosX-39 ,bombposY-39);
for (let index = 0; index < this.BombPosArray.length; index++) {
let array = this.BombPosArray[index];
if (bombpos.x=== array[0]&&bombpos.y=== array[1]) {
console.log("有相同的位置");
return;
}
}
var BombClone = instantiate(this.Bombprefab);
BombClone.setParent(this.Bombparet)
BombClone.name = BombClone.name+this.BombNameInde.toString();
if (this.BombNameInde<3) {
this.BombNameInde++;
}
else{
this.BombNameInde=1;
}
const pos = this.node.position
BombClone.setPosition(bombpos.x,bombpos.y);
this.BombPosArray.push([Math.ceil(BombClone.position.x),Math.ceil(BombClone.position.y)] );
if (Player.Istiming === true) {
this.BombArray.push(BombClone)
}
}
}
定时炸弹
TimingBomb() {
if (Player.Istiming === true) {
if (this.BombArray.length>0) {
this.TestNearBombBlast();
if (isValid(this.BombArray[0],true)) {
const elementcomp = this.BombArray[0].getComponent(Bomb);
elementcomp.OnBombRange();
//this.BombPosArray.splice(0,1);
}
}
this.cc(this.BombArray);
//this.cc(this.NearBombArray);
}
}
/**
* 跳跃
* @param height 高度
*/
Jump(height: number) {
if (this.IsJump && this.IsJump2) {
if (this.JumN > 0) {
AudioSourceManager.inst.playOneShot("Music/SoundEffect/跳");
//this.PlayerAnim.stop();
this.rig.linearVelocity = new Vec2(0, height);
if (this.rig.linearVelocity.y!=0) {
this.JumN -= 1
}
this.IsJump = false;
this.IsJump2 = false;
this.scheduleOnce(() => void (this.IsJump = true), 0.2);
}
}
一共是一个轮盘的Touch事件,还有三个按键的touch事件
主要问题在轮盘上,当频繁按下跳跃键或者放炸弹的按键后,去轮盘上拖动时,有时候会拖动失效,从新拖动就又可以了。 按键和轮盘操作是同时进行的,就是一直在频繁的按下拖动离开轮盘,同时进行按下跳跃按键和放炸弹按键。没有固定的重现方式,按了快一个星期了手都快玩废了,就是没有固定的重现方式,完全随机