xx 1 year ago
parent
commit
eb04c6c06a
1 changed files with 9 additions and 4 deletions
  1. 9 4
      assets/script/game/touch.ts

+ 9 - 4
assets/script/game/touch.ts

@@ -28,7 +28,9 @@ export class touch extends Component {
         },this)
 
         this.node.on(Node.EventType.TOUCH_MOVE,(et:EventTouch)=>{
-
+            if(this.CurTouchId!=et.getID()){
+                return
+            }
             if(this.start_node!=null){
                 // let n = this.getClickPos(et.getUILocation().x)
                 // if(n!=null&&n!=this.start_node){
@@ -102,9 +104,12 @@ export class touch extends Component {
     }
 
     _touchEndEvent(et:EventTouch){
-        this.CurTouchId = -1;
-        this.mDir = DirType.NONE
-        this.mCar.setDir(this.mDir)
+        if(this.CurTouchId==et.getID()){
+            this.CurTouchId = -1;
+            this.mDir = DirType.NONE
+            this.mCar.setDir(this.mDir)
+        }
+  
     }
     update(deltaTime: number) {