Jelajahi Sumber

粮草界面逻辑

薛鸿潇 5 tahun lalu
induk
melakukan
c6ba0a31ba

File diff ditekan karena terlalu besar
+ 202 - 101
tower_sanguo/assets/resources/data/mission_data.json


+ 5 - 4
tower_sanguo/assets/resources/data/serverConfig_data.json

@@ -7,10 +7,10 @@
 	"initHero": "111001,111002,111003,111004,112005,112006,112007,112008,113009,113010,113011,113012,113013,113014,113015,114016,121001,121002,122003,122004,122005,122006,123007,123008,123009,123010,123011,123012,123013,124014,131001,131002,131003,132004,132005,132006,132007,133008,133009,133010,133011,133012,133013,134014,141001,141002,141003,141004,142005,142006,142007,142008,142009,142010,143011,143012,143013,143014,143015,144016",
 	"initHero": "111001,111002,111003,111004,112005,112006,112007,112008,113009,113010,113011,113012,113013,113014,113015,114016,121001,121002,122003,122004,122005,122006,123007,123008,123009,123010,123011,123012,123013,124014,131001,131002,131003,132004,132005,132006,132007,133008,133009,133010,133011,133012,133013,134014,141001,141002,141003,141004,142005,142006,142007,142008,142009,142010,143011,143012,143013,143014,143015,144016",
 	"criMul": 1.5,
 	"criMul": 1.5,
 	"heroStar": 7,
 	"heroStar": 7,
-	"food": 100000,
-	"yb": 100000,
+	"food": 10000,
+	"yb": 1000,
 	"redbag": 0,
 	"redbag": 0,
-	"prestige": 100000,
+	"prestige": 0,
 	"invite_cost": 2000,
 	"invite_cost": 2000,
 	"invite_discount": 0.9,
 	"invite_discount": 0.9,
 	"invite_wish_quality": "2,3,4",
 	"invite_wish_quality": "2,3,4",
@@ -30,5 +30,6 @@
 	"turntable_payTime": 8,
 	"turntable_payTime": 8,
 	"turntable_recover": "12,18,24",
 	"turntable_recover": "12,18,24",
 	"dailyDropLimit": 20,
 	"dailyDropLimit": 20,
-	"saveLimit": 20
+	"saveLimit": 20,
+	"videofoodtime": 10
 }
 }

+ 10 - 10
tower_sanguo/assets/resources/module/fight/fight.prefab

@@ -1249,7 +1249,7 @@
     "asset": {
     "asset": {
       "__uuid__": "42451b9d-0b8f-43df-bba7-24efa7828d8c"
       "__uuid__": "42451b9d-0b8f-43df-bba7-24efa7828d8c"
     },
     },
