소스 검색

武将奖励 接口对接完毕

zhengniehua 5 년 전
부모
커밋
aada00faa8

+ 146 - 82
tower_sanguo/assets/resources/module/drawRecruit/getGrlReward.prefab

@@ -27,14 +27,14 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 100
+        "__id__": 103
       },
       {
-        "__id__": 101
+        "__id__": 104
       }
     ],
     "_prefab": {
-      "__id__": 102
+      "__id__": 105
     },
     "_opacity": 255,
     "_color": {
@@ -215,7 +215,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "69t8cJFapB2pd6cMbOoNnV",
     "sync": false
@@ -250,19 +250,19 @@
         "__id__": 27
       },
       {
-        "__id__": 77
+        "__id__": 78
       },
       {
-        "__id__": 91
+        "__id__": 93
       },
       {
-        "__id__": 95
+        "__id__": 98
       }
     ],
     "_active": true,
     "_components": [],
     "_prefab": {
-      "__id__": 99
+      "__id__": 102
     },
     "_opacity": 255,
     "_color": {
@@ -436,7 +436,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "54hsTmJ6tIVL923XPe73Ze",
     "sync": false
@@ -543,7 +543,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "a5fmdWy+BK+7A2vVXdQGNQ",
     "sync": false
@@ -650,7 +650,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "8cXGP7z5JHXaBgIK5xozve",
     "sync": false
@@ -759,7 +759,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "591HmiXXdL970AJR8Cyu6v",
     "sync": false
@@ -888,7 +888,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "d3BY7NHBtO1rBCDpks7xn0",
     "sync": false
@@ -995,7 +995,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "4bkfZ/NDJNJqWYjlVyMrG2",
     "sync": false
@@ -1016,9 +1016,13 @@
       }
     ],
     "_active": true,
