Browse Source

一键收取按钮功能

slambb 3 years ago
parent
commit
3898ff5ace

File diff suppressed because it is too large
+ 307 - 185
assets/Scene/MyCityScene - 004.fire


+ 2 - 0
assets/Script/Network/netUtils.ts

@@ -59,6 +59,8 @@ var utils = {
         getSeedState: 'comPlayerGoods/getSeedState',
         //收取果实
         addFruit: 'comPlayerGoods/addFruit',
+        //一键偷取全部果实
+        stealAllFruit: 'comPlayerGoods/stealAllFruit',
 
         /**
          * 偷菜时候,收取对方用户果实

+ 4 - 4
assets/Script/adpp/userListInfoItem.js

@@ -26,11 +26,11 @@ cc.Class({
      * 进入其他用户的农场偷菜
      */
     onEnterOtherFarm() {
-        GlobalD.GameData.OtherUserInfo = this.otherUserItem;
-        if (GlobalD.GameData.OtherUserInfo.length <= 0) {
-            console.log('没有用户', GlobalD.GameData.OtherUserInfo);
+        GlobalD.OtherUserInfo = this.otherUserItem;
+        if (GlobalD.OtherUserInfo.length <= 0) {
+            console.log('没有用户', GlobalD.OtherUserInfo);
         }
-        GlobalD.GameData.getOtherUserLandList(GlobalD.GameData.OtherUserInfo.userId);
+        GlobalD.GameData.getOtherUserLandList(GlobalD.OtherUserInfo.userId);
         
     }
 

+ 22 - 0
assets/Script/public/GameData.js

@@ -1158,6 +1158,28 @@ cc.Class({
         })
     },
 
+    //一键偷菜按钮调用
+    onOtherStealAllFunction(){
+        this.onStealAllFruit({otherUserId:GlobalD.OtherUserInfo.userId},(value)=>{
+            console.log(value);
+        });
+    },
+
+    //一键收取果实,偷取
+    onStealAllFruit(data, callback) {
+        if (this.isOnAddFruit) {
+            console.log("一键收取果实过快!");
+            return;
+        }
+        this.isOnAddFruit = true;
+        utils.post(utils.api.stealAllFruit, data, (flag, value) => {
+            this.isOnAddFruit = false;
+            if (flag)
+                callback(value);
+        })
+    },
+    
+
     //偷取用户果实
     onStealFruit(data, callback) {
         if (this.isOnAddFruit) {

BIN
assets/UI/NOther/MainMenu/allStealButton.png


+ 34 - 0
assets/UI/NOther/MainMenu/allStealButton.png.meta

@@ -0,0 +1,34 @@
+{
+  "ver": "2.3.3",
+  "uuid": "66631de7-0e9f-4fc2-bb5a-f90e3295491a",
+  "type": "sprite",
+  "wrapMode": "clamp",
+  "filterMode": "bilinear",
+  "premultiplyAlpha": false,
+  "genMipmaps": false,
+  "packable": true,
+  "platformSettings": {},
+  "subMetas": {
+    "allStealButton": {
+      "ver": "1.0.4",
+      "uuid": "8a596f94-0610-4113-81b4-b418fe7025cf",
+      "rawTextureUuid": "66631de7-0e9f-4fc2-bb5a-f90e3295491a",
+      "trimType": "auto",
+      "trimThreshold": 1,
+      "rotated": false,
+      "offsetX": 0,
+      "offsetY": 0,
+      "trimX": 0,
+      "trimY": 0,
+      "width": 485,
+      "height": 507,
+      "rawWidth": 485,
+      "rawHeight": 507,
+      "borderTop": 0,
+      "borderBottom": 0,
+      "borderLeft": 0,
+      "borderRight": 0,
+      "subMetas": {}
+    }
+  }
+}

BIN
assets/UI/NOther/MainMenu/homeButton.png


+ 34 - 0
assets/UI/NOther/MainMenu/homeButton.png.meta

@@ -0,0 +1,34 @@
+{
+  "ver": "2.3.3",
+  "uuid": "0ab6abf7-90a6-466e-8bba-c11a9f96fc0b",
+  "type": "sprite",
+  "wrapMode": "clamp",
+  "filterMode": "bilinear",
+  "premultiplyAlpha": false,
+  "genMipmaps": false,
+  "packable": true,
+  "platformSettings": {},
+  "subMetas": {
+    "homeButton": {
+      "ver": "1.0.4",
+      "uuid": "a8039082-860a-456c-99e8-162ac3c533b4",
+      "rawTextureUuid": "0ab6abf7-90a6-466e-8bba-c11a9f96fc0b",
+      "trimType": "auto",
+      "trimThreshold": 1,
+      "rotated": false,
+      "offsetX": 0,
+      "offsetY": 0,
+      "trimX": 0,
+      "trimY": 0,
+      "width": 485,
+      "height": 486,
+      "rawWidth": 485,
+      "rawHeight": 486,
+      "borderTop": 0,
+      "borderBottom": 0,
+      "borderLeft": 0,
+      "borderRight": 0,
+      "subMetas": {}
+    }
+  }
+}

Some files were not shown because too many files changed in this diff