-    "fileId": "b72RsHExBBLIWK1vL6sLfj",
+    "fileId": "e3b3Mdvp1E7Imwex2krdgL",
     "sync": false
     "sync": false
   },
   },
   {
   {
@@ -1379,7 +1379,7 @@
     "asset": {
     "asset": {
       "__uuid__": "42451b9d-0b8f-43df-bba7-24efa7828d8c"
       "__uuid__": "42451b9d-0b8f-43df-bba7-24efa7828d8c"
     },
     },
-    "fileId": "c0/7e5XtpFV4Fq+hV0nyA4",
+    "fileId": "728deWHAxAboPugG09iEk6",
     "sync": false
     "sync": false
   },
   },
   {
   {
@@ -1975,7 +1975,7 @@
     "asset": {
     "asset": {
       "__uuid__": "42451b9d-0b8f-43df-bba7-24efa7828d8c"
       "__uuid__": "42451b9d-0b8f-43df-bba7-24efa7828d8c"
     },
     },
-    "fileId": "89bK/z5i5IV7QEi+3rH9p5",
+    "fileId": "27X3pEhm9NlLOUBiBazl2a",
     "sync": false
     "sync": false
   },
   },
   {
   {
@@ -2105,7 +2105,7 @@
     "asset": {
     "asset": {
       "__uuid__": "42451b9d-0b8f-43df-bba7-24efa7828d8c"
       "__uuid__": "42451b9d-0b8f-43df-bba7-24efa7828d8c"
     },
     },
-    "fileId": "55puqxQyhDkquY1V5Cw6es",
+    "fileId": "a1aU7FP4VKYJ0jpf7Z74q0",
     "sync": false
     "sync": false
   },
   },
   {
   {
@@ -2701,7 +2701,7 @@
     "asset": {
     "asset": {
       "__uuid__": "42451b9d-0b8f-43df-bba7-24efa7828d8c"
       "__uuid__": "42451b9d-0b8f-43df-bba7-24efa7828d8c"
     },
     },
-    "fileId": "c0MhZiLV1Etpz/E2vjWKuA",
+    "fileId": "3doWVkDulLx7Z6NZf5hDUK",
     "sync": false
     "sync": false
   },
   },
   {
   {
@@ -2831,7 +2831,7 @@
     "asset": {
     "asset": {
       "__uuid__": "42451b9d-0b8f-43df-bba7-24efa7828d8c"
       "__uuid__": "42451b9d-0b8f-43df-bba7-24efa7828d8c"
     },
     },
-    "fileId": "3464WCcKNN05gI0BSQ2zVa",
+    "fileId": "a2WDofGIRN76jbYAAuH79H",
     "sync": false
     "sync": false
   },
   },
   {
   {
@@ -3427,7 +3427,7 @@
     "asset": {
     "asset": {
       "__uuid__": "42451b9d-0b8f-43df-bba7-24efa7828d8c"
       "__uuid__": "42451b9d-0b8f-43df-bba7-24efa7828d8c"
     },
     },
-    "fileId": "a0u0Bq3dZFjpCftN+PH8Ji",
+    "fileId": "1d7dKbOgFGvp1blxL94A4r",
     "sync": false
     "sync": false
   },
   },
   {
   {
@@ -3557,7 +3557,7 @@
     "asset": {
     "asset": {
       "__uuid__": "42451b9d-0b8f-43df-bba7-24efa7828d8c"
       "__uuid__": "42451b9d-0b8f-43df-bba7-24efa7828d8c"
     },
     },
-    "fileId": "caQYXwEslKeoY5z942xXpw",
+    "fileId": "5aHhJJBWlA4qYGthVYRiu8",
     "sync": false
     "sync": false
   },
   },
   {
   {
@@ -4153,7 +4153,7 @@
     "asset": {
     "asset": {
       "__uuid__": "42451b9d-0b8f-43df-bba7-24efa7828d8c"
       "__uuid__": "42451b9d-0b8f-43df-bba7-24efa7828d8c"
     },
     },
-    "fileId": "c1sKoFpwxMKoftsT+l8HL7",
+    "fileId": "51xrkET4pJjZ9IM+rFwqmG",
     "sync": false
     "sync": false
   },
   },
   {
   {
@@ -4283,7 +4283,7 @@
     "asset": {
     "asset": {
       "__uuid__": "42451b9d-0b8f-43df-bba7-24efa7828d8c"
       "__uuid__": "42451b9d-0b8f-43df-bba7-24efa7828d8c"
     },
     },
-    "fileId": "4bo1LXXvxL/5+qTa7lvG7n",
+    "fileId": "55BTOVpDZNJYnCte1PqJx6",
     "sync": false
     "sync": false
   },
   },
   {
   {

+ 122 - 110
tower_sanguo/assets/resources/module/getLiangCao/get_liangcao.prefab

@@ -684,13 +684,13 @@
         "__id__": 47
         "__id__": 47
       },
       },
       {
       {
-        "__id__": 49
+        "__id__": 61
       },
       },
       {
       {
-        "__id__": 63
+        "__id__": 65
       },
       },
       {
       {
-        "__id__": 67
+        "__id__": 69
       }
       }
     ],
     ],
     "_active": true,
     "_active": true,
