瀏覽代碼

新增工厂功能

kaka 4 年之前
父節點
當前提交
bc2cae2a66
共有 35 個文件被更改,包括 24883 次插入754 次删除
  1. 42 6
      assets/resources/animation/animals/30001_0.anim
  2. 43 13
      assets/resources/animation/animals/30001_1.anim
  3. 7 43
      assets/resources/animation/animals/30001_2.anim
  4. 42 6
      assets/resources/animation/animals/30002_0.anim
  5. 37 13
      assets/resources/animation/animals/30002_1.anim
  6. 7 43
      assets/resources/animation/animals/30002_2.anim
  7. 23697 101
      assets/resources/game/coregame/coregame.prefab
  8. 二進制
      assets/resources/game/coregame/texture/pasture/factory_clock.png
  9. 36 0
      assets/resources/game/coregame/texture/pasture/factory_clock.png.meta
  10. 3 1
      assets/resources/game/prefab/paster_30001.prefab
  11. 3 1
      assets/resources/game/prefab/paster_30002.prefab
  12. 45 45
      assets/resources/game/prefab/uiItem/PlantItem.prefab
  13. 166 31
      assets/resources/game/prefab/uiPanel/PlantPanel.prefab
  14. 163 0
      assets/script/before/main/FactoryIcon.ts
  15. 0 0
      assets/script/before/main/FactoryIcon.ts.meta
  16. 23 0
      assets/script/before/main/FactorySystem.ts
  17. 9 0
      assets/script/before/main/FactorySystem.ts.meta
  18. 18 32
      assets/script/before/main/FarmIcon.ts
  19. 0 97
      assets/script/before/main/MapIcon.ts
  20. 1 1
      assets/script/before/main/PastureData.ts
  21. 20 13
      assets/script/before/main/PastureIcon.ts
  22. 22 0
      assets/script/before/main/PastureSystem.ts
  23. 9 0
      assets/script/before/main/PastureSystem.ts.meta
  24. 26 12
      assets/script/before/map/MapMove.ts
  25. 8 4
      assets/script/before/view/Animals.ts
  26. 4 0
      assets/script/before/view/ui/PlantPanel.ts
  27. 37 6
      assets/script/before/view/uiItem/PlantItem.ts
  28. 26 36
      assets/script/game/component/TableView.ts
  29. 6 3
      assets/script/game/data/GData.ts
  30. 166 35
      assets/script/game/data/GameData.ts
  31. 1 1
      assets/script/game/data/LoginData.ts
  32. 1 0
      assets/script/game/game/Game.ts
  33. 6 2
      assets/script/game/module/login/Login.ts
  34. 207 207
      build/jsb-link/js backups (useful for debugging)/main.index.js
  35. 2 2
      packages-hot-update/cfg.json

+ 42 - 6
assets/resources/animation/animals/30001_0.anim

@@ -3,7 +3,7 @@
   "_name": "30001_0",
   "_objFlags": 0,
   "_native": "",
-  "_duration": 0.5,
+  "_duration": 1.1,
   "sample": 10,
   "speed": 1,
   "wrapMode": 2,
@@ -14,31 +14,67 @@
           {
             "frame": 0,
             "value": {
-              "__uuid__": "ba8757f4-1bc2-4e0f-ba3e-0fbf80e9e11c@6c48a"
+              "__uuid__": "758ccc30-fbca-4563-861a-ab2af3532a1a@6c48a"
             }
           },
           {
             "frame": 0.1,
             "value": {
-              "__uuid__": "9f7a42d5-e42a-4910-b797-3fd4701a8cfd@6c48a"
+              "__uuid__": "52ca53d7-d9f5-4a69-872d-35f3faed3baa@6c48a"
             }
           },
           {
             "frame": 0.2,
             "value": {
-              "__uuid__": "d56a4684-25bf-42d7-baa7-f5b00c3fb9a0@6c48a"
+              "__uuid__": "650de508-eace-42e9-9d29-ba1623cc315d@6c48a"
             }
           },
           {
             "frame": 0.3,
             "value": {
-              "__uuid__": "645a570a-40d2-477f-a6a4-ab5cebd1a52d@6c48a"
+              "__uuid__": "4bed49a6-fd24-4af0-8a76-c7e47500eaec@6c48a"
             }
           },
           {
             "frame": 0.4,
             "value": {
-              "__uuid__": "ccf664d1-9e9c-4526-b8de-a3d368db38b8@6c48a"
+              "__uuid__": "e3d1246e-1f7f-4afe-8476-3b2e0cd381ef@6c48a"
+            }
+          },
+          {
+            "frame": 0.5,
+            "value": {
+              "__uuid__": "b6de6ef0-d130-46ce-8850-e90595b358f3@6c48a"
+            }
+          },
+          {
+            "frame": 0.6,
+            "value": {
+              "__uuid__": "135074a1-e43f-49e7-969a-a27c8ebd5b40@6c48a"
+            }
+          },
+          {
+            "frame": 0.7,
+            "value": {
+              "__uuid__": "91957171-80ca-4689-a60c-c44eda906f27@6c48a"
+            }
+          },
+          {
+            "frame": 0.8,
+            "value": {
+              "__uuid__": "b4dc0602-3d21-4cd5-977f-35091f0737de@6c48a"
+            }
+          },
+          {
+            "frame": 0.9,
+            "value": {
+              "__uuid__": "0d9c914b-e68e-4374-a3a8-95f80c1a17bd@6c48a"
+            }
+          },
+          {
+            "frame": 1,
+            "value": {
+              "__uuid__": "75dc4b7c-8769-4c36-a776-12b26807f257@6c48a"
             }
           }
         ]

+ 43 - 13
assets/resources/animation/animals/30001_1.anim

@@ -1,9 +1,9 @@
 {
   "__type__": "cc.AnimationClip",
-  "_name": "30001_0",
+  "_name": "30001_1",
   "_objFlags": 0,
   "_native": "",
-  "_duration": 1.1,
+  "_duration": 1.6,
   "sample": 10,
   "speed": 1,
   "wrapMode": 2,
@@ -14,67 +14,97 @@
           {
             "frame": 0,
             "value": {
-              "__uuid__": "758ccc30-fbca-4563-861a-ab2af3532a1a@6c48a"
+              "__uuid__": "77dc72a1-6ea4-47f7-b456-ceb9529fe18e@6c48a"
             }
           },
           {
             "frame": 0.1,
             "value": {
-              "__uuid__": "52ca53d7-d9f5-4a69-872d-35f3faed3baa@6c48a"
+              "__uuid__": "8028a8af-5e8c-448e-9684-a000bfa31068@6c48a"
             }
           },
           {
             "frame": 0.2,
             "value": {
-              "__uuid__": "650de508-eace-42e9-9d29-ba1623cc315d@6c48a"
+              "__uuid__": "6d431132-8fad-4d8b-8825-ec8a86960a23@6c48a"
             }
           },
           {
             "frame": 0.3,
             "value": {
-              "__uuid__": "4bed49a6-fd24-4af0-8a76-c7e47500eaec@6c48a"
+              "__uuid__": "eb430c4f-d662-49ae-ac6c-ecdd3a4f60b8@6c48a"
             }
           },
           {
             "frame": 0.4,
             "value": {
-              "__uuid__": "e3d1246e-1f7f-4afe-8476-3b2e0cd381ef@6c48a"
+              "__uuid__": "6916d42b-993c-4f1a-a431-26ae08bf8bfd@6c48a"
             }
           },
           {
             "frame": 0.5,
             "value": {
-              "__uuid__": "b6de6ef0-d130-46ce-8850-e90595b358f3@6c48a"
+              "__uuid__": "e198b429-f7b2-41c2-a8f1-0f20a0460d24@6c48a"
             }
           },
           {
             "frame": 0.6,
             "value": {
-              "__uuid__": "135074a1-e43f-49e7-969a-a27c8ebd5b40@6c48a"
+              "__uuid__": "854283f1-0768-4583-98b1-030720444928@6c48a"
             }
           },
           {
             "frame": 0.7,
             "value": {
-              "__uuid__": "91957171-80ca-4689-a60c-c44eda906f27@6c48a"
+              "__uuid__": "1b7786b7-3da7-4043-a63f-7297c31254a7@6c48a"
             }
           },
           {
             "frame": 0.8,
             "value": {
-              "__uuid__": "b4dc0602-3d21-4cd5-977f-35091f0737de@6c48a"
+              "__uuid__": "3291f4a2-36f1-4bdf-ae7b-b74aa9b4b82a@6c48a"
             }
           },
           {
             "frame": 0.9,
             "value": {
-              "__uuid__": "0d9c914b-e68e-4374-a3a8-95f80c1a17bd@6c48a"
+              "__uuid__": "2c16b1c4-0416-472b-9f76-50b2b11d0375@6c48a"
             }
           },
           {
             "frame": 1,
             "value": {
-              "__uuid__": "75dc4b7c-8769-4c36-a776-12b26807f257@6c48a"
+              "__uuid__": "37ffd007-94a5-4ad3-97d1-11d3f3cd9713@6c48a"
+            }
+          },
+          {
+            "frame": 1.1,
+            "value": {
+              "__uuid__": "bcefdf9f-6446-40ca-a2b2-2f43df13bd92@6c48a"
+            }
+          },
+          {
+            "frame": 1.2,
+            "value": {
+              "__uuid__": "ea77951a-b11e-4e7f-9d48-0711d764f9b5@6c48a"
+            }
+          },
+          {
+            "frame": 1.3,
+            "value": {
+              "__uuid__": "c6c89472-f176-43d5-8756-52ec70c609ee@6c48a"
+            }
+          },
+          {
+            "frame": 1.4,
+            "value": {
+              "__uuid__": "8a823635-39d9-4b36-8137-c8381af77bd1@6c48a"
+            }
+          },
+          {
+            "frame": 1.5,
+            "value": {
+              "__uuid__": "a473ee06-5aa8-4ac2-ad93-8093a3bff932@6c48a"
             }
           }
         ]

+ 7 - 43
assets/resources/animation/animals/30001_2.anim

