slambb преди 3 години
родител
ревизия
ed89e6572b

+ 27 - 12
assets/Prefabs/UI/lease/GrantPanel.prefab

@@ -28,11 +28,11 @@
     "_level": 1,
     "_components": [
       {
-        "__id__": 73
+        "__id__": 74
       }
     ],
     "_prefab": {
-      "__id__": 74
+      "__id__": 75
     },
     "_opacity": 255,
     "_color": {
@@ -220,11 +220,11 @@
     "_level": 6,
     "_components": [
       {
-        "__id__": 71
+        "__id__": 72
       }
     ],
     "_prefab": {
-      "__id__": 72
+      "__id__": 73
     },
     "_opacity": 255,
     "_color": {
@@ -1734,13 +1734,13 @@
     "_N$string": "",
     "_fontSize": 20,
     "_lineHeight": 25,
-    "_enableWrapText": false,
+    "_enableWrapText": true,
     "_N$file": null,
     "_isSystemFontUsed": true,
     "_spacingX": 0,
     "_batchAsBitmap": false,
     "_N$horizontalAlign": 0,
-    "_N$verticalAlign": 1,
+    "_N$verticalAlign": 0,
     "_N$fontFamily": "Arial",
     "_N$overflow": 1,
     "_N$cacheMode": 0,
@@ -1883,13 +1883,13 @@
     "_N$string": "输入钱包地址",
     "_fontSize": 20,
     "_lineHeight": 25,
-    "_enableWrapText": false,
+    "_enableWrapText": true,
     "_N$file": null,
     "_isSystemFontUsed": true,
     "_spacingX": 0,
     "_batchAsBitmap": false,
     "_N$horizontalAlign": 0,
-    "_N$verticalAlign": 1,
+    "_N$verticalAlign": 0,
     "_N$fontFamily": "Arial",
     "_N$overflow": 1,
     "_N$cacheMode": 0,
@@ -1944,7 +1944,7 @@
     "_useOriginalSize": false,
     "_string": "",
     "returnType": 0,
-    "maxLength": 8,
+    "maxLength": 64,
     "_tabIndex": 0,
     "editingDidBegan": [],
     "textChanged": [
@@ -1964,7 +1964,7 @@
       "__id__": 43
     },
     "_N$inputFlag": 5,
-    "_N$inputMode": 6,
+    "_N$inputMode": 0,
     "_N$stayOnTop": false,
     "_id": ""
   },
@@ -2068,7 +2068,7 @@
       }
     ],
     "_prefab": {
-      "__id__": 70
+      "__id__": 71
     },
     "_opacity": 255,
     "_color": {
@@ -2361,7 +2361,9 @@
     "duration": 0.1,
     "zoomScale": 1.2,
     "clickEvents": [
-      null
+      {
+        "__id__": 70
+      }
     ],
     "_N$interactable": true,
     "_N$enableAutoGrayEffect": false,
@@ -2432,6 +2434,16 @@
     },
     "_id": ""
   },
+  {
+    "__type__": "cc.ClickEvent",
+    "target": {
+      "__id__": 1
+    },
+    "component": "",
+    "_componentId": "60508qxsq5Ki5juXuLI5EVW",
+    "handler": "onLeaseGrantFruit",
+    "customEventData": ""
+  },
   {
     "__type__": "cc.PrefabInfo",
     "root": {
@@ -2501,6 +2513,9 @@
       "__id__": 32
     },
     "describe": null,
+    "inputInviteValue": 1,
+    "fruitInfo": null,
+    "upTarget": null,
     "_id": ""
   },
   {

+ 170 - 99
assets/Prefabs/UI/seed/HolyFarmlandFruit.prefab

@@ -24,30 +24,30 @@
         "__id__": 5
       },
       {
-        "__id__": 11
+        "__id__": 8
       },
       {
-        "__id__": 17
+        "__id__": 14
+      },
+      {
+        "__id__": 20
       }
     ],
     "_active": true,
     "_level": 1,
     "_components": [
-      {
-        "__id__": 35
-      },
-      {
-        "__id__": 36
-      },
       {
         "__id__": 38
       },
       {
         "__id__": 40
+      },
+      {
+        "__id__": 42
       }
     ],
     "_prefab": {
-      "__id__": 41
+      "__id__": 43
     },
     "_opacity": 255,
     "_color": {
@@ -60,7 +60,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 173,
-      "height": 215
+      "height": 270
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -93,7 +93,7 @@
   },
   {
     "__type__": "cc.Node",
-    "_name": "picture",
+    "_name": "currency_bg_2",
     "_objFlags": 0,
     "_parent": {
       "__id__": 1
@@ -117,6 +117,109 @@
       "b": 255,
       "a": 255
     },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 173,
+      "height": 215
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_position": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 21,
+      "z": 0
+    },
+    "_scale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_eulerAngles": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_is3DNode": false,
+    "groupIndex": 0,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "_materials": [
+      {
+        "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
+      }
+    ],
+    "_srcBlendFactor": 770,
+    "_dstBlendFactor": 771,
+    "_spriteFrame": {
+      "__uuid__": "98c8ea12-e46b-44a1-ba81-d0b5028081e6"
+    },
+    "_type": 0,
+    "_sizeMode": 1,
+    "_fillType": 0,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_atlas": null,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__uuid__": "b056e9fe-07e9-4094-ba81-0b13bafda1aa"
+    },
+    "fileId": "2aJ9f0Wr1Cxp7KWxnEM4PF",
+    "sync": false
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "picture",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [],
+    "_active": true,
+    "_level": 2,
+    "_components": [
+      {
+        "__id__": 6
+      }
+    ],
+    "_prefab": {
+      "__id__": 7
+    },
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 108,
@@ -130,7 +233,7 @@
     "_position": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": 22,