@@ -1544,7 +1544,7 @@
   },
   },
   {
   {
     "__type__": "cc.Node",
     "__type__": "cc.Node",
-    "_name": "lbl_lc_count",
+    "_name": "lbl_lc_times",
     "_objFlags": 0,
     "_objFlags": 0,
     "_parent": {
     "_parent": {
       "__id__": 35
       "__id__": 35
@@ -1805,77 +1805,6 @@
   },
   },
   {
   {
     "__type__": "cc.Node",
     "__type__": "cc.Node",
-    "_name": "New Node",
-    "_objFlags": 0,
-    "_parent": {
-      "__id__": 16
-    },
-    "_children": [],
-    "_active": true,
-    "_components": [],
-    "_prefab": {
-      "__id__": 48
-    },
-    "_opacity": 255,
-    "_color": {
-      "__type__": "cc.Color",
-      "r": 255,
-      "g": 255,
-      "b": 255,
-      "a": 255
-    },
-    "_contentSize": {
-      "__type__": "cc.Size",
-      "width": 600,
-      "height": 350
-    },
-    "_anchorPoint": {
-      "__type__": "cc.Vec2",
-      "x": 0.5,
-      "y": 0.5
-    },
-    "_trs": {
-      "__type__": "TypedArray",
-      "ctor": "Float64Array",
-      "array": [
-        0,
-        -144.081,
-        0,
-        0,
-        0,
-        0,
-        1,
-        1,
-        1,
-        1
-      ]
-    },
-    "_eulerAngles": {
-      "__type__": "cc.Vec3",
-      "x": 0,
-      "y": 0,
-      "z": 0
-    },
-    "_skewX": 0,
-    "_skewY": 0,
-    "_is3DNode": false,
-    "_groupIndex": 0,
-    "groupIndex": 0,
-    "_id": ""
-  },
-  {
-    "__type__": "cc.PrefabInfo",
-    "root": {
-      "__id__": 1
-    },
-    "asset": {
-      "__uuid__": "94ac848f-6478-4b7f-8c5e-66aa9f6c3147"
-    },
-    "fileId": "987b1FCrJGpbljTWKWQ6sw",
-    "sync": false
-  },
-  {
-    "__type__": "cc.Node",
     "_name": "btn_get_lv",
     "_name": "btn_get_lv",
     "_objFlags": 0,
     "_objFlags": 0,
     "_parent": {
     "_parent": {
@@ -1883,20 +1812,20 @@
     },
     },
     "_children": [
     "_children": [
       {
       {
-        "__id__": 50
+        "__id__": 48
       }
       }
     ],
     ],
     "_active": true,
     "_active": true,
     "_components": [
     "_components": [
       {
       {
-        "__id__": 60
+        "__id__": 58
       },
       },
       {
       {
-        "__id__": 61
+        "__id__": 59
       }
       }
     ],
     ],
     "_prefab": {
     "_prefab": {
-      "__id__": 62
+      "__id__": 60
     },
     },
     "_opacity": 255,
     "_opacity": 255,
     "_color": {
     "_color": {
@@ -1950,24 +1879,24 @@
     "_name": "Layout",
     "_name": "Layout",
     "_objFlags": 0,
     "_objFlags": 0,
     "_parent": {
     "_parent": {
-      "__id__": 49
+      "__id__": 47
     },
     },
     "_children": [
     "_children": [
       {
       {
-        "__id__": 51
+        "__id__": 49
       },
       },
       {
       {
-        "__id__": 54
+        "__id__": 52
       }
       }
     ],
     ],
     "_active": true,
     "_active": true,
     "_components": [
     "_components": [
       {
       {
-        "__id__": 58
+        "__id__": 56
       }
       }
     ],
     ],
     "_prefab": {
     "_prefab": {
-      "__id__": 59
+      "__id__": 57
     },
     },
     "_opacity": 255,
     "_opacity": 255,
     "_color": {
     "_color": {
@@ -2021,17 +1950,17 @@
     "_name": "node_tv",
     "_name": "node_tv",
     "_objFlags": 0,
     "_objFlags": 0,
     "_parent": {
     "_parent": {
-      "__id__": 50
+      "__id__": 48
     },
     },
     "_children": [],
     "_children": [],
     "_active": true,
     "_active": true,
     "_components": [
     "_components": [
       {
       {
-        "__id__": 52
+        "__id__": 50
       }
       }
     ],
     ],
     "_prefab": {
     "_prefab": {
-      "__id__": 53
+      "__id__": 51
     },
     },
     "_opacity": 255,
     "_opacity": 255,
     "_color": {
     "_color": {
@@ -2085,7 +2014,7 @@
     "_name": "",
     "_name": "",
     "_objFlags": 0,
     "_objFlags": 0,
     "node": {
     "node": {
-      "__id__": 51
+      "__id__": 49
     },
     },
     "_enabled": true,
     "_enabled": true,
     "_materials": [
     "_materials": [
@@ -2128,20 +2057,20 @@
     "_name": "lbl_btn_desc",
     "_name": "lbl_btn_desc",
     "_objFlags": 0,
     "_objFlags": 0,
     "_parent": {
     "_parent": {
-      "__id__": 50
+      "__id__": 48
     },
     },
     "_children": [],
     "_children": [],
     "_active": true,
     "_active": true,
     "_components": [
     "_components": [
       {
       {
-        "__id__": 55
+        "__id__": 53
       },
       },
       {
       {
-        "__id__": 56
+        "__id__": 54
       }
       }
     ],
     ],
     "_prefab": {
     "_prefab": {
-      "__id__": 57
+      "__id__": 55
     },
     },
     "_opacity": 255,
     "_opacity": 255,
     "_color": {
     "_color": {
@@ -2195,7 +2124,7 @@
     "_name": "",
     "_name": "",
     "_objFlags": 0,
     "_objFlags": 0,
     "node": {
     "node": {
-      "__id__": 54
+      "__id__": 52
     },
     },
     "_enabled": true,
     "_enabled": true,
     "_materials": [
     "_materials": [
@@ -2204,8 +2133,8 @@
       }
       }
     ],
     ],
     "_useOriginalSize": false,
     "_useOriginalSize": false,
-    "_string": "双倍领取",
-    "_N$string": "双倍领取",
+    "_string": "领取粮草",
+    "_N$string": "领取粮草",
     "_fontSize": 44,
     "_fontSize": 44,
     "_lineHeight": 40,
     "_lineHeight": 40,
     "_enableWrapText": true,
     "_enableWrapText": true,
@@ -2229,7 +2158,7 @@
     "_name": "",
     "_name": "",
     "_objFlags": 0,
     "_objFlags": 0,
     "node": {
     "node": {
-      "__id__": 54
+      "__id__": 52
     },
     },
     "_enabled": true,
     "_enabled": true,
     "_color": {
     "_color": {
@@ -2258,7 +2187,7 @@
     "_name": "",
     "_name": "",
     "_objFlags": 0,
     "_objFlags": 0,
     "node": {
     "node": {
-      "__id__": 50
+      "__id__": 48
     },
     },
     "_enabled": true,
     "_enabled": true,
     "_layoutSize": {
     "_layoutSize": {
@@ -2301,7 +2230,7 @@
     "_name": "",
     "_name": "",
     "_objFlags": 0,
     "_objFlags": 0,
     "node": {
     "node": {
-      "__id__": 49
+      "__id__": 47
     },
     },
     "_enabled": true,
     "_enabled": true,
     "_materials": [
     "_materials": [
@@ -2333,7 +2262,7 @@
     "_name": "",
     "_name": "",
     "_objFlags": 0,
     "_objFlags": 0,
     "node": {
     "node": {
-      "__id__": 49
+      "__id__": 47
     },
     },
     "_enabled": true,
     "_enabled": true,
     "_normalMaterial": {
     "_normalMaterial": {
@@ -2420,14 +2349,14 @@
     "_active": true,
     "_active": true,
     "_components": [
     "_components": [
       {
       {
-        "__id__": 64
+        "__id__": 62
       },
       },
       {
       {
-        "__id__": 65
+        "__id__": 63
       }
       }
     ],
     ],
     "_prefab": {
     "_prefab": {
-      "__id__": 66
+      "__id__": 64
     },
     },
     "_opacity": 255,
     "_opacity": 255,
     "_color": {
     "_color": {
@@ -2481,7 +2410,7 @@
     "_name": "",
     "_name": "",
     "_objFlags": 0,
     "_objFlags": 0,
     "node": {
     "node": {
-      "__id__": 63
+      "__id__": 61
     },
     },
     "_enabled": true,
     "_enabled": true,
     "_materials": [
     "_materials": [
@@ -2515,7 +2444,7 @@
     "_name": "",
     "_name": "",
     "_objFlags": 0,
     "_objFlags": 0,
     "node": {
     "node": {
-      "__id__": 63
+      "__id__": 61
     },
     },
     "_enabled": true,
     "_enabled": true,
     "_color": {
     "_color": {
@@ -2541,7 +2470,7 @@
   },
   },
   {
   {
     "__type__": "cc.Node",
     "__type__": "cc.Node",
-    "_name": "lbl_desc",
+    "_name": "lbl_rest_times",
     "_objFlags": 0,
     "_objFlags": 0,
     "_parent": {
     "_parent": {
       "__id__": 16
       "__id__": 16
@@ -2550,14 +2479,14 @@
     "_active": true,
     "_active": true,
     "_components": [
     "_components": [
       {
       {
-        "__id__": 68
+        "__id__": 66
       },
       },
       {
       {
-        "__id__": 69
+        "__id__": 67
       }
       }
     ],
     ],
     "_prefab": {
     "_prefab": {
-      "__id__": 70
+      "__id__": 68
     },
     },
     "_opacity": 255,
     "_opacity": 255,
     "_color": {
     "_color": {
@@ -2611,7 +2540,7 @@
     "_name": "",
     "_name": "",
     "_objFlags": 0,
     "_objFlags": 0,
     "node": {
     "node": {
-      "__id__": 67
+      "__id__": 65
     },
     },
     "_enabled": true,
     "_enabled": true,
     "_materials": [
     "_materials": [
@@ -2645,7 +2574,7 @@
     "_name": "",
     "_name": "",
     "_objFlags": 0,
     "_objFlags": 0,
     "node": {
     "node": {
-      "__id__": 67
+      "__id__": 65
     },
     },
     "_enabled": true,
     "_enabled": true,
     "_color": {
     "_color": {
@@ -2670,6 +2599,77 @@
     "sync": false
     "sync": false
   },
   },
   {
   {
+    "__type__": "cc.Node",
+    "_name": "node_video",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 16
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [],
+    "_prefab": {
+      "__id__": 70
+    },
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 600,
+      "height": 350
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        0,
+        -160.295,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    },
+    "_eulerAngles": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_is3DNode": false,
+    "_groupIndex": 0,
+    "groupIndex": 0,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__uuid__": "94ac848f-6478-4b7f-8c5e-66aa9f6c3147"
+    },
+    "fileId": "987b1FCrJGpbljTWKWQ6sw",
+    "sync": false
+  },
+  {
     "__type__": "cc.Widget",
     "__type__": "cc.Widget",
     "_name": "",
     "_name": "",
     "_objFlags": 0,
     "_objFlags": 0,
@@ -2978,6 +2978,18 @@
     "open_effect": 1,
     "open_effect": 1,
     "close_effect": 1,
     "close_effect": 1,
     "close_toPoint": "",
     "close_toPoint": "",
+    "btn_receive": {
+      "__id__": 59
+    },
+    "lbl_can_up": {
+      "__id__": 40
+    },
+    "lbl_rest_times": {
+      "__id__": 66
+    },
+    "lbl_lc_count": {
+      "__id__": 30
+    },
     "_id": ""
     "_id": ""
   },
   },
   {
   {

+ 1 - 1
tower_sanguo/assets/scripts/GameController.ts

@@ -39,7 +39,7 @@ class GameController {
     private loadui: LoadingUI;
     private loadui: LoadingUI;
     mainui: MainUI;
     mainui: MainUI;
 
 
-    useLocalServer: boolean = true;
+    useLocalServer: boolean = false;
     //是否测试服
     //是否测试服
     testServer: boolean = true;
     testServer: boolean = true;
 
 

+ 1 - 0
tower_sanguo/assets/scripts/data/GameData.ts

@@ -195,6 +195,7 @@ export default class GameData {
             vo.cd = o.cd;
             vo.cd = o.cd;
             vo.foodRecover = o.recover;
             vo.foodRecover = o.recover;
             vo.foodMax = o.maxCapacity;
             vo.foodMax = o.maxCapacity;
+            vo.videofood = o.videofood;
             vo.initRounds(o.monsterData);
             vo.initRounds(o.monsterData);
             this.mission_data[i] = vo;
             this.mission_data[i] = vo;
         }
         }

+ 2 - 0
tower_sanguo/assets/scripts/data/GameDefinition.ts

@@ -57,6 +57,8 @@ export enum PLAYERPROP {
 
 
     /**剩余红包兑换元宝次数*/
     /**剩余红包兑换元宝次数*/
     USER_EXCHANGE_TIMES = 34,
     USER_EXCHANGE_TIMES = 34,
+    /** 领取粮草模块数据 */
+    GET_FOOD_DATA = 35,
 }
 }
 
 
 export enum ITEMTYPE {
 export enum ITEMTYPE {

+ 63 - 6
tower_sanguo/assets/scripts/module/getLiangCao/GetLiangCaoModel.ts

@@ -1,11 +1,68 @@
+import { PLAYERPROP } from "../../data/GameDefinition";
+import GameController from "../../GameController";
+
 /**
 /**
  *  获取粮草界面逻辑
  *  获取粮草界面逻辑
  */
  */
 export default class GetLiangCaoModel {
 export default class GetLiangCaoModel {
-    /** 当前粮草值 */
-    public static cur_lc_value: number = 0;
-    /** 需要的粮草值 */
-    public static need_lc_value: number = 1;
-    /** x秒后可训练 */
-    public static need_after_time: number = 0;
+    /** 粮草界面数据 */
+    public static model_data = {
+        /** 今日剩余视频次数 
+         * - 跨天重置
+        */
+        rest_vedio_times: 0,
+        /** 可以获得的粮草数量 */
+        food_count: 4999,
+    }
+    /** 今日最多可看视频次数 
+     * - 走配置,需要配置
+    */
+    public static max_vedio_times: number = 40;
+    /** 保存数据 */
+    public static saveData() {
+        let temp_str_model_data = JSON.stringify(this.model_data);
+        GameController.gameData.updatePropNoCheck(PLAYERPROP.GET_FOOD_DATA, temp_str_model_data);// 任务条数据
+    }
+    /** 重置数据 */
+    public static resetData() {
+        this.model_data.rest_vedio_times = this.max_vedio_times;
+        this.saveData();
+    }
+    /** 更新可以获得的粮草数量 
+     * 每关刷新
+    */
+    public static updateFoodCount() {
+        this.model_data.food_count = GameController.gameData.getMissionByID(1).videofood;
+    }
+    /** 预计可训练次数 
+     * - 实时计算得到
+     * - 向下取整
+     * - 次数 = 数量 / 每次消耗
+    */
+    public static canExpUpTimes(): number {
+        let can_expUp_times = 0;
+
+        let cur_food = this.model_data.food_count;
+        let consume_food = GameController.gameData.player.getProp(PLAYERPROP.FOODCONSUME);
+        can_expUp_times = Math.floor(cur_food / consume_food);
+        return can_expUp_times;
+    }
+    /** 预计多少秒后可训练
+     * - 实时计算得到
+     * - 向上取整
+     * - 时间 = 缺少的粮草数量 / 每秒获得
+     */
+    public static needAfterTime() {
+        let need_after_time = 0;
+        // 粮草每秒获得数量
+        let food_recover = GameController.gameData.player.getProp(PLAYERPROP.FOODRECOVER);
+        // 下级消耗
+        let consume_food = GameController.gameData.player.getProp(PLAYERPROP.FOODCONSUME);
+        // 当前粮草数量
+        let cur_food = GameController.gameData.player.getProp(PLAYERPROP.FOOD);
+        // 缺少的粮草数量
+        let need_food = consume_food - cur_food;
+        need_after_time = Math.ceil(need_food / food_recover);
+        return need_after_time;
+    }
 }
 }

+ 28 - 6
tower_sanguo/assets/scripts/module/getLiangCao/GetLiangCaoUI.ts

@@ -1,6 +1,7 @@
 
 
 import BaseUI from "../../../MOKA/component/BaseUI";
 import BaseUI from "../../../MOKA/component/BaseUI";
-const {ccclass, property} = cc._decorator;
+import GetLiangCaoModel from "./GetLiangCaoModel";
+const { ccclass, property } = cc._decorator;
 
 
 @ccclass
 @ccclass
 export default class GetLiangCaoUI extends BaseUI {
 export default class GetLiangCaoUI extends BaseUI {
@@ -8,13 +9,34 @@ export default class GetLiangCaoUI extends BaseUI {
     protected static prefabUrl = "module/getLiangCao/get_liangcao";
     protected static prefabUrl = "module/getLiangCao/get_liangcao";
     protected static className = "GetLiangCaoUI";
     protected static className = "GetLiangCaoUI";
 
 
-    onLoad () {
-
+    @property({ type: cc.Button, displayName: '领取按钮' })
+    private btn_receive: cc.Button = null!;
+    @property({ type: cc.Label, displayName: '预计训练次数' })
+    private lbl_can_up: cc.Label = null!;
+    @property({ type: cc.Label, displayName: '今日剩余次数' })
+    private lbl_rest_times: cc.Label = null!;
+    @property({ type: cc.Label, displayName: '粮草数量' })
+    private lbl_lc_count: cc.Label = null!;
+
+    onLoad() {
+        XXEvent.addClickEvent(this.btn_receive, this.onClickReceive, this);
+        XXEvent.on('event-new-mission-start', this.onUpdateFoodCount, this);
     }
     }
 
 
-    start () {
-
+    start() {
+        this.initStyle();
+    }
+    private initStyle() {
+        this.lbl_can_up.string = GetLiangCaoModel.canExpUpTimes() + '';
+        this.lbl_rest_times.string = GetLiangCaoModel.model_data.rest_vedio_times + '次';
+        this.lbl_lc_count.string = 'x' + GetLiangCaoModel.model_data.food_count;
+    }
+    private onClickReceive() {
+        // 领取粮草逻辑
+        // this.close();
+    }
+    private onUpdateFoodCount() {
+        GetLiangCaoModel.updateFoodCount();
     }
     }
-
     // update (dt) {}
     // update (dt) {}
 }
 }

+ 22 - 15
tower_sanguo/assets/scripts/module/main/MainUI.ts

@@ -145,7 +145,7 @@ export default class MainUI extends BaseUI {
         this.initScheduler();
         this.initScheduler();
 
 
         this.updateOpenUI();
         this.updateOpenUI();
-        this.LcLackUI();
+        this.lcLackUI();
 
 
         XXEvent.on("MainUIUpdateQiPaoMarshal", this.updateQiPaoMarshal, this);
         XXEvent.on("MainUIUpdateQiPaoMarshal", this.updateQiPaoMarshal, this);
         XXEvent.on("open-guide", this.openGuideUI, this);
         XXEvent.on("open-guide", this.openGuideUI, this);
@@ -163,6 +163,8 @@ export default class MainUI extends BaseUI {
                 let vo: MissionVO = GameController.gameData.getMissionByID(GameController.gameData.player.current_mission);
                 let vo: MissionVO = GameController.gameData.getMissionByID(GameController.gameData.player.current_mission);
                 GameController.gameData.updateProp(PLAYERPROP.FOOD, Math.floor(vo.foodRecover * 5), true);
                 GameController.gameData.updateProp(PLAYERPROP.FOOD, Math.floor(vo.foodRecover * 5), true);
             }
             }
+            // 每秒更新
+            this.showBtnExpUpOrLcBtn();
         }, 1);
         }, 1);
     }
     }
 
 
@@ -192,6 +194,7 @@ export default class MainUI extends BaseUI {
                 break;
                 break;
             case PLAYERPROP.FOODRECOVER:
             case PLAYERPROP.FOODRECOVER:
                 this.lbl_foodAdd.string = value + "/s";
                 this.lbl_foodAdd.string = value + "/s";
+                this.showBtnExpUpOrLcBtn();
                 break;
                 break;
             case PLAYERPROP.FOODCONSUME:
             case PLAYERPROP.FOODCONSUME:
                 this.lbl_food.string = value + "";
                 this.lbl_food.string = value + "";
@@ -390,25 +393,28 @@ export default class MainUI extends BaseUI {
         GameController.uiM.openUI(GuideUI, null, ViewZorder.UI, null, null, g_data);
         GameController.uiM.openUI(GuideUI, null, ViewZorder.UI, null, null, g_data);
     }
     }
     /** 训练按钮 - 粮草不足时的ui显示 */
     /** 训练按钮 - 粮草不足时的ui显示 */
-    private LcLackUI() {
-        let fillRange = GetLiangCaoModel.cur_lc_value / GetLiangCaoModel.need_lc_value;
+    private lcLackUI() {
+        let cur_food = GameController.gameData.player.getProp(PLAYERPROP.FOOD);
+        let need_food = GameController.gameData.player.getProp(PLAYERPROP.FOODCONSUME);
+        let fillRange = cur_food / need_food;
         this.lc_img_bar.fillRange = fillRange;
         this.lc_img_bar.fillRange = fillRange;
-        this.lbl_bar_desc.string = `${fillRange * 100}` + '%'
-        this.lbl_time.string = GetLiangCaoModel.need_after_time + 's';
+        this.lbl_bar_desc.string = `${fillRange * 100}` + '%';
+        this.lbl_time.string = GetLiangCaoModel.needAfterTime() + 's';
     }
     }
     /** 检查粮草数量,显示训练按钮 or 粮草按钮 */
     /** 检查粮草数量,显示训练按钮 or 粮草按钮 */
     private showBtnExpUpOrLcBtn() {
     private showBtnExpUpOrLcBtn() {
         let cur_food = GameController.gameData.player.getProp(PLAYERPROP.FOOD);
         let cur_food = GameController.gameData.player.getProp(PLAYERPROP.FOOD);
-        let need_food = GameController.gameData.player.getProp(PLAYERPROP.FOODCONSUME)
-        // if (cur_food >= need_food) {
-        //     // 满足下一次训练
-        //     this.btn3.node.active = true;
-        //     this.btn3_1.node.active = false;
-        // } else {
-        //     // 不满足下次训练,显示粮草按钮
-        //     this.btn3.node.active = false;
-        //     this.btn3_1.node.active = true;
-        // }
+        let need_food = GameController.gameData.player.getProp(PLAYERPROP.FOODCONSUME);
+        if (cur_food >= need_food) {
+            // 满足下一次训练
+            this.btn3.node.active = true;
+            this.btn3_1.node.active = false;
+        } else {
+            // 不满足下次训练,显示粮草按钮
+            this.btn3.node.active = false;
+            this.btn3_1.node.active = true;
+            this.lcLackUI();
+        }
     }
     }
     /** 新的一天 
     /** 新的一天 
      * - 检测到当前是新的一天,刷新数据
      * - 检测到当前是新的一天,刷新数据
@@ -417,6 +423,7 @@ export default class MainUI extends BaseUI {
         // 任务数据刷新
         // 任务数据刷新
         TaskModel.resetTaskData();
         TaskModel.resetTaskData();
         CheckpointRedBagModle.resetTaskData();
         CheckpointRedBagModle.resetTaskData();
+        GetLiangCaoModel.resetData();
     }
     }
 
 
     onDestroy() {
     onDestroy() {

+ 2 - 0
tower_sanguo/assets/scripts/vo/MissionVO.ts

@@ -17,6 +17,8 @@ export default class MissionVO {
     foodMax:number;
     foodMax:number;
 
 
     rounds:RoundVO[];
     rounds:RoundVO[];
+    /** 当前关卡看视频可获得的粮草 */
+    videofood: number;
 
 
 
 
     //怪物id:移速(px),怪物数量,刷新间隔(s);......
     //怪物id:移速(px),怪物数量,刷新间隔(s);......

+ 2 - 2
tower_sanguo/assets/scripts/vo/PlayerVO.ts

@@ -111,8 +111,8 @@ export default class PlayerVO {
     task_list_data: Array<TASKITEM> = [];
     task_list_data: Array<TASKITEM> = [];
     /** 玩家属性值是对象而非数字,解析服务端数据不转num的集合 */
     /** 玩家属性值是对象而非数字,解析服务端数据不转num的集合 */
     isObjByPLAYERPROP(id): boolean {
     isObjByPLAYERPROP(id): boolean {
-        let arr = [PLAYERPROP.USER_DAILY_TASK_INFO, PLAYERPROP.USER_DAILY_ACTIVE_INFO, PLAYERPROP.CHECKPOINT_REGBAG_DATA];
-        let bool =  arr.includes(id);
+        let arr = [PLAYERPROP.USER_DAILY_TASK_INFO, PLAYERPROP.USER_DAILY_ACTIVE_INFO, PLAYERPROP.CHECKPOINT_REGBAG_DATA, PLAYERPROP.GET_FOOD_DATA];
+        let bool = arr.includes(id);
         return bool;
         return bool;
     }
     }
 
 

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini