cocos在windows触摸电脑上touch事件失效

公司要做触摸电脑的游戏,
需要在一体机(屏幕超级大的那种)上运行,
两个人在两边投篮的游戏。
但是我加上touchstart事件,touchmove事件,touchend事件在手机上完美运行,
但是到了一体机上就挂了,根本没反应
反而点击的时候,生效了。

一体机上用鼠标滑动就可以响应事件,但是用手触摸就不行,
很急,特别需要解决问题。
以下就是代码,鼠标滑动,添加prefab(篮球),同时给球一个定向的初速度。
/给左侧蓝方绑定发射球事件 ----Start—/
this.blue_shootPlace.on(“touchstart”, function (event) {
this.TOUCHS_Blue = true;//按下状态
this.TOUCHE_Blue = false;//按完状态
this.blue_sX = event.currentTouch.getLocationX();
this.blue_sY = event.currentTouch.getLocationY();
//cc.log(event);
}.bind(this),this);

  this.blue_shootPlace.on("touchmove", function (event) {
    this.blue_eX = event.currentTouch.getLocationX();
    this.blue_eY = event.currentTouch.getLocationY();
  }.bind(this),this);
  this.blue_shootPlace.on("touchend", function () {
    this.TOUCHE_Blue = true;//松开状态
    this.TOUCHS_Blue = false;//按下状态
    this.ballCount++;
    if(this.ballCount>0){
      let ball = cc.instantiate(this.basketballBlue);//克隆篮球预置资源
      ball.getComponent(cc.RigidBody).linearVelocity.y = (this.blue_eY-this.blue_sY)*4;
      ball.getComponent(cc.RigidBody).linearVelocity.x = (this.blue_eX-this.blue_sX)*4.8;
      // cc.log(this.eY);
      this.node.addChild(ball);//在场景(Canvas)中添加篮球
    }
    this.touchTimeBlue = 0;
  }.bind(this),this);
  /*给左侧蓝方绑定发射球事件 ----End---*/

真的没有人回答了么?看来还得转战layabox了,这个坑太多了!

1赞

同问!!!!!!!!!!!

cocos2.4.5 一体机win10系统,无法触发TOUCH_MOVE事件 已解决

1赞