+      "y": 41,
       "z": 0
     },
     "_scale": {
@@ -156,7 +259,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 2
+      "__id__": 5
     },
     "_enabled": true,
     "_materials": [
@@ -203,18 +306,18 @@
     },
     "_children": [
       {
-        "__id__": 6
+        "__id__": 9
       }
     ],
     "_active": true,
     "_level": 3,
     "_components": [
       {
-        "__id__": 9
+        "__id__": 12
       }
     ],
     "_prefab": {
-      "__id__": 10
+      "__id__": 13
     },
     "_opacity": 255,
     "_color": {
@@ -237,7 +340,7 @@
     "_position": {
       "__type__": "cc.Vec3",
       "x": -13,
-      "y": -80,
+      "y": -61,
       "z": 0
     },
     "_scale": {
@@ -263,18 +366,18 @@
     "_name": "Num",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 5
+      "__id__": 8
     },
     "_children": [],
     "_active": true,
     "_level": 4,
     "_components": [
       {
-        "__id__": 7
+        "__id__": 10
       }
     ],
     "_prefab": {
-      "__id__": 8
+      "__id__": 11
     },
     "_opacity": 255,
     "_color": {
@@ -323,7 +426,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 6
+      "__id__": 9
     },
     "_enabled": true,
     "_materials": [
@@ -364,7 +467,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 5
+      "__id__": 8
     },
     "_enabled": true,
     "_materials": [
@@ -412,17 +515,17 @@
     "_level": 3,
     "_components": [
       {
-        "__id__": 12
+        "__id__": 15
       },
       {
-        "__id__": 14
+        "__id__": 17
       },
       {
-        "__id__": 15
+        "__id__": 18
       }
     ],
     "_prefab": {
-      "__id__": 16
+      "__id__": 19
     },
     "_opacity": 255,
     "_color": {
@@ -445,7 +548,7 @@
     "_position": {
       "__type__": "cc.Vec3",
       "x": 75,
-      "y": 102,
+      "y": 121,
       "z": 0
     },
     "_scale": {
@@ -471,14 +574,14 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 11
+      "__id__": 14
     },
     "_enabled": true,
     "duration": 0.1,
     "zoomScale": 1.2,
     "clickEvents": [
       {
-        "__id__": 13
+        "__id__": 16
       }
     ],
     "_N$interactable": true,
@@ -534,7 +637,7 @@
     "hoverSprite": null,
     "_N$disabledSprite": null,
     "_N$target": {
-      "__id__": 11
+      "__id__": 14
     },
     "_id": ""
   },
@@ -553,7 +656,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 11
+      "__id__": 14
     },
     "_enabled": true,
     "_materials": [
@@ -585,7 +688,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 11
+      "__id__": 14
     },
     "_enabled": true,
     "_id": ""
@@ -610,17 +713,17 @@
     },
     "_children": [
       {
-        "__id__": 18
+        "__id__": 21
       },
       {
-        "__id__": 26
+        "__id__": 29
       }
     ],
     "_active": true,
     "_level": 2,
     "_components": [],
     "_prefab": {
-      "__id__": 34
+      "__id__": 37
     },
     "_opacity": 255,
     "_color": {
@@ -643,7 +746,7 @@
     "_position": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": -130,
+      "y": -111,
       "z": 0
     },
     "_scale": {
@@ -669,22 +772,22 @@
     "_name": "grant",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 17
+      "__id__": 20
     },
     "_children": [
       {
-        "__id__": 19
+        "__id__": 22
       }
     ],
     "_active": true,
     "_level": 3,
     "_components": [
       {
-        "__id__": 23
+        "__id__": 26
       }
     ],
     "_prefab": {
-      "__id__": 25
+      "__id__": 28
     },
     "_opacity": 255,
     "_color": {
@@ -733,21 +836,21 @@
     "_name": "Background",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 18
+      "__id__": 21
     },
     "_children": [],
     "_active": true,
     "_level": 2,
     "_components": [
       {
-        "__id__": 20
+        "__id__": 23
       },
       {
-        "__id__": 21
+        "__id__": 24
       }
     ],
     "_prefab": {
-      "__id__": 22
+      "__id__": 25
     },
     "_opacity": 255,
     "_color": {
@@ -796,7 +899,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 19
+      "__id__": 22
     },
     "_enabled": true,
     "_materials": [
@@ -828,7 +931,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 19
+      "__id__": 22
     },
     "_enabled": true,
     "alignMode": 0,
