Browse Source

推石头优化

chelios 3 years ago
parent
commit
baf83015a8

+ 33 - 4
assets/Script/game/element/JG0109.ts

@@ -32,13 +32,13 @@ export default class JG0109 extends BaseEvent {
         let pullDir = this.getPullDir()
         // cc.log('pullDir : ',pullDir)
         if(pullDir > 0){
-            this.isPull = true;
             this.pullDir = pullDir
             this.showOptTouch(this.pullIcon,
                 () => {
+                    this.isPull = true;
                    this.pull()
                },()=>{
-                   this.isPull = false;
+                    this.stopPull()
                })
         }
     }
@@ -47,8 +47,9 @@ export default class JG0109 extends BaseEvent {
      * @param tag 碰撞组件编号
      */
     public onEnd(tag: number) {
-        this.closeOptTouch()
-        this.isPull = false;
+        if(!this.isPull){
+            this.closeOptTouch()
+        }
     }
     /**
      * 接触到石头后确定方向
@@ -84,15 +85,27 @@ export default class JG0109 extends BaseEvent {
 
     private pull(){
         let pos = cc.v2()
+        let moveV2 = cc.v2()
         if(this.pullDir == 1){
             pos.y = -64
+            moveV2.y = -1
         }else if(this.pullDir == 2){
             pos.y = 64
+            moveV2.y = 1
         }else if(this.pullDir == 3){
             pos.x = 64
+            moveV2.x = 1
         }else if(this.pullDir == 4){
             pos.x = -64
+            moveV2.x = -1
         }
+
+        let mainSprite = this.ff.mainSprite
+        mainSprite.stopJoystick = true
+
+        
+        mainSprite.startMove(moveV2)
+
         let tx = this.node.x + pos.x
         let ty = this.node.y + pos.y
         if(this.ff.mMap.checkCollision(tx,ty)){
@@ -106,10 +119,19 @@ export default class JG0109 extends BaseEvent {
                         cc.moveBy(0.5,pos),
                         cc.callFunc(()=>{})
                     ).start()
+
+                    // cc.tween(this.ff.mainSprite.node).sequence(
+                    //     cc.moveBy(0.5,pos),
+                    //     cc.callFunc(()=>{})
+                    // ).start()
                 }
             }),
             cc.delayTime(0.5),
             cc.callFunc(()=>{
+                if(this.ff.mainSprite.gamePause){
+                    this.stopPull()
+                    return
+                }
                 if(this.isPull){
                     this.pull()
                 }
@@ -117,4 +139,11 @@ export default class JG0109 extends BaseEvent {
         ).start()
     }
 
+    private stopPull(){
+        this.isPull = false;
+        let mainSprite = this.ff.mainSprite
+        mainSprite.stopJoystick = false
+        mainSprite.stopMove()
+    }
+
 }

+ 3 - 0
assets/Script/game/fight/EventButton.ts

@@ -29,6 +29,7 @@ export default class EventButton extends cc.Component {
     public onTouchEvent(startCallback:()=>void,endCallback:()=>void){
         this.startCallback = startCallback;
         this.endCallback = endCallback;
+        this.node.scale = 1
         this.node.on(cc.Node.EventType.TOUCH_START, this._touchShootStartEvent, this);
         this.node.on(cc.Node.EventType.TOUCH_END, this._touchShootEndEvent, this);
         this.node.on(cc.Node.EventType.TOUCH_CANCEL, this._touchShootEndEvent, this);
@@ -45,11 +46,13 @@ export default class EventButton extends cc.Component {
     }
 
     private _touchShootStartEvent() {
+        this.node.scale = 0.9
         if(this.startCallback){
             this.startCallback();
         }
     }
     private _touchShootEndEvent() {
+        this.node.scale = 1
         if(this.endCallback){
             this.endCallback();
         }

+ 7 - 0
assets/Script/game/fight/object/MSprite.ts

@@ -37,6 +37,10 @@ export default class MSprite extends FSprite {
      */
     private speedN = 80000;
     public speedUp: string = "";
+    /**
+     * 当前是否停用遥感
+     */
+    public stopJoystick = false
 
     public start() {
         super.start()
@@ -85,6 +89,9 @@ export default class MSprite extends FSprite {
 
     public setJoystick(mJoystick: Joystick_mag) {
         mJoystick.setListen((speedType: SpeedType, moveVec?: cc.Vec2) => {
+            if(this.stopJoystick){
+                return
+            }
             if (speedType == SpeedType.STOP) {
                 this.stopMove()
             } else {

+ 124 - 108
assets/resources/prefab/map/map1.prefab

@@ -30,26 +30,26 @@
         "__id__": 50
       },
       {
-        "__id__": 1082
+        "__id__": 1083
       },
       {
-        "__id__": 1084
+        "__id__": 1085
       }
     ],
     "_active": true,
     "_components": [
-      {
-        "__id__": 1086
-      },
       {
         "__id__": 1087
       },
       {
         "__id__": 1088
+      },
+      {
+        "__id__": 1089
       }
     ],
     "_prefab": {
-      "__id__": 1089
+      "__id__": 1090
     },
     "_opacity": 255,
     "_color": {
@@ -2127,10 +2127,10 @@
         "__id__": 1027
       },
       {
-        "__id__": 1032
+        "__id__": 1033
       },
       {
-        "__id__": 1037
+        "__id__": 1038
       },
       {
         "__id__": 843
@@ -2139,19 +2139,19 @@
         "__id__": 850
       },
       {
-        "__id__": 1049
+        "__id__": 1050
       },
       {
-        "__id__": 1057
+        "__id__": 1058
       },
       {
-        "__id__": 1069
+        "__id__": 1070
       }
     ],
     "_active": true,
     "_components": [],
     "_prefab": {
-      "__id__": 1081
+      "__id__": 1082
     },
     "_opacity": 255,
     "_color": {
@@ -35503,10 +35503,13 @@
       },
       {
         "__id__": 1030
+      },
+      {
+        "__id__": 1031
       }
     ],
     "_prefab": {
-      "__id__": 1031
+      "__id__": 1032
     },
     "_opacity": 255,
     "_color": {
@@ -35595,7 +35598,7 @@
       "__id__": 1027
     },
     "_enabled": true,
-    "_type": 2,
+    "_type": 1,
     "_allowSleep": true,
     "_gravityScale": 0,
     "_linearDamping": 20,
@@ -35638,6 +35641,19 @@
     },
     "_id": ""
   },
+  {
+    "__type__": "d2b61xa7DpFm488S44n02EQ",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 1027
+    },
+    "_enabled": true,
+    "pullIcon": {
+      "__uuid__": "b1957a0d-b3d0-4e6b-ac36-00efde2b10a1"
+    },
+    "_id": ""
+  },
   {
     "__type__": "cc.PrefabInfo",
     "root": {
@@ -35659,18 +35675,18 @@
     "_children": [],
     "_active": true,
     "_components": [
-      {
-        "__id__": 1033
-      },
       {
         "__id__": 1034
       },
       {
         "__id__": 1035
+      },
+      {
+        "__id__": 1036
       }
     ],
     "_prefab": {
-      "__id__": 1036
+      "__id__": 1037
     },
     "_opacity": 255,
     "_color": {
@@ -35724,7 +35740,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 1032
+      "__id__": 1033
     },
     "_enabled": true,
     "_materials": [
@@ -35756,7 +35772,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 1032
+      "__id__": 1033
     },
     "_enabled": true,
     "_type": 2,
@@ -35781,7 +35797,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 1032
+      "__id__": 1033
     },
     "_enabled": true,
     "tag": 1,
@@ -35805,7 +35821,7 @@
   {
     "__type__": "cc.PrefabInfo",
     "root": {
-      "__id__": 1032
+      "__id__": 1033
     },
     "asset": {
       "__uuid__": "45502707-7b13-4ee2-934a-1eaf3254b1c1"
@@ -35822,17 +35838,14 @@
     },
     "_children": [
       {
-        "__id__": 1038
+        "__id__": 1039
       },
       {
-        "__id__": 1041
+        "__id__": 1042
       }
     ],
     "_active": true,
     "_components": [
-      {
-        "__id__": 1044
-      },
       {
         "__id__": 1045
       },
@@ -35841,10 +35854,13 @@
       },
       {
         "__id__": 1047
+      },
+      {
+        "__id__": 1048
       }
     ],
     "_prefab": {
-      "__id__": 1048
+      "__id__": 1049
     },
     "_opacity": 255,
     "_color": {
@@ -35898,17 +35914,17 @@
     "_name": "spine",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 1037
+      "__id__": 1038
     },
     "_children": [],
     "_active": true,
     "_components": [
       {
-        "__id__": 1039
+        "__id__": 1040
       }
     ],
     "_prefab": {
-      "__id__": 1040
+      "__id__": 1041
     },
     "_opacity": 255,
     "_color": {
@@ -35962,7 +35978,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 1038
+      "__id__": 1039
     },
     "_enabled": true,
     "_materials": [
@@ -36002,7 +36018,7 @@
   {
     "__type__": "cc.PrefabInfo",
     "root": {
-      "__id__": 1037
+      "__id__": 1038
     },
     "asset": {
       "__uuid__": "c1fa2217-e454-46ca-ad7b-31c2afa8adc4"
@@ -36015,17 +36031,17 @@
     "_name": "closeTips",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 1037
+      "__id__": 1038
     },
     "_children": [],
     "_active": false,
     "_components": [
       {
-        "__id__": 1042
+        "__id__": 1043
       }
     ],
     "_prefab": {
-      "__id__": 1043
+      "__id__": 1044
     },
     "_opacity": 255,
     "_color": {
@@ -36079,7 +36095,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 1041
+      "__id__": 1042
     },
     "_enabled": true,
     "_materials": [
@@ -36109,7 +36125,7 @@
   {
     "__type__": "cc.PrefabInfo",
     "root": {
-      "__id__": 1037
+      "__id__": 1038
     },
     "asset": {
       "__uuid__": "c1fa2217-e454-46ca-ad7b-31c2afa8adc4"
@@ -36122,7 +36138,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 1037
+      "__id__": 1038
     },
     "_enabled": true,
     "_type": 0,
@@ -36147,7 +36163,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 1037
+      "__id__": 1038
     },
     "_enabled": true,
     "tag": 1,
@@ -36173,7 +36189,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 1037
+      "__id__": 1038
     },
     "_enabled": true,
     "tag": 0,
@@ -36199,13 +36215,13 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 1037
+      "__id__": 1038
     },
     "_enabled": true,
     "boxId": "28",
     "keyID": 2001,
     "spine": {
-      "__id__": 1039
+      "__id__": 1040
     },
     "closeTips": null,
     "mTipsIcon": {
@@ -36217,7 +36233,7 @@
   {
     "__type__": "cc.PrefabInfo",
     "root": {
-      "__id__": 1037
+      "__id__": 1038
     },
     "asset": {
       "__uuid__": "c1fa2217-e454-46ca-ad7b-31c2afa8adc4"
@@ -36234,23 +36250,23 @@
     },
     "_children": [
       {
-        "__id__": 1050
+        "__id__": 1051
       }
     ],
     "_active": true,
     "_components": [
-      {
-        "__id__": 1053
-      },
       {
         "__id__": 1054
       },
       {
         "__id__": 1055
+      },
+      {
+        "__id__": 1056
       }
     ],
     "_prefab": {
-      "__id__": 1056
+      "__id__": 1057
     },
     "_opacity": 255,
     "_color": {
@@ -36304,17 +36320,17 @@
     "_name": "2001",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 1049
+      "__id__": 1050
     },
     "_children": [],
     "_active": true,
     "_components": [
       {
-        "__id__": 1051
+        "__id__": 1052
       }
     ],
     "_prefab": {
-      "__id__": 1052
+      "__id__": 1053
     },
     "_opacity": 255,
     "_color": {
@@ -36368,7 +36384,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 1050
+      "__id__": 1051
     },
     "_enabled": true,
     "_materials": [
@@ -36398,7 +36414,7 @@
   {
     "__type__": "cc.PrefabInfo",
     "root": {
-      "__id__": 1049
+      "__id__": 1050
     },
     "asset": {
       "__uuid__": "1cc87fa7-097b-4f10-aecb-49dcb1713bac"
@@ -36411,7 +36427,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 1049
+      "__id__": 1050
     },
     "_enabled": true,
     "_type": 0,
@@ -36436,7 +36452,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 1049
+      "__id__": 1050
     },
     "_enabled": true,
     "tag": 0,
@@ -36462,7 +36478,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 1049
+      "__id__": 1050
     },
     "_enabled": true,
     "goodId": 2001,
@@ -36471,7 +36487,7 @@
   {
     "__type__": "cc.PrefabInfo",
     "root": {
-      "__id__": 1049
+      "__id__": 1050
     },
     "asset": {
       "__uuid__": "1cc87fa7-097b-4f10-aecb-49dcb1713bac"
@@ -36488,17 +36504,14 @@
     },
     "_children": [
       {
-        "__id__": 1058
+        "__id__": 1059
       },
       {
-        "__id__": 1061
+        "__id__": 1062
       }
     ],
     "_active": true,
     "_components": [
-      {
-        "__id__": 1064
-      },
       {
         "__id__": 1065
       },
@@ -36507,10 +36520,13 @@
       },
       {
         "__id__": 1067
+      },
+      {
+        "__id__": 1068
       }
     ],
     "_prefab": {
-      "__id__": 1068
+      "__id__": 1069
     },
     "_opacity": 255,
     "_color": {
@@ -36564,17 +36580,17 @@
     "_name": "monster56",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 1057
+      "__id__": 1058
     },
     "_children": [],
     "_active": true,
     "_components": [
       {
-        "__id__": 1059
+        "__id__": 1060
       }
     ],
     "_prefab": {
-      "__id__": 1060
+      "__id__": 1061
     },
     "_opacity": 255,
     "_color": {
@@ -36628,7 +36644,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 1058
+      "__id__": 1059
     },
     "_enabled": true,
     "_materials": [
@@ -36668,7 +36684,7 @@
   {
     "__type__": "cc.PrefabInfo",
     "root": {
-      "__id__": 1057
+      "__id__": 1058
     },
     "asset": {
       "__uuid__": "267f577b-890c-4697-9ffd-299a99461bf9"
@@ -36681,17 +36697,17 @@
     "_name": "New Sprite",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 1057
+      "__id__": 1058
     },
     "_children": [],
     "_active": true,
     "_components": [
       {
-        "__id__": 1062
+        "__id__": 1063
       }
     ],
     "_prefab": {
-      "__id__": 1063
+      "__id__": 1064
     },
     "_opacity": 255,
     "_color": {
@@ -36745,7 +36761,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 1061
+      "__id__": 1062
     },
     "_enabled": true,
     "_materials": [
@@ -36775,7 +36791,7 @@
   {
     "__type__": "cc.PrefabInfo",
     "root": {
-      "__id__": 1057
+      "__id__": 1058
     },
     "asset": {
       "__uuid__": "267f577b-890c-4697-9ffd-299a99461bf9"
@@ -36788,7 +36804,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 1057
+      "__id__": 1058
     },
     "_enabled": true,
     "_type": 0,
@@ -36813,7 +36829,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 1057
+      "__id__": 1058
     },
     "_enabled": true,
     "tag": 0,
@@ -36839,7 +36855,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 1057
+      "__id__": 1058
     },
     "_enabled": true,
     "tag": 1,
@@ -36865,7 +36881,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 1057
+      "__id__": 1058
     },
     "_enabled": true,
     "mMapDialog": {
@@ -36878,7 +36894,7 @@
     ],
     "text2": [],
     "icon": {
-      "__id__": 1061
+      "__id__": 1062
     },
     "mTipsIcon": {
       "__uuid__": "20e3b4bd-3d62-48eb-8282-6c1be7c5c564"
@@ -36890,7 +36906,7 @@
   {
     "__type__": "cc.PrefabInfo",
     "root": {
-      "__id__": 1057
+      "__id__": 1058
     },
     "asset": {
       "__uuid__": "267f577b-890c-4697-9ffd-299a99461bf9"
@@ -36907,17 +36923,14 @@
     },
     "_children": [
       {
-        "__id__": 1070
+        "__id__": 1071
       },
       {
-        "__id__": 1073
+        "__id__": 1074
       }
     ],
     "_active": true,
     "_components": [
-      {
-        "__id__": 1076
-      },
       {
         "__id__": 1077
       },
@@ -36926,10 +36939,13 @@
       },
       {
         "__id__": 1079
+      },
+      {
+        "__id__": 1080
       }
     ],
     "_prefab": {
-      "__id__": 1080
+      "__id__": 1081
     },
     "_opacity": 255,
     "_color": {
@@ -36983,17 +36999,17 @@
     "_name": "monster56",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 1069
+      "__id__": 1070
     },
     "_children": [],
     "_active": true,
     "_components": [
       {
-        "__id__": 1071
+        "__id__": 1072
       }
     ],
     "_prefab": {
-      "__id__": 1072
+      "__id__": 1073
     },
     "_opacity": 255,
     "_color": {
@@ -37047,7 +37063,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 1070
+      "__id__": 1071
     },
     "_enabled": true,
     "_materials": [
@@ -37087,7 +37103,7 @@
   {
     "__type__": "cc.PrefabInfo",
     "root": {
-      "__id__": 1069
+      "__id__": 1070
     },
     "asset": {
       "__uuid__": "267f577b-890c-4697-9ffd-299a99461bf9"
@@ -37100,17 +37116,17 @@
     "_name": "New Sprite",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 1069
+      "__id__": 1070
     },
     "_children": [],
     "_active": true,
     "_components": [
       {
-        "__id__": 1074
+        "__id__": 1075
       }
     ],
     "_prefab": {
-      "__id__": 1075
+      "__id__": 1076
     },
     "_opacity": 255,
     "_color": {
@@ -37164,7 +37180,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 1073
+      "__id__": 1074
     },
     "_enabled": true,
     "_materials": [
@@ -37194,7 +37210,7 @@
   {
     "__type__": "cc.PrefabInfo",
     "root": {
-      "__id__": 1069
+      "__id__": 1070
     },
     "asset": {
       "__uuid__": "267f577b-890c-4697-9ffd-299a99461bf9"
@@ -37207,7 +37223,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 1069
+      "__id__": 1070
     },
     "_enabled": true,
     "_type": 0,
@@ -37232,7 +37248,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 1069
+      "__id__": 1070
     },
     "_enabled": true,
     "tag": 0,
@@ -37258,7 +37274,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 1069
+      "__id__": 1070
     },
     "_enabled": true,
     "tag": 1,
@@ -37284,7 +37300,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 1069
+      "__id__": 1070
     },
     "_enabled": true,
     "mMapDialog": {
@@ -37308,7 +37324,7 @@
       "0|我忽然想起了一些事,告辞。金色泉水……"
     ],
     "icon": {
-      "__id__": 1073
+      "__id__": 1074
     },
     "mTipsIcon": {
       "__uuid__": "20e3b4bd-3d62-48eb-8282-6c1be7c5c564"
@@ -37320,7 +37336,7 @@
   {
     "__type__": "cc.PrefabInfo",
     "root": {
-      "__id__": 1069
+      "__id__": 1070
     },
     "asset": {
       "__uuid__": "267f577b-890c-4697-9ffd-299a99461bf9"
@@ -37350,7 +37366,7 @@
     "_active": true,
     "_components": [],
     "_prefab": {
-      "__id__": 1083
+      "__id__": 1084
     },
     "_opacity": 255,
     "_color": {
@@ -37421,7 +37437,7 @@
     "_active": true,
     "_components": [],
     "_prefab": {
-      "__id__": 1085
+      "__id__": 1086
     },
     "_opacity": 255,
     "_color": {
@@ -37446,7 +37462,7 @@
       "ctor": "Float64Array",
       "array": [
         3524.551,
-        1856.622,
+        1850.627,
         0,
         0,
         0,
@@ -37493,7 +37509,7 @@
       "__id__": 50
     },
     "mInit": {
-      "__id__": 1084
+      "__id__": 1085
     },
     "mRooms": {
       "__id__": 36
@@ -37516,7 +37532,7 @@
     },
     "_enabled": true,
     "npc_1": {
-      "__id__": 1057
+      "__id__": 1058
     },
     "_id": ""
   },
@@ -37529,7 +37545,7 @@
     },
     "_enabled": true,
     "ncp_1": {
-      "__id__": 1069
+      "__id__": 1070
     },
     "_id": ""
   },