@@ -1,9 +1,9 @@
 {
   "__type__": "cc.AnimationClip",
-  "_name": "30001_0",
+  "_name": "30001_2",
   "_objFlags": 0,
   "_native": "",
-  "_duration": 1.1,
+  "_duration": 0.5,
   "sample": 10,
   "speed": 1,
   "wrapMode": 2,
@@ -14,67 +14,31 @@
           {
             "frame": 0,
             "value": {
-              "__uuid__": "758ccc30-fbca-4563-861a-ab2af3532a1a@6c48a"
+              "__uuid__": "ba8757f4-1bc2-4e0f-ba3e-0fbf80e9e11c@6c48a"
             }
           },
           {
             "frame": 0.1,
             "value": {
-              "__uuid__": "52ca53d7-d9f5-4a69-872d-35f3faed3baa@6c48a"
+              "__uuid__": "9f7a42d5-e42a-4910-b797-3fd4701a8cfd@6c48a"
             }
           },
           {
             "frame": 0.2,
             "value": {
-              "__uuid__": "650de508-eace-42e9-9d29-ba1623cc315d@6c48a"
+              "__uuid__": "d56a4684-25bf-42d7-baa7-f5b00c3fb9a0@6c48a"
             }
           },
           {
             "frame": 0.3,
             "value": {
-              "__uuid__": "4bed49a6-fd24-4af0-8a76-c7e47500eaec@6c48a"
+              "__uuid__": "645a570a-40d2-477f-a6a4-ab5cebd1a52d@6c48a"
             }
           },
           {
             "frame": 0.4,
             "value": {
-              "__uuid__": "e3d1246e-1f7f-4afe-8476-3b2e0cd381ef@6c48a"
-            }
-          },
-          {
-            "frame": 0.5,
-            "value": {
-              "__uuid__": "b6de6ef0-d130-46ce-8850-e90595b358f3@6c48a"
-            }
-          },
-          {
-            "frame": 0.6,
-            "value": {
-              "__uuid__": "135074a1-e43f-49e7-969a-a27c8ebd5b40@6c48a"
-            }
-          },
-          {
-            "frame": 0.7,
-            "value": {
-              "__uuid__": "91957171-80ca-4689-a60c-c44eda906f27@6c48a"
-            }
-          },
-          {
-            "frame": 0.8,
-            "value": {
-              "__uuid__": "b4dc0602-3d21-4cd5-977f-35091f0737de@6c48a"
-            }
-          },
-          {
-            "frame": 0.9,
-            "value": {
-              "__uuid__": "0d9c914b-e68e-4374-a3a8-95f80c1a17bd@6c48a"
-            }
-          },
-          {
-            "frame": 1,
-            "value": {
-              "__uuid__": "75dc4b7c-8769-4c36-a776-12b26807f257@6c48a"
+              "__uuid__": "ccf664d1-9e9c-4526-b8de-a3d368db38b8@6c48a"
             }
           }
         ]

+ 42 - 6
assets/resources/animation/animals/30002_0.anim

@@ -3,7 +3,7 @@
   "_name": "30002_0",
   "_objFlags": 0,
   "_native": "",
-  "_duration": 0.8333333333333334,
+  "_duration": 1.8333333333333333,
   "sample": 6,
   "speed": 1,
   "wrapMode": 2,
@@ -14,31 +14,67 @@
           {
             "frame": 0,
             "value": {
-              "__uuid__": "b5d9d9c0-a5e8-4be1-b858-2ac5a8fa457a@6c48a"
+              "__uuid__": "dcba9df1-05a1-4748-8294-0413a5362ee0@6c48a"
             }
           },
           {
             "frame": 0.16666666666666666,
             "value": {
-              "__uuid__": "b7371d1a-8499-4b90-910d-20169d53fe4f@6c48a"
+              "__uuid__": "e2bac86a-cfd8-40a6-aaa5-08589384f674@6c48a"
             }
           },
           {
             "frame": 0.3333333333333333,
             "value": {
-              "__uuid__": "12f85d58-a190-4884-a415-5c3120591c76@6c48a"
+              "__uuid__": "d7bcd950-ea00-4be1-9bd3-ee60743854da@6c48a"
             }
           },
           {
             "frame": 0.5,
             "value": {
-              "__uuid__": "e691ba4b-ae4e-4acb-b453-9db03c380056@6c48a"
+              "__uuid__": "8a7cad4c-0497-4521-ad77-927950a80e9d@6c48a"
             }
           },
           {
             "frame": 0.6666666666666666,
             "value": {
-              "__uuid__": "821cbb9c-c31b-426a-8c8d-08c6cf498967@6c48a"
+              "__uuid__": "0105edf5-75a1-46f2-a008-148e4f338eab@6c48a"
+            }
+          },
+          {
+            "frame": 0.8333333333333334,
+            "value": {
+              "__uuid__": "288ed40f-8e11-4131-a424-fdeaa91c9474@6c48a"
+            }
+          },
+          {
+            "frame": 1,
+            "value": {
+              "__uuid__": "e4346a63-8afc-416f-bf05-cc41e3ece5e8@6c48a"
+            }
+          },
+          {
+            "frame": 1.1666666666666667,
+            "value": {
+              "__uuid__": "5b75f67f-7526-4df1-9346-707fc3cba9a6@6c48a"
+            }
+          },
+          {
+            "frame": 1.3333333333333333,
+            "value": {
+              "__uuid__": "91178ada-b582-47d2-9aa6-940ed26e0263@6c48a"
+            }
+          },
+          {
+            "frame": 1.5,
+            "value": {
+              "__uuid__": "de2033f9-0773-4848-8b3b-a4a4df3b4d3c@6c48a"
+            }
+          },
+          {
+            "frame": 1.6666666666666667,
+            "value": {
+              "__uuid__": "e529fa0e-a364-4c9f-8b7e-0f81e403bf2c@6c48a"
             }
           }
         ]

+ 37 - 13
assets/resources/animation/animals/30002_1.anim

@@ -1,9 +1,9 @@
 {
   "__type__": "cc.AnimationClip",
-  "_name": "30002_0",
+  "_name": "30002_1",
   "_objFlags": 0,
   "_native": "",
-  "_duration": 1.8333333333333333,
+  "_duration": 2.5,
   "sample": 6,
   "speed": 1,
   "wrapMode": 2,
@@ -14,67 +14,91 @@
           {
             "frame": 0,
             "value": {
-              "__uuid__": "dcba9df1-05a1-4748-8294-0413a5362ee0@6c48a"
+              "__uuid__": "55166111-4788-4413-9a50-986e13dfbb65@6c48a"
             }
           },
           {
             "frame": 0.16666666666666666,
             "value": {
-              "__uuid__": "e2bac86a-cfd8-40a6-aaa5-08589384f674@6c48a"
+              "__uuid__": "e5936cfb-dd1b-424d-8db9-41f9f8139be4@6c48a"
             }
           },
           {
             "frame": 0.3333333333333333,
             "value": {
-              "__uuid__": "d7bcd950-ea00-4be1-9bd3-ee60743854da@6c48a"
+              "__uuid__": "57900286-c4c5-468c-a958-6cde104a92e4@6c48a"
             }
           },
           {
             "frame": 0.5,
             "value": {
-              "__uuid__": "8a7cad4c-0497-4521-ad77-927950a80e9d@6c48a"
+              "__uuid__": "526b965a-f5b5-4778-b5e9-960b21069316@6c48a"
             }
           },
           {
             "frame": 0.6666666666666666,
             "value": {
-              "__uuid__": "0105edf5-75a1-46f2-a008-148e4f338eab@6c48a"
+              "__uuid__": "243339d9-2238-4910-85df-996bad64a38a@6c48a"
             }
           },
           {
             "frame": 0.8333333333333334,
             "value": {
-              "__uuid__": "288ed40f-8e11-4131-a424-fdeaa91c9474@6c48a"
+              "__uuid__": "157a595d-b507-4f39-908f-cab4cef52d05@6c48a"
             }
           },
           {
             "frame": 1,
             "value": {
-              "__uuid__": "e4346a63-8afc-416f-bf05-cc41e3ece5e8@6c48a"
+              "__uuid__": "6cacf56a-09fd-48ed-a672-24ac19586a0c@6c48a"
             }
           },
           {
             "frame": 1.1666666666666667,
             "value": {
-              "__uuid__": "5b75f67f-7526-4df1-9346-707fc3cba9a6@6c48a"
+              "__uuid__": "616e64c3-6f46-4d1d-bf30-08b9aa83aa6f@6c48a"
             }
           },
           {
             "frame": 1.3333333333333333,
             "value": {
-              "__uuid__": "91178ada-b582-47d2-9aa6-940ed26e0263@6c48a"
+              "__uuid__": "edae4939-706d-47f4-a0f9-d6418cb7cf0f@6c48a"
             }
           },
           {
             "frame": 1.5,
             "value": {
-              "__uuid__": "de2033f9-0773-4848-8b3b-a4a4df3b4d3c@6c48a"
+              "__uuid__": "2c110b0f-7965-4562-b7be-f3b92b4e6e16@6c48a"
             }
           },
           {
             "frame": 1.6666666666666667,
             "value": {
-              "__uuid__": "e529fa0e-a364-4c9f-8b7e-0f81e403bf2c@6c48a"
+              "__uuid__": "8cb2fe7e-c885-4322-8a90-82832a024e27@6c48a"
+            }
+          },
+          {
+            "frame": 1.8333333333333333,
+            "value": {
+              "__uuid__": "b24733bf-1bac-4a3d-9900-75763ed7aa11@6c48a"
+            }
+          },
+          {
+            "frame": 2,
+            "value": {
+              "__uuid__": "cc3959e1-1d6f-4524-8958-7e2cfddeb248@6c48a"
+            }
+          },
+          {
+            "frame": 2.1666666666666665,
+            "value": {
+              "__uuid__": "9c6d0b64-4a9d-42a6-aa1c-e198a5ab0899@6c48a"
+            }
+          },
+          {
+            "frame": 2.3333333333333335,
+            "value": {
+              "__uuid__": "24f48dd7-d67c-4108-91be-9b6b390b43c1@6c48a"
             }
           }
         ]

+ 7 - 43
assets/resources/animation/animals/30002_2.anim