@@ -866,14 +969,14 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 18
+      "__id__": 21
     },
     "_enabled": true,
     "duration": 0.1,
     "zoomScale": 1.2,
     "clickEvents": [
       {
-        "__id__": 24
+        "__id__": 27
       }
     ],
     "_N$interactable": true,
@@ -941,7 +1044,7 @@
       "__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
     },
     "_N$target": {
-      "__id__": 19
+      "__id__": 22
     },
     "_id": ""
   },
@@ -971,22 +1074,22 @@
     "_name": "sale",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 17
+      "__id__": 20
     },
     "_children": [
       {
-        "__id__": 27
+        "__id__": 30
       }
     ],
     "_active": true,
     "_level": 3,
     "_components": [
       {
-        "__id__": 31
+        "__id__": 34
       }
     ],
     "_prefab": {
-      "__id__": 33
+      "__id__": 36
     },
     "_opacity": 255,
     "_color": {
@@ -1035,21 +1138,21 @@
     "_name": "Background",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 26
+      "__id__": 29
     },
     "_children": [],
     "_active": true,
     "_level": 2,
     "_components": [
       {
-        "__id__": 28
+        "__id__": 31
       },
       {
-        "__id__": 29
+        "__id__": 32
       }
     ],
     "_prefab": {
-      "__id__": 30
+      "__id__": 33
     },
     "_opacity": 255,
     "_color": {
@@ -1098,7 +1201,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 27
+      "__id__": 30
     },
     "_enabled": true,
     "_materials": [
@@ -1130,7 +1233,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 27
+      "__id__": 30
     },
     "_enabled": true,
     "alignMode": 0,
@@ -1168,14 +1271,14 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 26
+      "__id__": 29
     },
     "_enabled": true,
     "duration": 0.1,
     "zoomScale": 1.2,
     "clickEvents": [
       {
-        "__id__": 32
+        "__id__": 35
       }
     ],
     "_N$interactable": true,
@@ -1243,7 +1346,7 @@
       "__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
     },
     "_N$target": {
-      "__id__": 27
+      "__id__": 30
     },
     "_id": ""
   },
@@ -1279,38 +1382,6 @@
     "fileId": "aaHIYZrkdBEZeVXY2MZ5Vm",
     "sync": false
   },