-    "_components": [],
+    "_components": [
+      {
+        "__id__": 76
+      }
+    ],
     "_prefab": {
-      "__id__": 76
+      "__id__": 77
     },
     "_opacity": 255,
     "_color": {
@@ -1030,8 +1034,8 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 0,
-      "height": 0
+      "width": 274,
+      "height": 200
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -1122,7 +1126,7 @@
       "__type__": "TypedArray",
       "ctor": "Float64Array",
       "array": [
-        0,
+        -76,
         0,
         0,
         0,
@@ -1317,7 +1321,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "96k6X0tddNr7QgIvD8RSxr",
     "sync": false
@@ -1360,7 +1364,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "c4tuHPUqpHurJqiJ8VCzWF",
     "sync": false
@@ -1535,7 +1539,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "e34KpoOyZFxJtez3S8ZeoD",
     "sync": false
@@ -1578,7 +1582,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "64ujdP955Psag3kdcd8oCG",
     "sync": false
@@ -1685,7 +1689,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "afdfpaVzdFdJP4sQx7abiU",
     "sync": false
@@ -1794,7 +1798,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "20syX/dKNLArqZR85UqLXI",
     "sync": false
@@ -1903,7 +1907,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "9fz0jHhXRD8b2rnMIHAIpU",
     "sync": false
@@ -1939,7 +1943,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "ad3L69jsZJZL6qt7zGWzA9",
     "sync": false
@@ -1999,7 +2003,7 @@
       "__type__": "TypedArray",
       "ctor": "Float64Array",
       "array": [
-        0,
+        76,
         0,
         0,
         0,
@@ -2194,7 +2198,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "a7S60ibu1OVr5BSfIwA69z",
     "sync": false
@@ -2237,7 +2241,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "deVt87rxtF0rbPr+va/fAp",
     "sync": false
@@ -2412,7 +2416,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "87QkFQhnlG+ZzmxQOUPxXN",
     "sync": false
@@ -2455,7 +2459,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "36taCx5UJIxYOFxOgDYPvF",
     "sync": false
@@ -2562,7 +2566,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "eczZFmJslPi4vj5I7SrK9c",
     "sync": false
@@ -2671,7 +2675,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "fbAjhze0lKvoNyCaSTj67R",
     "sync": false
@@ -2780,7 +2784,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "8chO/mlsBHtaeZxFn4CqVy",
     "sync": false
@@ -2816,18 +2820,50 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "20FaMC9KRIrq5tAj0hfxLV",
     "sync": false
   },
   {
+    "__type__": "cc.Layout",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 27
+    },
+    "_enabled": true,
+    "_layoutSize": {
+      "__type__": "cc.Size",
+      "width": 274,
+      "height": 200
+    },
+    "_resize": 1,
+    "_N$layoutType": 1,
+    "_N$cellSize": {
+      "__type__": "cc.Size",
+      "width": 40,
+      "height": 40
+    },
+    "_N$startAxis": 0,
+    "_N$paddingLeft": 0,
+    "_N$paddingRight": 0,
+    "_N$paddingTop": 0,
+    "_N$paddingBottom": 0,
+    "_N$spacingX": 30,
+    "_N$spacingY": 0,
+    "_N$verticalDirection": 1,
+    "_N$horizontalDirection": 0,
+    "_N$affectedByScale": false,
+    "_id": ""
+  },
+  {
     "__type__": "cc.PrefabInfo",
     "root": {
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "54X4kpgu5EP5tVGAXvjQqV",
     "sync": false
@@ -2841,20 +2877,20 @@
     },
     "_children": [
       {
-        "__id__": 78
+        "__id__": 79
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 88
+        "__id__": 89
       },
       {
-        "__id__": 89
+        "__id__": 90
       }
     ],
     "_prefab": {
-      "__id__": 90
+      "__id__": 92
     },
     "_opacity": 255,
     "_color": {
@@ -2908,24 +2944,24 @@
     "_name": "layout",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 77
+      "__id__": 78
     },
     "_children": [
       {
-        "__id__": 79
+        "__id__": 80
       },
       {
-        "__id__": 82
+        "__id__": 83
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 86
+        "__id__": 87
       }
     ],
     "_prefab": {
-      "__id__": 87
+      "__id__": 88
     },
     "_opacity": 255,
     "_color": {
@@ -2979,17 +3015,17 @@
     "_name": "icon_hb",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 78
+      "__id__": 79
     },
     "_children": [],
     "_active": true,
     "_components": [
       {
-        "__id__": 80
+        "__id__": 81
       }
     ],
     "_prefab": {
-      "__id__": 81
+      "__id__": 82
     },
     "_opacity": 255,
     "_color": {
@@ -3043,7 +3079,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 79
+      "__id__": 80
     },
     "_enabled": true,
     "_materials": [
@@ -3076,7 +3112,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "45BcGoGOxIiarjuCPCb++4",
     "sync": false
@@ -3086,20 +3122,20 @@
     "_name": "txt",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 78
+      "__id__": 79
     },
     "_children": [],
     "_active": true,
     "_components": [
       {
-        "__id__": 83
+        "__id__": 84
       },
       {
-        "__id__": 84
+        "__id__": 85
       }
     ],
     "_prefab": {
-      "__id__": 85
+      "__id__": 86
     },
     "_opacity": 255,
     "_color": {
@@ -3153,7 +3189,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 82
+      "__id__": 83
     },
     "_enabled": true,
     "_materials": [
@@ -3187,7 +3223,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 82
+      "__id__": 83
     },
     "_enabled": true,
     "_color": {
@@ -3206,7 +3242,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "0d1kcTq2hCwJODYcRAYrPU",
     "sync": false
@@ -3216,7 +3252,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 78
+      "__id__": 79
     },
     "_enabled": true,
     "_layoutSize": {
@@ -3249,7 +3285,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "00oVC3HjZFgI0N3UmKL7Ii",
     "sync": false
@@ -3259,7 +3295,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 77
+      "__id__": 78
     },
     "_enabled": true,
     "_materials": [
@@ -3291,7 +3327,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 77
+      "__id__": 78
     },
     "_enabled": true,
     "_normalMaterial": {
@@ -3300,7 +3336,11 @@
     "_grayMaterial": null,
     "duration": 0.1,
     "zoomScale": 1.2,
-    "clickEvents": [],
+    "clickEvents": [
+      {
+        "__id__": 91
+      }
+    ],
     "_N$interactable": true,
     "_N$enableAutoGrayEffect": false,
     "_N$transition": 3,
@@ -3357,12 +3397,22 @@
     "_id": ""
   },
   {
+    "__type__": "cc.ClickEvent",
+    "target": {
+      "__id__": 1
+    },
+    "component": "",
+    "_componentId": "57f94SR9iNPrLvPvD8KFE0j",
+    "handler": "click_AdBtn",
+    "customEventData": ""
+  },
+  {
     "__type__": "cc.PrefabInfo",
     "root": {
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "79adgFqzBPpZE+Ilgv35Ip",
     "sync": false
@@ -3378,14 +3428,14 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 92
+        "__id__": 94
       },
       {
-        "__id__": 93
+        "__id__": 95
       }
     ],
     "_prefab": {
-      "__id__": 94
+      "__id__": 97
     },
     "_opacity": 255,
     "_color": {
@@ -3439,7 +3489,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 91
+      "__id__": 93
     },
     "_enabled": true,
     "_materials": [
@@ -3473,14 +3523,18 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 91
+      "__id__": 93
     },
     "_enabled": true,
     "_normalMaterial": null,
     "_grayMaterial": null,
     "duration": 0.1,
     "zoomScale": 1.2,
-    "clickEvents": [],
+    "clickEvents": [
+      {
+        "__id__": 96
+      }
+    ],
     "_N$interactable": true,
     "_N$enableAutoGrayEffect": false,
     "_N$transition": 0,
@@ -3537,12 +3591,22 @@
     "_id": ""
   },
   {
+    "__type__": "cc.ClickEvent",
+    "target": {
+      "__id__": 1
+    },
+    "component": "",
+    "_componentId": "57f94SR9iNPrLvPvD8KFE0j",
+    "handler": "click_NorBtn",
+    "customEventData": ""
+  },
+  {
     "__type__": "cc.PrefabInfo",
     "root": {
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "e9lvQOMqNO0ZJoQ0usuQO4",
     "sync": false
@@ -3558,14 +3622,14 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 96
+        "__id__": 99
       },
       {
-        "__id__": 97
+        "__id__": 100
       }
     ],
     "_prefab": {
-      "__id__": 98
+      "__id__": 101
     },
     "_opacity": 255,
     "_color": {
@@ -3619,7 +3683,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 95
+      "__id__": 98
     },
     "_enabled": true,
     "_materials": [
@@ -3651,7 +3715,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 95
+      "__id__": 98
     },
     "_enabled": true,
     "_normalMaterial": {
@@ -3722,7 +3786,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "898XwT9k5L+7zf4gGCtvG5",
     "sync": false
@@ -3733,7 +3797,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "f1NFB5b7BC9r0A5Hk2NgGH",
     "sync": false
@@ -3775,7 +3839,7 @@
     "_enabled": true,
     "mask_type": 0,
     "close_node": {
-      "__id__": 95
+      "__id__": 98
     },
     "design_block_node": {
       "__id__": 2
@@ -3798,10 +3862,10 @@
       "__id__": 18
     },
     "txt_get_type": {
-      "__id__": 83
+      "__id__": 84
     },
     "node_btn_nor": {
-      "__id__": 91
+      "__id__": 93
     },
     "rewardItem1": {
       "__id__": 50
@@ -3817,7 +3881,7 @@
       "__id__": 1
     },
     "asset": {
-      "__id__": 0
+      "__uuid__": "bb70c487-40c0-4bde-82e4-847555b2085a"
     },
     "fileId": "3bAUaMzvVCf6P/6eKvxKJ/",
     "sync": false

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 286 - 155
tower_sanguo/assets/scenes/Test_Znh.fire


+ 3 - 3
tower_sanguo/assets/scripts/data/CommonData.ts

@@ -11,15 +11,15 @@ export default class CommonData {
     }
 
 
-    //appid = 'wxef592f91d2d15555';
-    appid = 'wx17e502b5f230fd9a';
+    appid = 'wxef592f91d2d15555';
+    //appid = 'wx17e502b5f230fd9a';
 
     //用户唯一id,初始通过接口获取
     uin = '';
     /** 玩家uin 仅用于发送错误日志 */
     static uin = '';
 
-    version = '1.0.0';
+    version = '1.0';
 
     /** 
      * 投放渠道: 1巨量 2快手 3广点通

+ 50 - 3
tower_sanguo/assets/scripts/module/drawRecruit/GeneralRewardItem.ts

@@ -5,7 +5,9 @@
 // Learn life-cycle callbacks:
 //  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
 
+import { ViewZorder } from "../../../MOKA/data/ViewZOrder";
 import GameController from "../../GameController";
+import GetGrlRewardUI from "./GetGrlRewardUI";
 
 const { ccclass, property } = cc._decorator;
 
@@ -39,13 +41,25 @@ export default class GeneralRewardItem extends cc.Component {
 
     private general_id: number;
 
+    /*
+    {
+        exp: 0
+        fragment: 0
+        id: 111001
+        lv: 1
+        pos: 0
+        receiveTimes: 0
+        rewardFirstOpen: (2) [{…}, {…}]     //  {num:200,type:3}  type 1 粮草 3 红包币
+        rewardMultiple: 2                   // 2 双倍领取 3 三倍领取
+        star: 1
+        status: 1
+    }
+    */
     Init(data: any) {
         this.general_id = data.id;
         this.node_geted.active = data.receiveTimes == 2;
         this.node_get.active = data.receiveTimes != 2;
-        if (data.rewardFirstOpen != null) {
-            //this.txt_getedhb_num.string=data
-        }
+
         let general = GameController.gameData.getGeneralByID(data.id);
         cc.loader.loadRes("module/drawRecruit/texture/general/bg" + general.color, cc.SpriteFrame, (errr, asset) => {
             if (errr) { return; }
@@ -61,12 +75,45 @@ export default class GeneralRewardItem extends cc.Component {
         });
         this.txt_name.string = general.name;
         this.txt_des.string = general.introduce;
+        if (data.rewardFirstOpen != null) {
+            let num = 0;
+            for (let i = 0; i < data.rewardFirstOpen.length; i++) {
+                if (data.rewardFirstOpen[i].type == 3) {
+                    num += data.rewardFirstOpen[i].num;
+                }
+            }
+            this.txt_getedhb_num.string = num + "";
+        }
     }
 
     click_GetBtn() {
         console.log("you click get btn ");
         GameController.http.openGeneralReward((data) => {
             console.log("--->OpenGeneralReward Data: ", data);
+            if (data.data.code == 1) {
+                this.openGetRewardPanel(data.data.GeneralReward);
+            } else {
+                GameController.uiM.showToast(data.data.msg);
+            }
         }, { id: this.general_id });
     }
+
+    /*
+    {
+        exp: 0
+        fragment: 0
+        id: 111001
+        lv: 1
+        pos: 0
+        receiveTimes: 0
+        rewardFirstOpen: (2) [{…}, {…}]     //  {num:200,type:3}  type 1 粮草 3 红包币
+        rewardMultiple: 2
+        star: 1
+        status: 1
+    }
+    */
+
+    openGetRewardPanel(data: any) {
+        GameController.uiM.openUI(GetGrlRewardUI, null, ViewZorder.UI, null, null, data);
+    }
 }

+ 103 - 1
tower_sanguo/assets/scripts/module/drawRecruit/GetGrlRewardUI.ts

@@ -1,4 +1,7 @@
 import BaseUI from "../../../MOKA/component/BaseUI";
+import { PLAYERPROP } from "../../data/GameDefinition";
+import GameController from "../../GameController";
+import PlayerProp from "../../net/msg/PlayerProp";
 import GrlRewardItem from "./GrlRewardItem";
 
 const { ccclass, property } = cc._decorator;
@@ -20,9 +23,108 @@ export default class GetGrlRewardUI extends BaseUI {
     txt_get_type: cc.Label = null;
     @property({ type: cc.Node, displayName: "按钮_普通领取" })
     node_btn_nor: cc.Node = null;
-    
+
     @property({ type: GrlRewardItem, displayName: "奖励1" })
     rewardItem1: GrlRewardItem = null;
     @property({ type: GrlRewardItem, displayName: "奖励2" })
     rewardItem2: GrlRewardItem = null;
+
+    /*
+    ui_data
+    {
+        exp: 0
+        fragment: 0
+        id: 111001
+        lv: 1
+        pos: 0
+        receiveTimes: 0
+        rewardFirstOpen: (2) [{…}, {…}]     //  {num:200,type:3}  type 1 粮草 3 红包币
+        rewardMultiple: 2                   // 2 双倍领取 3 三倍领取
+        star: 1
+        status: 1
+    }
+    */
+
+    start() {
+        let general = GameController.gameData.getGeneralByID(this.ui_data.id);
+        cc.loader.loadRes("module/general/texture/hero_img/" + general.resource, cc.SpriteFrame, (errr, asset) => {
+            if (errr) { return; }
+            this.img_hero.spriteFrame = asset;
+        });
+        cc.loader.loadRes("module/general/texture/icon_camp_" + general.camp, cc.SpriteFrame, (errr, asset) => {
+            if (errr) { return; }
+            this.img_camp.spriteFrame = asset;
+        });
+        this.txt_name.string = general.name;
+        if (this.ui_data.rewardMultiple == 2) {
+            this.txt_get_type.string = "双倍领取";
+        } else if (this.ui_data.rewardMultiple == 3) {
+            this.txt_get_type.string = "三倍领取";
+        } else {
+            this.txt_get_type.string = "全部领取";
+        }
+        if (this.ui_data.receiveTimes == 1)
+            this.txt_get_type.string = "再次领取";
+
+        let rewards = this.ui_data.rewardFirstOpen;
+        if(rewards!=null){
+            this.rewardItem1.node.active = this.ui_data.receiveTimes == 0;
+            this.rewardItem2.node.active = rewards.length > 1;
+        }else{
+            console.log(" error : rewardFirstOpen null");
+        }
+        console.log("Data:", this.ui_data);
+
+        //this.rewardItem1.Init(rewards[0], this.ui_data.receiveTimes == 1);
+        this.rewardItem1.Init(rewards[0], false);
+        //if (rewards.length > 1)
+        this.rewardItem2.Init(rewards[1], true);
+
+        this.node_btn_nor.active = this.ui_data.receiveTimes == 0;
+    }
+
+    click_NorBtn() {
+
+        GameController.http.receiveReward((data) => {
+            console.log("---->ReceiveReward Data: ", data);
+            if (data.data.code == 1) {
+                let a1 = cc.fadeOut(0.5);
+                let a2 = cc.callFunc(() => {
+                    this.rewardItem1.node.active = false;
+                    this.hideEffect();
+                });
+                this.rewardItem1.node.runAction(cc.sequence(a1, a2));
+                let reward = this.ui_data.rewardFirstOpen[0];
+                if (reward.type == 1) {
+                    GameController.gameData.player.setProp(PLAYERPROP.FOOD, reward.num, true);
+                } else {
+                    GameController.gameData.player.setProp(PLAYERPROP.REDBAG, reward.num, true);
+                }
+            }
+            else {
+                GameController.uiM.showToast(data.data.msg);
+            }
+        }, this.ui_data.id, 0);
+
+    }
+
+    click_AdBtn() {
+        //观看广告
+
+        GameController.http.receiveReward((data) => {
+            console.log("---->ReceiveReward Data: ", data);
+            if (data.data.code == 1) {
+                this.hideEffect();
+                let reward = this.ui_data.rewardFirstOpen[1];
+                if (reward.type == 1) {
+                    GameController.gameData.player.setProp(PLAYERPROP.FOOD, reward.num, true);
+                } else {
+                    GameController.gameData.player.setProp(PLAYERPROP.REDBAG, reward.num, true);
+                }
+            }
+            else {
+                GameController.uiM.showToast(data.data.msg);
+            }
+        }, this.ui_data.id, 1);
+    }
 }

+ 12 - 5
tower_sanguo/assets/scripts/module/drawRecruit/GrlRewardItem.ts

@@ -1,3 +1,5 @@
+import Sciencen_M from "../../../MOKA/util/Sciencen_M";
+
 const { ccclass, property } = cc._decorator;
 
 @ccclass
@@ -21,16 +23,21 @@ export default class GrlRewardItem extends cc.Component {
     /*
     {
         //receiveTimes:0,(0 一个没领 1 领了一个普通领取 2 一次全部领取或第二次领了广告的奖励)
-        isAdReward:0,
-        type:1, 粮草或红包币
+        type:1,  1 粮草 3 红包币
         num:100
     }
     */
-    Init(data: any) {
+
+    /**
+     * 初始化
+     * @param data 数据
+     * @param isAd 是否为广告领取奖励
+    */
+    Init(data: any, isAd: boolean) {
         this.node_lc.active = data.type == 1;
         this.node_hb.active = data.type != 1;
-        this.node_ad.active = data.isAdReward == 1;
+        this.node_ad.active = isAd;
         this.txt_name.string = data.type == 1 ? "粮草" : "红包币";
-        this.txt_num.string = data.num + "";
+        this.txt_num.string = Sciencen_M.instance.format(data.num + "");
     }
 }

+ 19 - 4
tower_sanguo/assets/scripts/net/HttpCommand.ts

@@ -19,10 +19,10 @@ export default class HttpCommand {
     constructor() {
         this.httpM = new HttpManager();
         if (HttpCommand.serverType == 0) {
-            this.serverUrl = 'https://tafang-test.duiweize.com/';//李杨
+            this.serverUrl = 'http://172.16.15.97:9092/';//李杨
         }
         else if (HttpCommand.serverType == 1) {
-            this.serverUrl = 'http://172.16.15.97:9092/';//悍国
+            this.serverUrl = 'http://172.16.15.91:9092/';//悍国
         }
         else if (HttpCommand.serverType == 2) {
             this.serverUrl = 'https://tafang-test.duiweize.com/';//测试服
@@ -53,7 +53,7 @@ export default class HttpCommand {
     connectTest(callback) {
         GameController.commonData.ranKey = Utils.randomString()
         let data = {
-            "mac": "c9:65:e2:1c:b0:24,f6:60:e4:1a:b7:27",
+            "mac": "c9:65:e2:1c:b0:23,f6:60:e4:1a:b7:27",
             "psk": GameController.commonData.ranKey,
             "appId": GameController.commonData.appid
         }
@@ -436,7 +436,7 @@ export default class HttpCommand {
         this.sendData(HTTPTYPE.getBackpackGeneral, {}, callback);
     }
 
-    /** 开启武将奖励
+    /** 领取武将奖励
      * @param callback 回调
      * @param data 传参
     */
@@ -445,6 +445,19 @@ export default class HttpCommand {
     }
 
 
+    /** 开启武将奖励
+      * @param callback 回调
+      * @param generalid 武将id
+      * @param isDouble 是否观看了广告 0 没有 1 有
+     */
+    receiveReward(callback, generalid: number, isDouble: number) {
+        let data: any = {};
+        data.id = generalid;
+        data.isDouble = isDouble;
+        this.sendData(HTTPTYPE.receiveReward, data, callback);
+    }
+
+
     //--------------------------ZNH------------------------
 
     /**
@@ -573,6 +586,8 @@ export enum HTTPTYPE {
     getBackpackGeneral = 'general/getBackpackGeneral',
     /** 开启武将奖励*/
     openGeneralReward = 'general/openGeneralReward',
+    /** 领取武将奖励*/
+    receiveReward = 'general/receiveReward',
     //-------ZNH
 
     updateKeyValueDemo = 'general/updateKeyValueDemo',

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.