@@ -1,9 +1,9 @@
 {
   "__type__": "cc.AnimationClip",
-  "_name": "30002_0",
+  "_name": "30002_2",
   "_objFlags": 0,
   "_native": "",
-  "_duration": 1.8333333333333333,
+  "_duration": 0.8333333333333334,
   "sample": 6,
   "speed": 1,
   "wrapMode": 2,
@@ -14,67 +14,31 @@
           {
             "frame": 0,
             "value": {
-              "__uuid__": "dcba9df1-05a1-4748-8294-0413a5362ee0@6c48a"
+              "__uuid__": "b5d9d9c0-a5e8-4be1-b858-2ac5a8fa457a@6c48a"
             }
           },
           {
             "frame": 0.16666666666666666,
             "value": {
-              "__uuid__": "e2bac86a-cfd8-40a6-aaa5-08589384f674@6c48a"
+              "__uuid__": "b7371d1a-8499-4b90-910d-20169d53fe4f@6c48a"
             }
           },
           {
             "frame": 0.3333333333333333,
             "value": {
-              "__uuid__": "d7bcd950-ea00-4be1-9bd3-ee60743854da@6c48a"
+              "__uuid__": "12f85d58-a190-4884-a415-5c3120591c76@6c48a"
             }
           },
           {
             "frame": 0.5,
             "value": {
-              "__uuid__": "8a7cad4c-0497-4521-ad77-927950a80e9d@6c48a"
+              "__uuid__": "e691ba4b-ae4e-4acb-b453-9db03c380056@6c48a"
             }
           },
           {
             "frame": 0.6666666666666666,
             "value": {
-              "__uuid__": "0105edf5-75a1-46f2-a008-148e4f338eab@6c48a"
-            }
-          },
-          {
-            "frame": 0.8333333333333334,
-            "value": {
-              "__uuid__": "288ed40f-8e11-4131-a424-fdeaa91c9474@6c48a"
-            }
-          },
-          {
-            "frame": 1,
-            "value": {
-              "__uuid__": "e4346a63-8afc-416f-bf05-cc41e3ece5e8@6c48a"
-            }
-          },
-          {
-            "frame": 1.1666666666666667,
-            "value": {
-              "__uuid__": "5b75f67f-7526-4df1-9346-707fc3cba9a6@6c48a"
-            }
-          },
-          {
-            "frame": 1.3333333333333333,
-            "value": {
-              "__uuid__": "91178ada-b582-47d2-9aa6-940ed26e0263@6c48a"
-            }
-          },
-          {
-            "frame": 1.5,
-            "value": {
-              "__uuid__": "de2033f9-0773-4848-8b3b-a4a4df3b4d3c@6c48a"
-            }
-          },
-          {
-            "frame": 1.6666666666666667,
-            "value": {
-              "__uuid__": "e529fa0e-a364-4c9f-8b7e-0f81e403bf2c@6c48a"
+              "__uuid__": "821cbb9c-c31b-426a-8c8d-08c6cf498967@6c48a"
             }
           }
         ]

File diff suppressed because it is too large
+ 23697 - 101
assets/resources/game/coregame/coregame.prefab


二進制
assets/resources/game/coregame/texture/pasture/factory_clock.png


+ 36 - 0
assets/resources/game/coregame/texture/pasture/factory_clock.png.meta

@@ -0,0 +1,36 @@
+{
+  "ver": "2.3.5",
+  "uuid": "1e5450e4-d656-4032-b12e-4740fa8301c8",
+  "type": "sprite",
+  "wrapMode": "clamp",
+  "filterMode": "bilinear",
+  "premultiplyAlpha": false,
+  "genMipmaps": false,
+  "packable": true,
+  "width": 42,
+  "height": 42,
+  "platformSettings": {},
+  "subMetas": {
+    "factory_clock": {
+      "ver": "1.0.4",
+      "uuid": "098ff903-6b7d-440c-9759-9ded1e6490e9",
+      "rawTextureUuid": "1e5450e4-d656-4032-b12e-4740fa8301c8",
+      "trimType": "auto",
+      "trimThreshold": 1,
+      "rotated": false,
+      "offsetX": 0,
+      "offsetY": 0,
+      "trimX": 0,
+      "trimY": 0,
+      "width": 42,
+      "height": 42,
+      "rawWidth": 42,
+      "rawHeight": 42,
+      "borderTop": 0,
+      "borderBottom": 0,
+      "borderLeft": 0,
+      "borderRight": 0,
+      "subMetas": {}
+    }
+  }
+}

+ 3 - 1
assets/resources/game/prefab/paster_30001.prefab

@@ -294,7 +294,9 @@
       "__id__": 5
     },
     "_enabled": true,
-    "_defaultClip": null,
+    "_defaultClip": {
+      "__uuid__": "fafa4550-a7d9-46a1-a7f7-4af55a8601d8"
+    },
     "_clips": [
       {
         "__uuid__": "24a9d6ea-68e1-41c7-a2b9-adfd11c183df"

+ 3 - 1
assets/resources/game/prefab/paster_30002.prefab

@@ -294,7 +294,9 @@
       "__id__": 5
     },
     "_enabled": true,
-    "_defaultClip": null,
+    "_defaultClip": {
+      "__uuid__": "69c863e8-09ae-49f5-bcc7-31bce7f73f07"
+    },
     "_clips": [
       {
         "__uuid__": "6c85c6c0-10d8-46cc-943f-7b7cf9766fc9"

+ 45 - 45
assets/resources/game/prefab/uiItem/PlantItem.prefab

@@ -193,8 +193,8 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 60,
-      "height": 60
+      "width": 80,
+      "height": 80
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -206,7 +206,7 @@
       "ctor": "Float64Array",
       "array": [
         0,
-        91.5,
+        105.5,
         0,
         0,
         0,
@@ -312,15 +312,15 @@
       "__type__": "TypedArray",
       "ctor": "Float64Array",
       "array": [
-        56.98,
-        131,
+        49.98,
+        123,
         0,
         0,
         0,
         0,
         1,
-        1,
-        1,
+        1.2,
+        1.2,
         1
       ]
     },
@@ -424,14 +424,14 @@
       "ctor": "Float64Array",
       "array": [
         0,
-        32,
+        37,
         0,
         0,
         0,
         0,
         1,
-        1,
-        1,
+        1.2,
+        1.2,
         1
       ]
     },
@@ -632,7 +632,7 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 82,
+      "width": 80,
       "height": 20
     },
     "_anchorPoint": {
@@ -645,14 +645,14 @@
       "ctor": "Float64Array",
       "array": [
         0,
-        -7.5,
+        -3.9109999999999996,
         0,
         0,
         0,
         0,
         1,
-        1,
-        1,
+        1.4,
+        1.4,
         1
       ]
     },
@@ -706,7 +706,7 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 20,
+      "width": 18,
       "height": 20
     },
     "_anchorPoint": {
@@ -770,8 +770,8 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 10,
-      "height": 14
+      "width": 7,
+      "height": 13
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -782,7 +782,7 @@
       "__type__": "TypedArray",
       "ctor": "Float64Array",
       "array": [
-        -5,
+        -5.5,
         0,
         0,
         0,
@@ -823,7 +823,7 @@
     "_srcBlendFactor": 770,
     "_dstBlendFactor": 771,
     "_spriteFrame": {
-      "__uuid__": "446789ed-a3ab-4902-babe-5f02e0fbf29f@6c48a"
+      "__uuid__": "b1b0e542-e734-47ac-bea9-31655b02a68b@6c48a"
     },
     "_type": 0,
     "_sizeMode": 1,
@@ -877,8 +877,8 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 10,
-      "height": 14
+      "width": 11,
+      "height": 13
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -889,7 +889,7 @@
       "__type__": "TypedArray",
       "ctor": "Float64Array",
       "array": [
-        5,
+        3.5,
         0,
         0,
         0,
@@ -930,7 +930,7 @@
     "_srcBlendFactor": 770,
     "_dstBlendFactor": 771,
     "_spriteFrame": {
-      "__uuid__": "2c5729a5-1a9e-44eb-bbff-b164d273d6d7@6c48a"
+      "__uuid__": "4c775cea-16eb-4583-b1c2-efc300c546f0@6c48a"
     },
     "_type": 0,
     "_sizeMode": 1,
@@ -997,7 +997,7 @@
         "__uuid__": "d178f694-3abf-4895-9bbe-5d21925c8a07@6c48a"
       }
     ],
-    "_string": "10",
+    "_string": "14",
     "_id": ""
   },
   {
@@ -1010,7 +1010,7 @@
     "_enabled": true,
     "_layoutSize": {
       "__type__": "cc.Size",
-      "width": 20,
+      "width": 18,
       "height": 20
     },
     "_resize": 1,
@@ -1082,7 +1082,7 @@
       "__type__": "TypedArray",
       "ctor": "Float64Array",
       "array": [
-        11,
+        10,
         0,
         0,
         0,
@@ -1160,7 +1160,7 @@
     "_enabled": true,
     "_layoutSize": {
       "__type__": "cc.Size",
-      "width": 82,
+      "width": 80,
       "height": 20
     },
     "_resize": 1,
@@ -1243,8 +1243,8 @@
         0,
         0,
         1,
-        1,
-        1,
+        1.2,
+        1.2,
         1
       ]
     },
