future 1 rok temu
rodzic
commit
3827e27f83
1 zmienionych plików z 9 dodań i 2 usunięć
  1. 9 2
      assets/script/run/game_list_view/game_list.ts

+ 9 - 2
assets/script/run/game_list_view/game_list.ts

@@ -22,6 +22,7 @@ export class game_list extends Component {
     private m_data:LevelMessage = null;
     private m_data:LevelMessage = null;
     private x_len:number = 0;
     private x_len:number = 0;
     private onTouchActive:boolean = true;
     private onTouchActive:boolean = true;
+    private start_pos:Vec2 = Vec2.ZERO;
     public initView(finish_call,call_back){
     public initView(finish_call,call_back){
         this.m_back_call = call_back;
         this.m_back_call = call_back;
         this.m_loading_finish_call = finish_call;
         this.m_loading_finish_call = finish_call;
@@ -72,8 +73,14 @@ export class game_list extends Component {
         this.content.off(Node.EventType.TOUCH_END)
         this.content.off(Node.EventType.TOUCH_END)
         this.content.off(Node.EventType.TOUCH_CANCEL)
         this.content.off(Node.EventType.TOUCH_CANCEL)
 
 
-        this.content.on(Node.EventType.TOUCH_START,(et:EventTouch)=>{})
+        this.content.on(Node.EventType.TOUCH_START,(et:EventTouch)=>{
+            this.start_pos = et.getUILocation()
+        })
         this.content.on(Node.EventType.TOUCH_MOVE,(et:EventTouch)=>{
         this.content.on(Node.EventType.TOUCH_MOVE,(et:EventTouch)=>{
+            if( Math.abs(this.start_pos.x-et.getUILocation().x)<30){
+                this.start_pos = et.getUILocation()
+                return
+            }
             let p = new Vec3(et.getUILocation().x,et.getUILocation().y)
             let p = new Vec3(et.getUILocation().x,et.getUILocation().y)
             let n_p = this.content.parent.getComponent(UITransform).convertToNodeSpaceAR(p)
             let n_p = this.content.parent.getComponent(UITransform).convertToNodeSpaceAR(p)
             let pos = this.content.parent.getComponent(UITransform).convertToWorldSpaceAR(this.content.position)
             let pos = this.content.parent.getComponent(UITransform).convertToWorldSpaceAR(this.content.position)
@@ -118,7 +125,7 @@ export class game_list extends Component {
         this.unscheduleAllCallbacks()
         this.unscheduleAllCallbacks()
         this.scheduleOnce(()=> {
         this.scheduleOnce(()=> {
             this.onTouchActive = true
             this.onTouchActive = true
-        },0.5)
+        },1)
     }
     }
 
 
     onUpPage(){
     onUpPage(){