-  {
-    "__type__": "cc.Sprite",
-    "_name": "",
-    "_objFlags": 0,
-    "node": {
-      "__id__": 1
-    },
-    "_enabled": true,
-    "_materials": [
-      {
-        "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
-      }
-    ],
-    "_srcBlendFactor": 770,
-    "_dstBlendFactor": 771,
-    "_spriteFrame": {
-      "__uuid__": "98c8ea12-e46b-44a1-ba81-d0b5028081e6"
-    },
-    "_type": 1,
-    "_sizeMode": 0,
-    "_fillType": 0,
-    "_fillCenter": {
-      "__type__": "cc.Vec2",
-      "x": 0,
-      "y": 0
-    },
-    "_fillStart": 0,
-    "_fillRange": 0,
-    "_isTrimmedMode": true,
-    "_atlas": null,
-    "_id": ""
-  },
   {
     "__type__": "cc.Button",
     "_name": "",
@@ -1323,7 +1394,7 @@
     "zoomScale": 1.2,
     "clickEvents": [
       {
-        "__id__": 37
+        "__id__": 39
       }
     ],
     "_N$interactable": true,
@@ -1421,17 +1492,17 @@
     "Synopsis": "可在神农农田播种",
     "consumeType": 2,
     "bgSprite": {
-      "__id__": 3
+      "__id__": 6
     },
     "NumLabel": {
-      "__id__": 7
+      "__id__": 10
     },
     "NameLabel": {
-      "__id__": 9
+      "__id__": 12
     },
     "clickEvents": [
       {
-        "__id__": 39
+        "__id__": 41
       }
     ],
     "_id": ""

Файловите разлики са ограничени, защото са твърде много
+ 154 - 178
assets/Scene/MyCityScene - 004.fire


+ 52 - 33
assets/Script/Lease/LeaseGrantInfo.js

@@ -1,34 +1,34 @@
-
+import gameToast from "../Network/gameToast"
 cc.Class({
     extends: cc.Component,
 
     properties: {
-         grantName: {
-            default: null, 
-            type: cc.Label, 
-            serializable: true,   
+        grantName: {
+            default: null,
+            type: cc.Label,
+            serializable: true,
         },
         amount: {
-            default: null, 
-            type: cc.Label, 
-            serializable: true,   
+            default: null,
+            type: cc.Label,
+            serializable: true,
         },
         //介绍
         describe: {
-            default: null, 
-            type: cc.Label, 
-            serializable: true,   
+            default: null,
+            type: cc.Label,
+            serializable: true,
         },
         inputInviteValue: {
             default: 1,
             visible: false
         },
 
-         //当前操作的果实信息
-         fruitInfo:{
+        //当前操作的果实信息
+        fruitInfo: {
             default: null,
-            serializable: true, 
-            visible:false
+            serializable: true,
+            visible: false
         },
         upTarget: {
             default: null,
@@ -41,39 +41,58 @@ cc.Class({
 
     // onLoad () {},
 
-    start () {
+    start() {
 
     },
 
     /**
      * 赠送
      */
-    onGrant(){
+    onGrant() {
 
     },
 
-    setInfo(grantName,amount){
+    setInfo(grantName, amount) {
         this.grantName.string = grantName;
         this.amount.string = amount;
     },
 
     inputValue(value, e) {
-
-        var numberTemp = new RegExp("^[A-Za-z0-9]+$");
-        if (numberTemp.test(value)) {
-            if(Number(value)>=1){
-                this.inputInviteValue = Number(value);
-            }else{
-                this.inputInviteValue = 1;
-                this.inputContainer.getComponent(cc.EditBox).string = this.inputInviteValue;
-            }
-        } else {
-            this.inputInviteValue = 1;
-            this.inputContainer.getComponent(cc.EditBox).string = this.inputInviteValue;
-            console.log("请输入整数的倍数", this.inputInviteValue);
-        }
+        this.inputInviteValue = value;
     },
-    onclose(){
+    onclose() {
         this.node.destroy();
+    },
+
+    //确定销售果实
+    onLeaseGrantFruit() {
+        //todo 判断一下amount
+        console.log(this.inputInviteValue);
+        if (this.inputInviteValue.length < 20) {
+            gameToast.getInstance().show(cc.find('Canvas/UICamera'), "输入地址", 2, () => {
+                console.log("finish toast!");
+            }, this);
+            return;
+        }
+
+        //默认赠送全部
+        GlobalD.GameData.onGrantFruit({ fruitId: this.fruitInfo.id, amount: Number(this.amount.string), address: this.inputInviteValue }, (res, value) => {
+            // console.log(value);
+            if (value.code === 0) {
+                let NumLabel = this.upTarget.getComponent("Content_Button").NumLabel.getComponent(cc.Label);
+                //这里只隐藏
+                this.upTarget.active = false;
+                NumLabel.string = 0;
+                this.saleAmount.string = 0;
+
+                gameToast.getInstance().show(cc.find('Canvas/UICamera'), value.msg, 2, () => {
+                    console.log("finish toast!");
+                }, this);
+            } else {
+                gameToast.getInstance().show(cc.find('Canvas/UICamera'), value.msg, 2, () => {
+                    console.log("finish toast!");
+                }, this);
+            }
+        });
     }
 });

+ 1 - 1
assets/Script/Lease/LeaseSaleInfo.js

@@ -80,7 +80,7 @@ cc.Class({
                     NumLabel.string = parseInt(NumLabel.string) - this.inputInviteValue;
                     this.saleAmount.string = parseInt(this.saleAmount.string) - this.inputInviteValue;
                 }
-                gameToast.getInstance().show(cc.find('Canvas/UICamera'), "售卖成功!", 2, () => {
+                gameToast.getInstance().show(cc.find('Canvas/UICamera'), "成功售卖了!", 2, () => {
                     console.log("finish toast!");
                 }, this);
             } else {

+ 3 - 1
assets/Script/Network/netUtils.ts

@@ -45,7 +45,9 @@ var utils = {
         //收取果实
         addFruit:'comPlayerGoods/addFruit',
         //出售果实
-        saleFruit:'comPlayerGoods/saleFruit'
+        saleFruit:'comPlayerGoods/saleFruit',
+        //赠送果实
+        grantFruit:'comPlayerGoods/grantFruit'
 
     },
     /** 登录获取的token */

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

@@ -1091,6 +1091,13 @@ cc.Class({
         })
     },
 
+    //赠送果实
+    onGrantFruit(data, callback) {
+        utils.post(utils.api.grantFruit, data, (res, vaule) => {
+            callback(res, vaule);
+        })
+    },
+    
 
     /**
      * 支付cnt操作

Някои файлове не бяха показани, защото твърде много файлове са промени