@@ -1725,7 +1725,7 @@
       "ctor": "Float64Array",
       "array": [
         0,
-        -118,
+        -121,
         0,
         0,
         0,
@@ -1789,7 +1789,7 @@
       "ctor": "Float64Array",
       "array": [
         0,
-        0,
+        2,
         0,
         0,
         0,
@@ -2059,18 +2059,18 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 180,
-      "height": 207.8
+      "height": 131.8
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
-      "x": 0,
+      "x": 0.5,
       "y": 0.5
     },
     "_trs": {
       "__type__": "TypedArray",
       "ctor": "Float64Array",
       "array": [
-        0,
+        90.936,
         0,
         0,
         0,
@@ -2122,8 +2122,8 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 176,
-      "height": 176
+      "width": 60,
+      "height": 60
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -2134,15 +2134,15 @@
       "__type__": "TypedArray",
       "ctor": "Float64Array",
       "array": [
-        89,
-        15.900000000000006,
+        0,
+        35.900000000000006,
         0,
         0,
         0,
         0,
         1,
-        0.3,
-        0.3,
+        1,
+        1,
         1
       ]
     },
@@ -2178,7 +2178,7 @@
       "__uuid__": "0c860566-4520-434f-9286-27075963cff4"
     },
     "_type": 0,
-    "_sizeMode": 1,
+    "_sizeMode": 0,
     "_fillType": 0,
     "_fillCenter": {
       "__type__": "cc.Vec2",
@@ -2244,8 +2244,8 @@
       "__type__": "TypedArray",
       "ctor": "Float64Array",
       "array": [
-        89,
-        -68,
+        0,
+        -29.999999999999993,
         0,
         0,
         0,
@@ -2342,7 +2342,7 @@
     "_layoutSize": {
       "__type__": "cc.Size",
       "width": 180,
-      "height": 207.8
+      "height": 131.8
     },
     "_resize": 1,
     "_N$layoutType": 2,
@@ -2357,7 +2357,7 @@
     "_N$paddingTop": 0,
     "_N$paddingBottom": 0,
     "_N$spacingX": 0,
-    "_N$spacingY": -40,
+    "_N$spacingY": 0,
     "_N$verticalDirection": 1,
     "_N$horizontalDirection": 0,
     "_N$affectedByScale": false,

+ 166 - 31
assets/resources/game/prefab/uiPanel/PlantPanel.prefab

@@ -24,20 +24,20 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 18
+        "__id__": 22
       },
       {
-        "__id__": 19
+        "__id__": 23
       },
       {
-        "__id__": 20
+        "__id__": 24
       },
       {
-        "__id__": 21
+        "__id__": 25
       }
     ],
     "_prefab": {
-      "__id__": 22
+      "__id__": 26
     },
     "_opacity": 255,
     "_color": {
@@ -99,19 +99,22 @@
       },
       {
         "__id__": 6
+      },
+      {
+        "__id__": 10
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 15
+        "__id__": 19
       },
       {
-        "__id__": 16
+        "__id__": 20
       }
     ],
     "_prefab": {
-      "__id__": 17
+      "__id__": 21
     },
     "_opacity": 255,
     "_color": {
@@ -123,7 +126,7 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 750.0000000000001,
+      "width": 750,
       "height": 500
     },
     "_anchorPoint": {
@@ -135,8 +138,8 @@
       "__type__": "TypedArray",
       "ctor": "Float64Array",
       "array": [
-        981.4070000000002,
-        -175.98299999999995,
+        981.4069999999999,
+        -209.02800000000002,
         0,
         0,
         0,
@@ -269,6 +272,135 @@
   },
   {
     "__type__": "cc.Node",
+    "_name": "New Label",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 2
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 7
+      },
+      {
+        "__id__": 8
+      }
+    ],
+    "_prefab": {
+      "__id__": 9
+    },
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 250,
+      "g": 255,
+      "b": 173,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 570,
+      "height": 60.4
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        0,
+        7,
+        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.Label",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 6
+    },
+    "_enabled": true,
+    "_materials": [
+      {
+        "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
+      }
+    ],
+    "_srcBlendFactor": 770,
+    "_dstBlendFactor": 771,
+    "_string": "收获即可得红包,真提现无套路",
+    "_N$string": "收获即可得红包,真提现无套路",
+    "_fontSize": 40,
+    "_lineHeight": 40,
+    "_enableWrapText": true,
+    "_N$file": null,
+    "_isSystemFontUsed": true,
+    "_spacingX": 0,
+    "_batchAsBitmap": false,
+    "_styleFlags": 1,
+    "_underlineHeight": 0,
+    "_N$horizontalAlign": 1,
+    "_N$verticalAlign": 1,
+    "_N$fontFamily": "Arial",
+    "_N$overflow": 0,
+    "_N$cacheMode": 0,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.LabelOutline",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 6
+    },
+    "_enabled": true,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 104,
+      "g": 49,
+      "b": 11,
+      "a": 255
+    },
+    "_width": 5,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__uuid__": "6c4cddd9-4029-4d7b-b09d-8cae76051b8c"
+    },
+    "fileId": "52QjhYWnJJ+J3piecWE9s0",
+    "sync": false
+  },
+  {
+    "__type__": "cc.Node",
     "_name": "滚动视图",
     "_objFlags": 0,
     "_parent": {
@@ -276,20 +408,20 @@
     },
     "_children": [
       {
-        "__id__": 7
+        "__id__": 11
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 12
+        "__id__": 16
       },
       {
-        "__id__": 13
+        "__id__": 17
       }
     ],
     "_prefab": {
-      "__id__": 14
+      "__id__": 18
     },
     "_opacity": 255,
     "_color": {
@@ -314,7 +446,7 @@
       "ctor": "Float64Array",
       "array": [
         0,
-        -273.297,
+        -249.416,
         0,
         0,
         0,
@@ -343,21 +475,21 @@
     "_name": "view",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 6
+      "__id__": 10
     },
     "_children": [
       {
-        "__id__": 8
+        "__id__": 12
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 10
+        "__id__": 14
       }
     ],
     "_prefab": {
-      "__id__": 11
+      "__id__": 15
     },
     "_opacity": 255,
     "_color": {
@@ -411,13 +543,13 @@
     "_name": "content",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 7
+      "__id__": 11
     },
     "_children": [],
     "_active": true,
     "_components": [],
     "_prefab": {
-      "__id__": 9
+      "__id__": 13
     },
     "_opacity": 255,
     "_color": {
@@ -482,7 +614,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 7
+      "__id__": 11
     },
     "_enabled": true,
     "_materials": [
@@ -513,7 +645,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 6
+      "__id__": 10
     },
     "_enabled": true,
     "horizontal": true,
@@ -525,10 +657,10 @@
     "scrollEvents": [],
     "cancelInnerEvents": false,
     "_N$content": {
-      "__id__": 8
+      "__id__": 12
     },
     "content": {
-      "__id__": 8
+      "__id__": 12
     },
     "_N$horizontalScrollBar": null,
     "_N$verticalScrollBar": null,
@@ -539,7 +671,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 6
+      "__id__": 10
     },
     "_enabled": true,
     "pre_item": [
@@ -552,7 +684,10 @@
     ],
     "itemInterval": 10,
     "node_xiabiao": null,
+    "isShowByLimitLength": false,
+    "limitLength": 0,
     "direction": 2,
+    "isHideAllChild": false,
     "_id": ""
   },
   {
@@ -609,10 +744,10 @@
     "alignMode": 1,
     "_target": null,
     "_alignFlags": 44,
-    "_left": 981.407,
-    "_right": -981.407,
+    "_left": 981.4069999999999,
+    "_right": -981.4069999999999,
     "_top": 0,
-    "_bottom": -8.983000000000004,
+    "_bottom": -42.02799999999996,
     "_verticalCenter": 0,
     "_horizontalCenter": 0,
     "_isAbsLeft": true,
@@ -713,7 +848,7 @@
     },
     "_enabled": true,
     "tableView": {
-      "__id__": 13
+      "__id__": 17
     },
     "_id": ""
   },

+ 163 - 0
assets/script/before/main/FactoryIcon.ts

@@ -0,0 +1,163 @@
+import { FactroyState, ProductType } from "../../game/data/GameData";
+import ProductShow from "../view/ProductShow";
+import { FarmCountDown } from "./FarmCountDown";
+import { IDHelper } from "./IDHelper";
+
+const { ccclass, property } = cc._decorator;
+
+@ccclass
+export class FactoryIcon extends cc.Component {
+    @property({ type: FarmCountDown, tooltip: "倒计时组件" }) countDown: FarmCountDown = null;
+    @property({ type: cc.Node, tooltip: "完成品展示节点" }) showGroup: cc.Node = null;
+
+    public configID: number = 0;
+    public sortID: number = 0;
+    private tab: ProductType = ProductType.bmhc;
+
+    private _state: FactroyState = -1;
+    public get state(): FactroyState { return this._state; }
+
+    data = null;
+
+    onLoad() {
+        let helper = this.getComponent(IDHelper);
+        this.configID = helper.buildID;
+        this.sortID = helper.sortID;
+
+        switch (this.configID) {
+            case 30004:
+                this.tab = ProductType.bmhc;
+                break;
+            case 30005:
+                this.tab = ProductType.gdp;
+                break;
+            case 30006:
+                this.tab = ProductType.ztc;
+                break;
+            case 30007:
+                this.tab = ProductType.lrc;
+                break;
+            case 30008:
+                this.tab = ProductType.gfmg;
+                break;
+            case 30009:
+                this.tab = ProductType.kcd;
+                break;
+        }
+        this.countDown.node.active = false;
+
+        this.freshState();
+    }
+
+    update() {
+        let index = gData.gameData.needFreshArr.indexOf(this.configID);
+        if (index != -1) {
+            this.freshState();
+            gData.gameData.needFreshArr.splice(index, 1);
+        }
+    }
+
+    freshState() {
+        this.data = gData.gameData.getFactoryDataMap(this.configID);
+        this.setState(this.data.state);
+    }
+
+    private setState(value: FactroyState): void {
+        if (this.state != value) {
+            this._state = value;
+            this.countDown.node.active = false;
+
+            switch (this.state) {
+                case FactroyState.Lock:
+
+                    break;
+                case FactroyState.Empty:
+
+                    break;
+                case FactroyState.Producting:
+                    this.countDown.node.active = true;
+                    this.countDown.setData(this.data);
+                    break;
+                case FactroyState.Ripe:
+                    this.countDown.node.active = true;
+                    this.countDown.setState(1);
+                    this.onProductComplete();
+                    break;
+                case FactroyState.Sick:
+                    this.countDown.node.active = true;
+                    this.countDown.setState(0);
+                    break;
+            }
+        }
+    }
+
+    /**生产完成 */
+    private async onProductComplete() {
+        if (this.showGroup) {
+            let prefab = await mk.loader.load("game/prefab/ProductShow", cc.Prefab);
+            let item = cc.instantiate(prefab);
+            let id = this.data.productID;
+            item.getComponent(ProductShow).id = id;
+            item.parent = this.showGroup;
+        }
+    }
+
+    private clean(): void {
+        this.showGroup.removeAllChildren();
+    }
+
+    public async onTouch() {
+        switch (this.data.state) {
+            case FactroyState.Lock:
+                let arr = gData.gameData.getProductArrByType(this.tab);
+                let lv = arr[0].value;
+                mk.tip.pop(`农场达到${lv}级解锁`);
+                break;
+            case FactroyState.Empty:
+                gData.factorySystem.currSelectFactory = this;
+                gData.plantData.openPanel(this.tab, this.configID);
+                break;
+            case FactroyState.Ripe:
+                gData.factorySystem.currSelectFactory = this;
+                gData.harvestData.openPanel(this.configID, this.data.productID, this.onHarvest.bind(this));
+                break;
+            case FactroyState.Sick:
+                // mk.tip.pop(`生虫了!`);
+                gData.adClearSickData.openPanel(this.configID);
+                break;
+        }
+    }
+
+    public make(id) {
+        let config = gData.gameData.getProductMap(id);
+        let growSpan = Date.now() + config.time * 1000;
+        this.data.state = FactroyState.Producting;
+        this.data.productID = config.picture;
+        this.data.growSpan = growSpan;
+        gData.gameData.setFactoryDataMap(this.configID, this.data);
+    }
+
+    onRipe() {
+        this._state = FactroyState.Ripe;
+        this.data.state = FactroyState.Ripe;
+        gData.gameData.setFactoryDataMap(this.configID, this.data);
+        gData.gameData.addProductMakeTimesById(this.data.productID);
+    }
+
+    onSick() {
+        this._state = FactroyState.Sick;
+        this.data.state = FactroyState.Sick;
+        gData.gameData.setFactoryDataMap(this.configID, this.data);
+    }
+
+    public onHarvest(): void {
+        this.countDown.cleanRiped();
+        this.clean();
+        gData.factorySystem.currSelectFactory = null;
+
+        this.data.state = FactroyState.Empty;
+        this.data.productID = 0;
+        this.data.growSpan = 0;
+        gData.gameData.setFactoryDataMap(this.configID, this.data);
+    }
+}

+ 0 - 0
assets/script/before/main/MapIcon.ts.meta → assets/script/before/main/FactoryIcon.ts.meta


+ 23 - 0
assets/script/before/main/FactorySystem.ts

@@ -0,0 +1,23 @@
+/** 工厂数据类 */
+
+import { ProductType } from "../../game/data/GameData";
+import { FactoryIcon } from "./FactoryIcon";
+
+const { ccclass } = cc._decorator;
+
+@ccclass
+export default class FactorySystem {
+    private _currSelectFactory: FactoryIcon = null;
+
+    public set currSelectFactory(factory: FactoryIcon) {
+        this._currSelectFactory = factory;
+    }
+
+    public get currSelectFactory(): FactoryIcon {
+        return this._currSelectFactory;
+    }
+
+    public make(id: number): void {
+        this._currSelectFactory && this._currSelectFactory.make(id);
+    }
+}

+ 9 - 0
assets/script/before/main/FactorySystem.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "7c2bbe21-cff0-4999-8563-fd30737baa03",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 18 - 32
assets/script/before/main/FarmIcon.ts

@@ -1,13 +1,10 @@
 import { FarmState, ProductType } from '../../game/data/GameData';
-import { Data } from '../../mk/data/Data';
 import { MoveToCenter } from '../map/MoveToCenter';
 import { FarmCountDown } from './FarmCountDown';
 import { FarmGrowProcess } from './FarmGrowProcess';
-import { FarmSystem } from './FarmSystem';
 import { IDHelper } from './IDHelper';
-const { ccclass, property } = cc._decorator;
-
 
+const { ccclass, property } = cc._decorator;
 
 @ccclass
 export class FarmIcon extends cc.Component {
@@ -26,8 +23,9 @@ export class FarmIcon extends cc.Component {
     public get state(): FarmState { return this._state; }
     private data = null;
     onLoad() {
-        this.configID = this.getComponent(IDHelper).buildID;
-        this.sortID = this.getComponent(IDHelper).sortID;
+        let helper = this.getComponent(IDHelper);
+        this.configID = helper.buildID;
+        this.sortID = helper.sortID;
         gData.farmSystem.addFram(this);
     }
 
@@ -36,23 +34,6 @@ export class FarmIcon extends cc.Component {
     }
 
     update(dt) {
-        // if (this.state == FarmState.Lock && gData.gameData.hasBuildData(this.configID)) {
-        //     this.activeFram();
-        // }
-        // let producting = gData.gameData.getProductingList(this.configID);
-        // if (producting.length > 0) {
-        //     if (producting[0].ripeDate <= Date.now()) {
-        //         this.setState(FarmState.Ripe);
-        //     } else {
-        //         this.setState(FarmState.Growing);
-        //     }
-        //     this.countDown.setData(this.configID, false);
-        //     this.process.setData(this.configID);
-        // } else {
-        //     this.setState(FarmState.Empty);
-        //     this.countDown.cleanRiped();
-        //     this.process.cleanProcess();
-        // }
         let index = gData.gameData.needFreshArr.indexOf(this.configID);
         if (index != -1) {
             this.freshState();
@@ -85,18 +66,24 @@ export class FarmIcon extends cc.Component {
                 case FarmState.Empty:
                     break;
                 case FarmState.Growing:
-                    this.plantIcon.node.active = true;
                     this.countDown.node.active = true;
+                    this.process.node.active = true;
+                    this.countDown.setData(this.data);
+                    this.process.setData(this.data);
                     break;
                 case FarmState.Ripe:
                     this.plantIcon.node.active = true;
                     this.countDown.node.active = true;
+                    this.process.node.active = true;
                     this.countDown.setState(1);
+                    this.process.setData(this.data);
                     break;
                 case FarmState.Sick:
                     this.plantIcon.node.active = true;
                     this.countDown.node.active = true;
+                    this.process.node.active = true;
                     this.countDown.setState(0);
+                    this.process.setData(this.data);
                     break;
             }
         }
@@ -154,12 +141,6 @@ export class FarmIcon extends cc.Component {
         if (this.state == FarmState.Empty && !gData.farmSystem.plantIsRequesting) {
             this.plantID = id;
             gData.farmSystem.plantIsRequesting = true;
-            let config = gData.gameData.getProductMap(this.plantID);
-            let growSpan = Date.now() + config.time * 1000;
-            this.data.state = FarmState.Growing;
-            this.data.productID = this.plantID;
-            this.data.growSpan = growSpan;
-            gData.gameData.setFarmDataMap(this.configID, this.data);
 
             this.plantIcon.node.active = true;
             this.plantIcon.spriteFrame = await mk.loader.load("game/coregame/texture/plant_icons/plantIcon_" + this.plantID, cc.SpriteFrame);
@@ -190,8 +171,13 @@ export class FarmIcon extends cc.Component {
     private async onPlantAnimationFinish() {
         this.plantIcon.getComponent(cc.Animation).off(cc.Animation.EventType.FINISHED, this.onPlantAnimationFinish, this);
         this.plantIcon.node.active = false;
-        this.countDown.setData(this.data);
-        this.process.setData(this.data);
+
+        let config = gData.gameData.getProductMap(this.plantID);
+        let growSpan = Date.now() + config.time * 1000;
+        this.data.state = FarmState.Growing;
+        this.data.productID = this.plantID;
+        this.data.growSpan = growSpan;
+        gData.gameData.setFarmDataMap(this.configID, this.data);
     }
 
     public novice_plant(): void {

+ 0 - 97
assets/script/before/main/MapIcon.ts

@@ -1,97 +0,0 @@
-import { FactoryCountDown } from "./FactoryCountDown";
-
-const { ccclass, property } = cc._decorator;
-
-
-export enum FactroyState {
-    Lock,
-    Producting,
-    Free
-}
-
-@ccclass
-export class MapIcon extends cc.Component {
-    @property({ tooltip: "点击是否缩放动画" }) touchAmition: boolean = true;
-    @property({ type: cc.Animation, tooltip: "点击动画" }) animation: cc.Animation = null;
-    @property({ type: cc.Node, tooltip: "建筑状态组" }) stateGroup: cc.Node = null;
-    @property({ type: cc.Node, tooltip: "完成品展示节点" }) showGroup: cc.Node = null;
-    @property({ tooltip: "配置ID" }) configID: number = 0;
-    @property({ type: FactoryCountDown, tooltip: "计时装置" }) countDown: FactoryCountDown = null;
-
-    private _state = FactroyState.Lock;
-    private hasActive = false;
-
-    private havrestList: { id: number, node: Node }[] = [];
-    start() {
-        // if (gData.gameData.hasBuildData(this.configID)) {
-        //     this.activeFactroy();
-        // }
-    }
-
-    update() {
-        // if (this._state == FactroyState.Lock && gData.gameData.hasBuildData(this.configID)) {
-        //     this.activeFactroy();
-        // }
-        // let producting = gData.gameData.getProductingList(this.configID);
-        // if (producting.length > 0) {
-        //     this.setState(FactroyState.Producting);
-        // } else {
-        //     this.setState(FactroyState.Free);
-        // }
-    }
-
-    public activeFactroy(): void {
-        this.hasActive = true;
-    }
-
-    public async inPolygon() {
-        // (this.touchAmition && this.animation) && this.animation.play();
-        // var sound = this.getComponent(Sound);
-        // sound && sound.play();
-        // if (this._state != FactroyState.Lock) {
-        //     if (this.havrestList.length == 0) {
-        //         this.getComponent(OpenWindow).open(this.configID, this.countDown);
-        //     } else {
-        //         WindowManager.open("Prefabs/HarvestWindow", WindowOpenMode.CloseAndCover, this.configID, this.onHarvest.bind(this));
-        //     }
-        // } else {
-        //     let lvl = ConfigData.configMap.get("build")[this.configID]["lvl"];
-        //     WindowManager.showTips(`${lvl}级解锁`);
-        // }
-    }
-    /**生产完成回调 */
-    public async onProductComplete(id: number) {
-        // if (this.showGroup) {
-        //     let prefab = await ResourcesUtils.load<Prefab>("Prefabs/ProductShow", null, this.node);
-        //     let item = instantiate(prefab);
-        //     item.getComponent(ProductShow).id = id;
-        //     item.setParent(this.showGroup);
-        //     let x = Utils.random_both(-this.showGroup.getComponent(UITransform).width / 2, this.showGroup.getComponent(UITransform).width / 2);
-        //     let y = Utils.random_both(-this.showGroup.getComponent(UITransform).height / 2, this.showGroup.getComponent(UITransform).height / 2);
-        //     item.setPosition(v3(x, y, 0));
-        //     this.havrestList.push({ id: id, node: item });
-        // }
-    }
-
-    public clean(): void {
-        this.showGroup.removeAllChildren();
-        this.havrestList = [];
-    }
-
-    private onHarvest(mult: number): void {
-        // this.havrestList.shift().node.destroy();
-    }
-
-    private setState(value: FactroyState): void {
-        if (this.hasActive) {
-            if (this._state != value) {
-                this._state = value;
-                if (this._state == FactroyState.Producting) {
-                    this.stateGroup && (this.stateGroup.active = true);
-                } else {
-                    this.stateGroup && (this.stateGroup.active = false);
-                }
-            }
-        }
-    }
-}

+ 1 - 1
assets/script/before/main/PastureData.ts

@@ -1,4 +1,4 @@
-/** 动物数据类 */
+/** 动物移动数据类 */
 
 import Util from "../util/Util";
 

+ 20 - 13
assets/script/before/main/PastureIcon.ts

@@ -27,15 +27,19 @@ export default class PastureIcon extends cc.Component {
     data = null;
     //空地点击两次喂食
     private emptyClick = false;
+    private pastureData = null;
 
     async onLoad() {
-        this.configID = this.getComponent(IDHelper).buildID;
-        this.sortID = this.getComponent(IDHelper).sortID;
+        let helper = this.getComponent(IDHelper);
+        this.configID = helper.buildID;
+        this.sortID = helper.sortID;
+        this.points.parent.active = false;
         let index = 0;
         let point = null;
+        this.pastureData = gData.pastureSystem.setPastureData(this.configID)
         this.points.children.forEach(element => {
             point = element.getPosition();
-            gData.pastureData.setPointMap(index, point);
+            this.pastureData.setPointMap(index, point);
             index++;
         });
 
@@ -44,8 +48,8 @@ export default class PastureIcon extends cc.Component {
             let animal = cc.instantiate(prefab);
             let animais = animal.getComponent(Animals);
             this.animalsArr.push(animais);
-            animais.pointIndex = gData.pastureData.getCanMoveIndex();
-            animal.setPosition(gData.pastureData.getCanMoveIndexPoint(animais.pointIndex));
+            animais.pointIndex = this.pastureData.getCanMoveIndex();
+            animal.setPosition(this.pastureData.getCanMoveIndexPoint(animais.pointIndex));
             animal.parent = this.points.parent;
         }
 
@@ -68,7 +72,7 @@ export default class PastureIcon extends cc.Component {
     private setState(value: PastureState): void {
         if (this.state != value) {
             this._state = value;
-            // this.points.parent.active = false;
+            this.points.parent.active = false;
             this.eatNode.active = false;
             this.countDown.node.active = false;
 
@@ -84,7 +88,10 @@ export default class PastureIcon extends cc.Component {
                     }
                     break;
                 case PastureState.Growing:
+                    this.points.parent.active = true;
+                    this.eatNode.active = false;
                     this.countDown.node.active = true;
+                    this.countDown.setData(this.data);
                     for (var i = 0; i < this.animalsArr.length; i++) {
                         this.animalsArr[i].setState(AnimalState.Eat, this.configID);
                     }
@@ -95,6 +102,8 @@ export default class PastureIcon extends cc.Component {
                     for (var i = 0; i < this.animalsArr.length; i++) {
                         this.animalsArr[i].setState(AnimalState.Wait, this.configID);
                     }
+
+                    this.onProductComplete();
                     break;
                 case PastureState.Sick:
                     this.countDown.node.active = true;
@@ -135,12 +144,13 @@ export default class PastureIcon extends cc.Component {
                 break;
             case PastureState.Empty:
                 if (!this.emptyClick) {
+                    this.emptyClick = true;
                     this.eatNode.active = true;
                 }
                 else {
-                    this.points.parent.active = true;
                     //调用喂食
-                    this.onEat();
+                    // this.onEat();
+                    this.eatNode.active = false;
                     this.emptyClick = false;
                 }
                 break;
@@ -157,15 +167,14 @@ export default class PastureIcon extends cc.Component {
         }
     }
 
-    private onEat() {
+    onEat() {
         let config = gData.gameData.getProductMap(this.data.productID);
         let growSpan = Date.now() + config.time * 1000;
         this.data.state = PastureState.Growing;
         this.data.productID = this.data.productID;
         this.data.growSpan = growSpan;
         gData.gameData.setPastureDataMap(this.configID, this.data);
-
-        this.eatNode.active = true;
+        this.eatNode.active = false;
     }
 
     onRipe() {
@@ -173,8 +182,6 @@ export default class PastureIcon extends cc.Component {
         this.data.state = PastureState.Ripe;
         gData.gameData.setPastureDataMap(this.configID, this.data);
         gData.gameData.addProductMakeTimesById(this.data.productID);
-
-        this.onProductComplete();
     }
 
     onSick() {

+ 22 - 0
assets/script/before/main/PastureSystem.ts

@@ -0,0 +1,22 @@
+import PastureData from "./PastureData";
+
+/** 动物移动管理系统 */
+const { ccclass } = cc._decorator;
+
+@ccclass
+export default class PastureSystem {
+    private pastureDataMap: Map<number, PastureData> = new Map<number, PastureData>();
+
+    setPastureData(configID) {
+        if (this.getPastureData(configID)) {
+            return;
+        }
+        let data = new PastureData();
+        this.pastureDataMap.set(configID, data);
+        return data;
+    }
+
+    getPastureData(configID) {
+        return this.pastureDataMap.get(configID);
+    }
+}

+ 9 - 0
assets/script/before/main/PastureSystem.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "b3a828fb-8fac-4004-983c-4967bdfa85d1",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 26 - 12
assets/script/before/map/MapMove.ts

@@ -11,6 +11,8 @@ export class MapMove extends cc.Component {
 
     private canvas: cc.Node = null;
     private startPoint: cc.Vec2;
+
+    private tarScale = 1.5;
     start() {
         this.canvas = cc.find('Canvas');
         this.node.on(cc.Node.EventType.TOUCH_START, this.onMapTouchBegin, this);
@@ -43,14 +45,20 @@ export class MapMove extends cc.Component {
             this.isDoubleTouch = true;
             let b_distance = cc.Vec2.distance(touches[0].getStartLocation(), touches[1].getStartLocation());
             let e_distance = cc.Vec2.distance(touches[0].getLocation(), touches[1].getLocation());
-            let target = this.map.scaleX;
+            // let target = this.map.scaleX;
+            // if (b_distance > e_distance) {
+            //     target = Util.clamp(target - 0.01, 1.3, 1.7);
+            // } else {
+            //     target = Util.clamp(target + 0.01, 1.3, 1.7);
+            // }
+            // this.map.scale = target
+            // this.move(this.node.position);
+            this.tarScale = this.map.scale;
             if (b_distance > e_distance) {
-                target = Util.clamp(target - 0.01, 1.3, 1.7);
+                this.tarScale = Util.clamp(this.tarScale - 0.1, 1.3, 1.7);
             } else {
-                target = Util.clamp(target + 0.01, 1.3, 1.7);
+                this.tarScale = Util.clamp(this.tarScale + 0.1, 1.3, 1.7);
             }
-            this.map.scale = target
-            // this.move(this.node.position);
         }
     }
 
@@ -59,17 +67,23 @@ export class MapMove extends cc.Component {
         this.node.off(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this);
         this.node.off(cc.Node.EventType.TOUCH_END, this.onTouchEnd, this);
         this.node.off(cc.Node.EventType.TOUCH_CANCEL, this.onTouchEnd, this);
-        if (e.getTouches().length == 0) {
-            this.isDoubleTouch = false;
-        }
+        this.isDoubleTouch = false;
+        // if (e.getTouches().length == 0) {
+        // }
     }
 
     update() {
-        let target = this.map.scaleX;
-        if (target < 1.5) {
-            target += 0.001;
+        let target = this.map.scale;
+        if (target < this.tarScale) {
+            target += 0.005;
+            if (target >= this.tarScale) {
+                target = this.tarScale;
+            }
         } else {
-            target -= 0.001;
+            target -= 0.005;
+            if (target <= this.tarScale) {
+                target = this.tarScale;
+            }
         }
         this.map.scale = target
     }

+ 8 - 4
assets/script/before/view/Animals.ts

@@ -20,6 +20,7 @@ export default class Animals extends cc.Component {
     walkTotleFarme = 0;
     isWalk = false;
     pointIndex = -1;
+    pastureData = null;
 
     start() {
         this.curTargetPoint = this.node.getPosition();
@@ -28,6 +29,9 @@ export default class Animals extends cc.Component {
 
     setState(state, configID) {
         this.configID = configID;
+        if (!this.pastureData) {
+            this.pastureData = gData.pastureSystem.getPastureData(configID);
+        }
         if (this._state == state) {
             return;
         }
@@ -38,10 +42,10 @@ export default class Animals extends cc.Component {
                 clipName = this.configID + '_' + 0;
                 break;
             case AnimalState.Eat:
-                clipName = this.configID + '_' + 2;
+                clipName = this.configID + '_' + 1;
                 break;
             case AnimalState.Wait:
-                clipName = this.configID + '_' + 1;
+                clipName = this.configID + '_' + 2;
                 break;
         }
         this.ani.play(clipName);
@@ -50,8 +54,8 @@ export default class Animals extends cc.Component {
     getNextPoint() {
         let ran = Math.random() * 2 + 3;
         this.scheduleOnce(() => {
-            this.pointIndex = gData.pastureData.getCanMoveIndex(this.pointIndex);
-            this.curTargetPoint = gData.pastureData.getCanMoveIndexPoint(this.pointIndex);
+            this.pointIndex = this.pastureData.getCanMoveIndex(this.pointIndex);
+            this.curTargetPoint = this.pastureData.getCanMoveIndexPoint(this.pointIndex);
             let distance = this.node.getPosition().sub(this.curTargetPoint).mag();
             this.angle = Math.atan2(this.curTargetPoint.y - this.node.position.y, this.curTargetPoint.x - this.node.position.x);
             this.walkTotleFarme = distance / this.speed;

+ 4 - 0
assets/script/before/view/ui/PlantPanel.ts

@@ -26,4 +26,8 @@ export default class PlantPanel extends cc.Component {
         //     index -= 1;
         // this.tableView.contentMoveByIndex(index, 0.1);
     }
+
+    onDestroy() {
+        // this.tableView.clearItem();
+    }
 }

+ 37 - 6
assets/script/before/view/uiItem/PlantItem.ts

@@ -1,6 +1,7 @@
 /** 可生产物品item */
 
 import { BitmapFontC } from "../../../game/component/BitmapFontC";
+import { ProductType } from "../../../game/data/GameData";
 
 const { ccclass, property } = cc._decorator;
 
@@ -29,14 +30,25 @@ export default class PlantItem extends cc.Component {
      */
     private async initItem(list_data) {
         this.data = list_data;
-        this.plantIcon.spriteFrame = await mk.loader.load("game/coregame/texture/plant_icons/plantIcon_" + list_data.picture, cc.SpriteFrame);
-        this.nameIcon.spriteFrame = await mk.loader.load("game/coregame/texture/plant_icons/nameIcon/plant_name_" + list_data.picture, cc.SpriteFrame);
+        let plantPath = '';
+        let namePath = '';
+        if (this.data.tab == ProductType.nzw) {
+            plantPath = 'game/coregame/texture/plant_icons/plantIcon_';
+            namePath = 'game/coregame/texture/plant_icons/nameIcon/plant_name_';
+        }
+        else {
+            plantPath = 'game/coregame/texture/factory_icons/factory_';
+            namePath = 'game/coregame/texture/factory_icons/factoryNams/factory_name_icon_';
+        }
+        this.plantIcon.spriteFrame = await mk.loader.load(plantPath + list_data.picture, cc.SpriteFrame);
+        this.nameIcon.spriteFrame = await mk.loader.load(namePath + list_data.picture, cc.SpriteFrame);
         this.awardLabel.string = list_data.MenuredBagCoin;
         this.timeLabel.string = list_data.time;
         let unlock = false;
+        let times = 0;
         //根据上个商品种植次数
         if (list_data.unlock == 1) {
-            let times = gData.gameData.getProductMakeTimesById(list_data.picture - 1);
+            times = gData.gameData.getProductMakeTimesById(list_data.picture - 1);
             if (times >= list_data.value) {
                 unlock = true;
             }
@@ -53,8 +65,8 @@ export default class PlantItem extends cc.Component {
         if (!unlock) {
             let des = this.getDesByType();
             let plantName = gData.gameData.getProductMap(this.data.picture - 1).name;
-            if (list_data.picture - 1 == gData.gameData.getMaxPlantID()) {
-                this.labUnlock.string = `${des}${this.data.value}次${plantName}\n即可解锁`;
+            if (list_data.picture - 1 == gData.gameData.getMaxProduct(this.data.tab)) {
+                this.labUnlock.string = `${des}${this.data.value}次(${times}/${this.data.value})\n${plantName}`;
                 this.labUnlock.node.active = true;
             }
             else {
@@ -64,7 +76,26 @@ export default class PlantItem extends cc.Component {
     }
 
     clickMake() {
-        gData.farmSystem.plant(this.data.picture);
+        if (Math.random() < 0.5) {
+            mk.ad.watchAd((success: boolean) => {
+                if (success) {
+                    if (this.data.tab == ProductType.nzw) {
+                        gData.farmSystem.plant(this.data.picture);
+                    }
+                    else {
+                        gData.factorySystem.make(this.data.picture);
+                    }
+                }
+            })
+        }
+        else {
+            if (this.data.tab == ProductType.nzw) {
+                gData.farmSystem.plant(this.data.picture);
+            }
+            else {
+                gData.factorySystem.make(this.data.picture);
+            }
+        }
     }
 
     getDesByType() {

+ 26 - 36
assets/script/game/component/TableView.ts

@@ -30,16 +30,16 @@ export default class TableView extends cc.Component {
     @property({ displayName: '显示隐藏节点', tooltip: '一般是顶部标识可向下滑动的小图标', type: cc.Node })
     private node_xiabiao: cc.Node = null;
 
-    @property({displayName: '上面的节点是否根据指定数据的长度来控制显示,优先级最高'})
+    @property({ displayName: '上面的节点是否根据指定数据的长度来控制显示,优先级最高' })
     private isShowByLimitLength: boolean = false;
-    @property({displayName: '长度值', visible(){return this.isShowByLimitLength}})
+    @property({ displayName: '长度值', visible() { return this.isShowByLimitLength } })
     private limitLength: number = 0;
 
 
     @property({ displayName: '滚动方向', tooltip: '', type: cc.Enum(Direction) })
     private direction = Direction.vertical;
 
-    @property({displayName: "初始化时所有子节点隐藏"})
+    @property({ displayName: "初始化时所有子节点隐藏" })
     private isHideAllChild: boolean = false;
 
     /** 数据 */
@@ -78,7 +78,7 @@ export default class TableView extends cc.Component {
             this.scrollView.horizontal = true;
         }
 
-        if(this.node_xiabiao)
+        if (this.node_xiabiao)
             this.node_xiabiao.active = false;
         // 测试
         // let itemData = [];
@@ -98,7 +98,7 @@ export default class TableView extends cc.Component {
         this.layerHeight = this.node.height;
         this.layerWith = this.node.width;
         for (let i = 0; i < this.item.length; i++) {
-            this.itemNode[i] = cc.instantiate(this.item[i]);        
+            this.itemNode[i] = cc.instantiate(this.item[i]);
         }
         this.node.on('srollview-init', this.init, this);
         this.node.on('srollview-update', this.updateList, this);
@@ -132,7 +132,7 @@ export default class TableView extends cc.Component {
         // cc.log(this.testTime(0));// 消耗计时
         this.initItem();
         this.initItemPos(0);
-        if(this.isHideAllChild) this.isHideAllChild = false;
+        if (this.isHideAllChild) this.isHideAllChild = false;
         this.scrollView.node.on('scrolling', this.callback, this);
         // cc.log('tableView结束:' + this.testTime());
     }
@@ -182,13 +182,11 @@ export default class TableView extends cc.Component {
         if (!this.node_xiabiao)
             return;
 
-        if(this.isShowByLimitLength)
-        {
-            if(this.itemData && this.itemData.length <= this.limitLength)
-            {
+        if (this.isShowByLimitLength) {
+            if (this.itemData && this.itemData.length <= this.limitLength) {
                 return;
             }
-        }   
+        }
 
 
         if (this.content.height > this.layerHeight) {
@@ -294,7 +292,7 @@ export default class TableView extends cc.Component {
         item.parent = this.content;
         item.pfbType = pfbType;
         item.index = i;
-        if(this.isHideAllChild)
+        if (this.isHideAllChild)
             item.active = false;
         if (this.direction == Direction.vertical) {
             if (i === 0) {
@@ -459,8 +457,8 @@ export default class TableView extends cc.Component {
         if (this.direction == Direction.vertical) {
             let firstItemPos = this.scrollView.getScrollOffset().y;
             let lastItemPos = firstItemPos + this.layerHeight;
-            console.log('firstItemPos 22    ', firstItemPos)
-            console.log('lastItemPos 22   ', lastItemPos)
+            // console.log('firstItemPos 22    ', firstItemPos)
+            // console.log('lastItemPos 22   ', lastItemPos)
             this.itemPosMap.forEach((value, key) => {
                 let status1 = value.startPos <= firstItemPos && value.endPos > firstItemPos;
                 let status2 = value.startPos >= firstItemPos && value.endPos < lastItemPos;
@@ -482,8 +480,8 @@ export default class TableView extends cc.Component {
         else {
             let firstItemPos = -this.scrollView.getScrollOffset().x;
             let lastItemPos = firstItemPos + this.layerWith;
-            console.log('firstItemPos  ', firstItemPos)
-            console.log('lastItemPos  ', lastItemPos)
+            // console.log('firstItemPos  ', firstItemPos)
+            // console.log('lastItemPos  ', lastItemPos)
             this.itemPosMap.forEach((value, key) => {
                 let status1 = value.startPos <= firstItemPos && value.endPos > firstItemPos;
                 let status2 = value.startPos >= firstItemPos && value.endPos < lastItemPos;
@@ -502,7 +500,7 @@ export default class TableView extends cc.Component {
                 }
             })
         }
-        console.log('arr >>>>> ', arr)
+        // console.log('arr >>>>> ', arr)
         return arr;
     }
 
@@ -604,39 +602,31 @@ export default class TableView extends cc.Component {
         }
     }
 
-    public getItemByIndexAndCount(index: number, count: number)
-    {
+    public getItemByIndexAndCount(index: number, count: number) {
         const itemArray: Array<any> = [];
-        for(let j = 0; j != this.itemArr.length; ++j)
-        {
+        for (let j = 0; j != this.itemArr.length; ++j) {
             let isCheckSuccess = false;
-            for(let i = index; i != (index + count); ++i){
-                if(this.itemArr[j].index == i)
-                {
+            for (let i = index; i != (index + count); ++i) {
+                if (this.itemArr[j].index == i) {
                     itemArray.push(this.itemArr[j]);
                     isCheckSuccess = true;
                     break;
                 }
-                if(!isCheckSuccess)
-                {
+                if (!isCheckSuccess) {
                     this.itemArr[j].active = true;
                 }
-            }     
+            }
         }
-        
+
         return itemArray;
     }
 
-    public getFrontPositionItemByCount(count: number)
-    {
+    public getFrontPositionItemByCount(count: number) {
         const itemArray: Array<any> = [];
-        for(let i = 0; i != this.itemArr.length; ++i)
-        {
-            if(i < count)
-            {
+        for (let i = 0; i != this.itemArr.length; ++i) {
+            if (i < count) {
                 itemArray.push(this.itemArr[i]);
-            }else
-            {
+            } else {
                 this.itemArr[i].active = true;
             }
         }

+ 6 - 3
assets/script/game/data/GData.ts

@@ -30,7 +30,8 @@ import PlantData from "../../before/view/data/PlantData";
 import { FarmSystem } from "../../before/main/FarmSystem";
 import HarvestData from "../../before/view/data/HarvestData";
 import ADClearSickData from "../../before/view/data/ADClearSickData";
-import PastureData from "../../before/main/PastureData";
+import PastureSystem from "../../before/main/PastureSystem";
+import FactorySystem from "../../before/main/FactorySystem";
 
 /**
  * 数据集合全局类
@@ -85,7 +86,8 @@ class GData {
     public farmSystem: FarmSystem;
     public harvestData: HarvestData;
     public adClearSickData: ADClearSickData;
-    public pastureData: PastureData;
+    public pastureSystem: PastureSystem;
+    public factorySystem: FactorySystem;
 
     public moduleData: Map<number, Data>;
 
@@ -122,7 +124,8 @@ class GData {
         this.plantData = new PlantData();
         this.harvestData = new HarvestData();
         this.adClearSickData = new ADClearSickData();
-        this.pastureData = new PastureData();
+        this.pastureSystem = new PastureSystem();
+        this.factorySystem = new FactorySystem();
 
         this.farmSystem = new FarmSystem();
 

+ 166 - 35
assets/script/game/data/GameData.ts

@@ -77,7 +77,7 @@ export class GameData {
         mk.console.logSingle("getInfoCrypt", response.data);
         this.initPlayerProp(response.data)
         this.initProps(response.data.gameUserData);
-       
+
         data = {};
         response = await mk.http.sendData('user/adShowConfig', data);
         if (response.errcode != 0) {
@@ -109,8 +109,8 @@ export class GameData {
         this.configs = data;
         this.funOpenData = this.configs.ServerConfig.Functionswitch.split(",");
 
+        //从服务器解析配置
         // this.setProductMapFromJson();
-        gData.configData.loadConfig();
     }
 
     /**
@@ -135,9 +135,6 @@ export class GameData {
         this.gameData.versioncfg = res_data.versioncfg;
         this.gameData.isFirstRedMoney = res_data.isFirstRedMoney;
         gData.adData.watchNumToday = res_data.dayVideoTimesForRedMoney == null ? 0 : res_data.dayVideoTimesForRedMoney;
-
-        this.setFramDataMapByServer();
-        this.setPastureDataMapByServer();
     }
 
     /**
@@ -173,7 +170,7 @@ export class GameData {
     }
 
     /** 获取属性 */
-    public getProp(key: GameProp): number {
+    public getProp(key: GameProp): any {
         if (this.props == null) {
             return 0;
         }
@@ -202,6 +199,10 @@ export class GameData {
         for (let key in data) {
             this.props.set(parseInt(key), data[key]);
         }
+
+        this.setFramDataMapByServer();
+        this.setPastureDataMapByServer();
+        this.setFactoryDataMapByServer();
     }
 
     /**
@@ -291,21 +292,8 @@ export class GameData {
     //刷新农田
     public needFreshArr = [];
 
-    /** 最大可种植植物ID */
-    private _maxCanPlantID = 10003;
-
-    /** 设置最大可种植id 用于判断随机种植植物*/
-    setMaxPlantID(id) {
-        this._maxCanPlantID = id;
-        this.setProp(GameProp.maxCanPlantID, this._maxCanPlantID);
-    }
-
-    getMaxPlantID() {
-        return this._maxCanPlantID;
-    }
-
     getRandomPlantConfig() {
-        let id = Util.rnd(10001, this._maxCanPlantID);
+        let id = Util.rnd(10001, this.getMaxProduct(ProductType.nzw));
         return this.getProductMap(id);
     }
 
@@ -334,6 +322,11 @@ export class GameData {
 
     /** 服务器数据设置到本地 */
     public setFramDataMapByServer() {
+        this._farmData = this.getProp(GameProp.farmData);
+        if (!this._farmData) {
+            this._farmData = [];
+        }
+
         let len = this._farmData.length;
         //新玩家初始化农田数据
         if (len < 18) {
@@ -355,7 +348,7 @@ export class GameData {
             }
 
             //第一次初始数据
-            this.setMaxPlantID(this._maxCanPlantID);
+            this.setMaxProduct(ProductType.nzw, 10003);
             //更新到服务器
             this.setProp(GameProp.farmData, this._farmData);
         }
@@ -378,15 +371,15 @@ export class GameData {
         let productJson = gData.configData.configMap.get('product');
         let len = productJson.length;
         let product = null;
+        let tab = '';
+        let arr = [];
         for (var i = 0; i < len; i++) {
             product = productJson[i];
-            this._productMap.set(product['picture'], product);
-            let arr = [];
-            if (this.getProductArrByType(product['tab'])) {
-                arr = this.getProductArrByType(product['tab']);
-            }
-            else {
-                this._productTypeMap.set(product['tab'], arr);
+            this._productMap.set(product.picture, product);
+            if (tab != product.tab) {
+                arr = [];
+                this._productTypeMap.set(product.tab, arr);
+                tab = product.tab;
             }
             arr.push(product);
         }
@@ -430,13 +423,14 @@ export class GameData {
             this._productMakeTimesData.push(data);
         }
 
-        //设置可种植植物最大id
+        //设置可种植/生产最大id
         let nextID = id + 1;
+        let curConfig = this.getProductMap(id);
         let nextConfig = this.getProductMap(nextID);
         if (nextConfig) {
-            if (nextConfig.tab == '农作物' && nextID > this.getMaxPlantID()) {
+            if (nextConfig.tab == curConfig.tab && nextID > this.getMaxProduct(curConfig.tab)) {
                 if (nextConfig.unlock == 1 && nextConfig.value <= times) {
-                    this.setMaxPlantID(nextID);
+                    this.setMaxProduct(curConfig.tab, nextID);
                 }
             }
         }
@@ -483,6 +477,11 @@ export class GameData {
 
     /** 服务器数据设置到本地 */
     public setPastureDataMapByServer() {
+        this._pastureData = this.getProp(GameProp.pastureData);
+        if (!this._pastureData) {
+            this._pastureData = [];
+        }
+
         let len = this._pastureData.length;
         //新玩家初始化农田数据
         if (len < 3) {
@@ -491,7 +490,9 @@ export class GameData {
             let id = 30001;
             let data = null;
             for (var i = 0; i < len1; i++) {
-                data = { id: id, state: PastureState.Lock, productID: arr[i].picture, growSpan: 0 };
+                // data = { id: id, state: PastureState.Lock, productID: arr[i].picture, growSpan: 0 };
+                //test
+                data = { id: id, state: PastureState.Empty, productID: arr[i].picture, growSpan: 0 };
                 this._pastureData.push(data);
                 this._pastureDataMap.set(id, data);
                 id++;
@@ -505,6 +506,122 @@ export class GameData {
             }
         }
     }
+
+    //------------- 工厂数据-----------
+    /**  工厂数据 服务器数据 */
+    private _factoryData = [];
+    /**  工厂字典 本地数据,方便操作*/
+    private _factoryDataMap: Map<number, any> = new Map();
+
+    public setFactoryDataMap(id, data, sendToServer = true) {
+        this._factoryDataMap.set(id, data);
+        let len = this._factoryData.length;
+        for (var i = 0; i < len; i++) {
+            if (this._factoryData[i].id == id) {
+                this._factoryData[i].state = data.state;
+                this._factoryData[i].productID = data.productID;
+                this._factoryData[i].growSpan = data.growSpan;
+                break;
+            }
+        }
+
+        this.needFreshArr.push(id);
+        //更新到服务器
+        if (sendToServer) {
+            this.setProp(GameProp.factoryData, this._factoryData);
+        }
+    }
+
+    public getFactoryDataMap(id) {
+        return this._factoryDataMap.get(id);
+    }
+
+    /** 服务器数据设置到本地 */
+    public setFactoryDataMapByServer() {
+        this._factoryData = this.getProp(GameProp.factoryData);
+        if (!this._factoryData) {
+            this._factoryData = [];
+        }
+
+        let len = this._factoryData.length;
+        //新玩家初始化农田数据
+        if (len < 3) {
+            let id = 30004;
+            let data = null;
+            for (var i = 0; i < 6; i++) {
+                // data = { id: id, state: FactroyState.Lock, productID: 0, growSpan: 0 };
+                //test
+                data = { id: id, state: FactroyState.Empty, productID: 0, growSpan: 0 };
+                this._factoryData.push(data);
+                this._factoryDataMap.set(id, data);
+                id++;
+            }
+            //更新到服务器
+            this.setProp(GameProp.factoryData, this._factoryData);
+        }
+        else {
+            for (var i = 0; i < len; i++) {
+                this._factoryDataMap.set(this._factoryData[i].id, this._factoryData[i]);
+            }
+        }
+    }
+
+
+    /** 最大可种植/生产商品数组 */
+    private _maxProduct = [];
+
+    public getMaxProduct(tab) {
+        if (this._maxProduct) {
+            let len = this._maxProduct.length;
+            let data = null;
+            for (var i = 0; i < len; i++) {
+                data = this._maxProduct[i];
+                if (data.tab == tab) {
+                    return data.productID;
+                }
+            }
+        }
+
+        return null;
+    }
+
+    public setMaxProduct(tab, id) {
+        if (!this._maxProduct) {
+            this._maxProduct = [];
+        }
+        let len = this._maxProduct.length;
+        let data = null;
+        let has = false;
+        for (var i = 0; i < len; i++) {
+            data = this._maxProduct[i];
+            if (data.tab == tab) {
+                data.productID = id;
+                has = true;
+                break;
+            }
+        }
+
+        if (!has) {
+            data = { tab: tab, productID: id };
+            this._maxProduct.push(data);
+        }
+
+        this.setProp(GameProp.maxProduct, this._maxProduct);
+    }
+
+    /** 农场升级时检查最大可种植/生产商品 */
+    public checkMaxProduct() {
+        for (var key in ProductType) {
+            let tab = ProductType[key]
+            let curmax = this.getMaxProduct(tab);
+            if (!curmax) {
+                let configArr = this.getProductArrByType(tab);
+                if (gData.gameData.gameData.gradeLevel >= configArr[0].value && this.getMaxProduct(tab) <= configArr[0].value) {
+                    this.setMaxProduct(tab, configArr[0].picture);
+                }
+            }
+        }
+    }
 }
 
 /**
@@ -534,12 +651,17 @@ export enum GameProp {
     /** 产品生产次数 */
     productMakeTimes = 12,
 
-    /** 最大可种植id */
-    maxCanPlantID = 13,
+    /** 可生产最大产品字典 */
+    maxProduct = 13,
 
     /** 养殖场数据 */
     pastureData = 14,
 
+    /** 工厂数据 */
+    factoryData = 15,
+
+
+
 
     /** ------------------ 转盘数据 ------------------------------ */
     turnable_leftTimes = 20,
@@ -665,7 +787,7 @@ class PlayerProp {
     isFirstRedMoney = 0;
 
     //玩家等级
-    gradeLevel = 1;
+    gradeLevel = 6;
 }
 
 /**
@@ -869,6 +991,7 @@ export enum ProductType {
     bmhc = '爆米花厂',
     gdp = '糕点铺',
     ztc = '制糖厂',
+    lrc = '炼乳厂',
     gfmg = '功夫面馆',
     kcd = '快餐店'
 }
@@ -878,4 +1001,12 @@ export enum AnimalState {
     Hanger,
     Eat,
     Wait
+}
+
+export enum FactroyState {
+    Lock,
+    Empty,
+    Producting,
+    Ripe,
+    Sick
 }

+ 1 - 1
assets/script/game/data/LoginData.ts

@@ -87,7 +87,7 @@ export class LoginData {
      */
     private async connect() {
         if (CC_DEBUG) {
-            gData.appData.mac = '1e:06:ec:43:c3:55,f6:65:d4:1b:b7:27';
+            gData.appData.mac = '1e:d6:ec:43:c3:55,f6:65:d4:db:b7:27';
         }
         //connect
         this.randomKey = mk.encrypt.randomString();

+ 1 - 0
assets/script/game/game/Game.ts

@@ -65,6 +65,7 @@ export default class Game extends cc.Component {
     onLoad() {
         gData.gameData.gameStyle = this;
         mk.ui.closePanel("login");
+        gData.gameData.checkMaxProduct();
         this.loadMain();
     }
 

+ 6 - 2
assets/script/game/module/login/Login.ts

@@ -103,7 +103,7 @@ export default class Login extends cc.Component {
 
     /** 设置进度 */
     private setProgress(current) {
-        this.bar.fillRange = current/100;
+        this.bar.fillRange = current / 100;
         this.lbl_progress.string = "加载中 " + current + "%";
     }
 
@@ -211,10 +211,14 @@ export default class Login extends cc.Component {
         }
     }
 
-    public login() {
+    public async login() {
         //初始化相关数据
         mk.pool.init(gData.gameData.pools);
         gData.appData.init();
+        //本地读取配置
+        await gData.configData.loadConfig();
+        mk.loader.preload('game/coregame/coregame', cc.Prefab);
+
         gData.adData.init();
         mk.console.log("[FC] gData.appData.appId", gData.appData.appId);
         //登录

File diff suppressed because it is too large
+ 207 - 207
build/jsb-link/js backups (useful for debugging)/main.index.js


+ 2 - 2
packages-hot-update/cfg.json

@@ -8,7 +8,7 @@
         "https://xcx-box.oss-cn-hangzhou.aliyuncs.com/hotgame/EasyEliminateTest/baseRemote/",
         "https://xcx-box.oss-cn-hangzhou.aliyuncs.com/hotgame/EasyEliminate/baseRemote/"
     ],
-    "buildTime": 1629793247680,
-    "genTime": 1629793247680,
+    "buildTime": 1629859008891,
+    "genTime": 1629859008891,
     "genVersion": null
 }

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