فهرست منبع

Merge branch 'master' of git.mokasz.com:zouyong/team1_nc

wuwangdong 4 سال پیش
والد
کامیت
4ef3e0310e

+ 12 - 0
assets/res/game/effect.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "fd92f3c6-5c6e-4494-bb9f-eee490eb1153",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 1 - 1
assets/resources/data/guide_data.json

@@ -71,7 +71,7 @@
 		"dialog": "<color=8A4312>生产次数<color=ff0000>达到要求</color>,就可以<color=ff0000>提现</color>啦,加油!</color>",
 		"displayRect": "",
 		"clickRect": "主界面层/game/node_ui/顶部个人信息/任务",
-		"finger": "100:20",
+		"finger": "",
 		"lagNext": "0"
 	},
 	{

+ 12 - 0
assets/resources/game/prefab/nodepool.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "6d082f49-ebbf-436b-8797-bd0e31a956d6",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 33 - 33
assets/resources/module/guide/guide.prefab

@@ -650,7 +650,7 @@
         "__id__": 18
       }
     ],
-    "_active": true,
+    "_active": false,
     "_components": [
       {
         "__id__": 30
@@ -853,7 +853,7 @@
       "__id__": 19
     },
     "_children": [],
-    "_active": true,
+    "_active": false,
     "_components": [
       {
         "__id__": 21
@@ -953,7 +953,7 @@
     "asset": {
       "__uuid__": "5f53c125-7a14-4ca0-986a-0e0d2d665268"
     },
-    "fileId": "67tPswHx5MO4Zt5bsbOULv",
+    "fileId": "f0+/GBQDFN2pcI+RdpJVBQ",
     "sync": false
   },
   {
@@ -964,7 +964,7 @@
       "__id__": 19
     },
     "_children": [],
-    "_active": true,
+    "_active": false,
     "_components": [
       {
         "__id__": 24
@@ -1064,7 +1064,7 @@
     "asset": {
       "__uuid__": "5f53c125-7a14-4ca0-986a-0e0d2d665268"
     },
-    "fileId": "cdHHjtTnRKQIQuOinn4J+S",
+    "fileId": "a5YhxffqVAcKkrjfX/aNJ5",
     "sync": false
   },
   {
@@ -1202,7 +1202,7 @@
         "__id__": 36
       }
     ],
-    "_active": false,
+    "_active": true,
     "_components": [
       {
         "__id__": 48
@@ -1396,7 +1396,7 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 486,
+      "width": 428,
       "height": 129
     },
     "_anchorPoint": {
@@ -1408,8 +1408,8 @@
       "__type__": "TypedArray",
       "ctor": "Float64Array",
       "array": [
-        112,
-        208.685,
+        83,
+        209,
         0,
         0,
         0,
@@ -1467,8 +1467,8 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 400,
-      "height": 112.99999999999999
+      "width": 350,
+      "height": 63
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -1479,8 +1479,8 @@
       "__type__": "TypedArray",
       "ctor": "Float64Array",
       "array": [
-        18.340000000000003,
-        4.12,
+        20.159,
+        4,
         0,
         0,
         0,
@@ -1512,7 +1512,7 @@
       "__id__": 37
     },
     "_children": [],
-    "_active": false,
+    "_active": true,
     "_components": [
       {
         "__id__": 39
@@ -1524,14 +1524,14 @@
     "_opacity": 255,
     "_color": {
       "__type__": "cc.Color",
-      "r": 0,
-      "g": 0,
-      "b": 0,
+      "r": 138,
+      "g": 67,
+      "b": 18,
       "a": 255
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 311.02,
+      "width": 120,
       "height": 63
     },
     "_anchorPoint": {
@@ -1543,8 +1543,8 @@
       "__type__": "TypedArray",
       "ctor": "Float64Array",
       "array": [
-        -200,
-        -6.499999999999993,
+        -165,
+        -31.5,
         0,
         0,
         0,
@@ -1584,8 +1584,8 @@
     ],
     "_srcBlendFactor": 770,
     "_dstBlendFactor": 771,
-    "_string": "再生产1次,即可获得任",
-    "_N$string": "再生产1次,即可获得任",
+    "_string": "欢迎来到",
+    "_N$string": "欢迎来到",
     "_fontSize": 30,
     "_lineHeight": 50,
     "_enableWrapText": true,
@@ -1612,7 +1612,7 @@
     "asset": {
       "__uuid__": "5f53c125-7a14-4ca0-986a-0e0d2d665268"
     },
-    "fileId": "94Qnh/35lGDo9G2jagnGcA",
+    "fileId": "a34JFm7lRGs5qGFGrazuYw",
     "sync": false
   },
   {
@@ -1623,7 +1623,7 @@
       "__id__": 37
     },
     "_children": [],
-    "_active": false,
+    "_active": true,
     "_components": [
       {
         "__id__": 42
@@ -1635,14 +1635,14 @@
     "_opacity": 255,
     "_color": {
       "__type__": "cc.Color",
-      "r": 0,
+      "r": 255,
       "g": 0,
       "b": 0,
       "a": 255
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 330,
+      "width": 210,
       "height": 63
     },
     "_anchorPoint": {
@@ -1654,8 +1654,8 @@
       "__type__": "TypedArray",
       "ctor": "Float64Array",
       "array": [
-        -200,
-        -56.49999999999999,
+        -45,
+        -31.5,
         0,
         0,
         0,
@@ -1695,8 +1695,8 @@
     ],
     "_srcBlendFactor": 770,
     "_dstBlendFactor": 771,
-    "_string": "务红包,快领取次数吧!",
-    "_N$string": "务红包,快领取次数吧!",
+    "_string": "《开心农乐园》",
+    "_N$string": "《开心农乐园》",
     "_fontSize": 30,
     "_lineHeight": 50,
     "_enableWrapText": true,
@@ -1723,7 +1723,7 @@
     "asset": {
       "__uuid__": "5f53c125-7a14-4ca0-986a-0e0d2d665268"
     },
-    "fileId": "07SKCTn4xPA6WdM4cg4luw",
+    "fileId": "00qfg2gz5EoahW2fmjuHvZ",
     "sync": false
   },
   {
@@ -1736,14 +1736,14 @@
     "_enabled": true,
     "_fontFamily": "Arial",
     "_isSystemFontUsed": false,
-    "_N$string": "<color=#000000>再生产1次,即可获得任\n务红包,快领取次数吧!</color>",
+    "_N$string": "<color=8A4312>欢迎来到<color=ff0000>《开心农乐园》</color></color>",
     "_N$horizontalAlign": 1,
     "_N$fontSize": 30,
     "_N$font": {
       "__uuid__": "0bc2f1e8-1dd4-45ba-8f7e-36c47dde4152"
     },
     "_N$cacheMode": 0,
-    "_N$maxWidth": 400,
+    "_N$maxWidth": 350,
     "_N$lineHeight": 50,
     "_N$imageAtlas": null,
     "_N$handleTouchEvent": false,

+ 16 - 4
assets/script/before/main/FactoryIcon.ts

@@ -157,15 +157,15 @@ export class FactoryIcon extends cc.Component {
         mk.ui.openPanel('module/speedUpUI/speedUp');
     }
 
-    onRipe() {
+    onRipe(sendToServer) {
         this.data.state = FactroyState.Ripe;
-        gData.gameData.setFactoryDataMap(this.configID, this.data);
+        gData.gameData.setFactoryDataMap(this.configID, this.data, sendToServer);
         gData.gameData.addProductMakeTimesById(this.data.productID);
     }
 
-    onSick() {
+    onSick(sendToServer) {
         this.data.state = FactroyState.Sick;
-        gData.gameData.setFactoryDataMap(this.configID, this.data);
+        gData.gameData.setFactoryDataMap(this.configID, this.data, sendToServer);
     }
 
     public onHarvest(): void {
@@ -186,4 +186,16 @@ export class FactoryIcon extends cc.Component {
             gData.farmGradeData.addGradeExp(ExpAddType.EAT_others, this.node);
         }
     }
+
+    public canHarvest() {
+        this.getComponent(MoveToCenter).move();
+        gData.factorySystem.currSelectFactory = this;
+        gData.harvestData.openPanel(this.configID, this.data.productID, this.onHarvest.bind(this));
+    }
+
+    public canClearSick() {
+        this.getComponent(MoveToCenter).move();
+        mk.data.sendDataEvent(DataEventId.button_click, "停电icon");
+        gData.adClearSickData.openPanel(this.tab, this.configID);
+    }
 }

+ 36 - 2
assets/script/before/main/FactorySystem.ts

@@ -1,6 +1,6 @@
 /** 工厂数据类 */
 
-import { FactroyState } from "../../game/data/GameData";
+import { FactroyState, GameProp } from "../../game/data/GameData";
 import { FactoryIcon } from "./FactoryIcon";
 
 const { ccclass } = cc._decorator;
@@ -43,11 +43,17 @@ export default class FactorySystem {
 
     setHarvest() {
         let len = this.factoryIcons.length;
+        let sendToServer = false;
         for (var i = 0; i < len; i++) {
             if (this.factoryIcons[i].data.state == FactroyState.Producting) {
-                this.factoryIcons[i].countDown.riped();
+                this.factoryIcons[i].countDown.riped(false);
+                sendToServer = true;
             }
         }
+
+        if (sendToServer) {
+            gData.gameData.freshSendToServer(3);
+        }
     }
 
     canSpeedUp() {
@@ -62,4 +68,32 @@ export default class FactorySystem {
 
         return can;
     }
+
+    canHarvest() {
+        let can = false;
+        let len = this.factoryIcons.length;
+        for (var i = 0; i < len; i++) {
+            if (this.factoryIcons[i].data.state == FactroyState.Ripe) {
+                this.factoryIcons[i].canHarvest();
+                can = true;
+                break;
+            }
+        }
+
+        return can;
+    }
+
+    canClearSick() {
+        let can = false;
+        let len = this.factoryIcons.length;
+        for (var i = 0; i < len; i++) {
+            if (this.factoryIcons[i].data.state == FactroyState.Sick) {
+                this.factoryIcons[i].canClearSick();
+                can = true;
+                break;
+            }
+        }
+
+        return can;
+    }
 }

+ 8 - 8
assets/script/before/main/FarmCountDown.ts

@@ -100,36 +100,36 @@ export class FarmCountDown extends cc.Component {
         }
     }
 
-    public riped(): void {
+    public riped(sendToServer = true): void {
         this.counting = false;
         this.normalGroup.active = false;
-        let can = false;
+        let sick = false;
         if (gData.gameData.playerProp.completeFarmTaskTimes >= 1 && Math.random() < 0.2) {
             if (this.productConfig.tab == ProductType.nzw) {
                 if (gData.gameData.RawInsectCurArr[0] < parseInt(gData.gameData.RawInsectArr[0])) {
-                    can = true;
+                    sick = true;
                     gData.gameData.RawInsectCurArr[0]++;
                 }
             }
             else if (this.productConfig.tab == ProductType.dw) {
                 if (gData.gameData.RawInsectCurArr[1] < parseInt(gData.gameData.RawInsectArr[1])) {
-                    can = true;
+                    sick = true;
                     gData.gameData.RawInsectCurArr[1]++;
                 }
             }
             else if (gData.gameData.RawInsectCurArr[2] < parseInt(gData.gameData.RawInsectArr[2])) {
-                can = true;
+                sick = true;
                 gData.gameData.RawInsectCurArr[2]++;
             }
         }
 
-        if (can) {
+        if (sick) {
             this.sickIcon.active = true;
-            this.onSick && this.onSick.emit(null);
+            this.onSick && this.onSick.emit([sendToServer]);
         }
         else {
             this.ripedIcon.active = true;
-            this.onRiped && this.onRiped.emit(null);
+            this.onRiped && this.onRiped.emit([sendToServer]);
         }
     }
 }

+ 16 - 5
assets/script/before/main/FarmIcon.ts

@@ -21,7 +21,7 @@ export class FarmIcon extends cc.Component {
     public configID: number = 0;
     public sortID: number = 0;
 
-    private plantID: number = 0;
+    public plantID: number = 0;
     private _state: FarmState = -1;
     public get state(): FarmState { return this._state; }
     public data = null;
@@ -189,15 +189,15 @@ export class FarmIcon extends cc.Component {
     }
 
     /** 成熟 */
-    public async onRiped() {
+    public async onRiped(sendToServer) {
         this.data.state = FarmState.Ripe;
-        gData.gameData.setFarmDataMap(this.configID, this.data);
+        gData.gameData.setFarmDataMap(this.configID, this.data, sendToServer);
     }
 
     /** 生虫 */
-    public onSick() {
+    public onSick(sendToServer) {
         this.data.state = FarmState.Sick;
-        gData.gameData.setFarmDataMap(this.configID, this.data);
+        gData.gameData.setFarmDataMap(this.configID, this.data, sendToServer);
     }
 
     private async onPlantAnimationFinish() {
@@ -221,4 +221,15 @@ export class FarmIcon extends cc.Component {
     public novice_clean(): void {
         this.process.cleanProcess();
     }
+
+    public canHarvest() {
+        gData.farmSystem.currSelectFarm = this;
+        gData.harvestData.openPanel(this.configID, this.plantID, this.onHarvest.bind(this));
+    }
+
+    public canClearSick() {
+        gData.farmSystem.currSelectFarm = this;
+        mk.data.sendDataEvent(DataEventId.button_click, "生虫icon");
+        gData.adClearSickData.openPanel(ProductType.nzw, this.configID);
+    }
 }

+ 35 - 1
assets/script/before/main/FarmSystem.ts

@@ -69,12 +69,18 @@ export class FarmSystem {
 
     public setHarvest() {
         let len = this.farms.length;
+        let sendToServer = false;
         for (let i = 0; i < len; i++) {
             if (this.farms[i].data.state == FarmState.Growing) {
                 this.farms[i].process.onSpeed();
-                this.farms[i].countDown.riped();
+                this.farms[i].countDown.riped(false);
+                sendToServer = true;
             }
         }
+
+        if (sendToServer) {
+            gData.gameData.freshSendToServer(1);
+        }
     }
 
     public canSpeedUp() {
@@ -89,5 +95,33 @@ export class FarmSystem {
 
         return can;
     }
+
+    public canHarvest() {
+        let can = false;
+        let len = this.farms.length;
+        for (let i = 0; i < len; i++) {
+            if (this.farms[i].data.state == FarmState.Ripe) {
+                this.farms[i].canHarvest();
+                can = true;
+                break;
+            }
+        }
+
+        return can;
+    }
+
+    public canClearSick() {
+        let can = false;
+        let len = this.farms.length;
+        for (let i = 0; i < len; i++) {
+            if (this.farms[i].data.state == FarmState.Sick) {
+                this.farms[i].canClearSick();
+                can = true;
+                break;
+            }
+        }
+
+        return can;
+    }
 }
 

+ 15 - 4
assets/script/before/main/PastureIcon.ts

@@ -214,15 +214,15 @@ export default class PastureIcon extends cc.Component {
         mk.ui.openPanel('module/speedUpUI/speedUp');
     }
 
-    onRipe() {
+    onRipe(sendToServer) {
         this.data.state = PastureState.Ripe;
-        gData.gameData.setPastureDataMap(this.configID, this.data);
+        gData.gameData.setPastureDataMap(this.configID, this.data, sendToServer);
         gData.gameData.addProductMakeTimesById(this.data.productID);
     }
 
-    onSick() {
+    onSick(sendToServer) {
         this.data.state = PastureState.Sick;
-        gData.gameData.setPastureDataMap(this.configID, this.data);
+        gData.gameData.setPastureDataMap(this.configID, this.data, sendToServer);
     }
 
     public onHarvest(): void {
@@ -241,4 +241,15 @@ export default class PastureIcon extends cc.Component {
             gData.farmGradeData.addGradeExp(ExpAddType.EAT_others, this.node);
         }
     }
+
+    public canHarvest() {
+        this.getComponent(MoveToCenter).move();
+        gData.harvestData.openPanel(this.configID, this.data.productID, this.onHarvest.bind(this));
+    }
+
+    public canClearSick() {
+        this.getComponent(MoveToCenter).move();
+        mk.data.sendDataEvent(DataEventId.button_click, "生病icon");
+        gData.adClearSickData.openPanel(ProductType.dw, this.configID);
+    }
 }

+ 35 - 1
assets/script/before/main/PastureSystem.ts

@@ -46,11 +46,17 @@ export default class PastureSystem {
 
     setHarvest() {
         let len = this.pastureIcons.length;
+        let sendToServer = false;
         for (var i = 0; i < len; i++) {
             if (this.pastureIcons[i].data.state == PastureState.Growing) {
-                this.pastureIcons[i].countDown.riped();
+                this.pastureIcons[i].countDown.riped(false);
+                sendToServer = true;
             }
         }
+
+        if (sendToServer) {
+            gData.gameData.freshSendToServer(2);
+        }
     }
 
     canSpeedUp() {
@@ -65,4 +71,32 @@ export default class PastureSystem {
 
         return can;
     }
+
+    canHarvest() {
+        let can = false;
+        let len = this.pastureIcons.length;
+        for (var i = 0; i < len; i++) {
+            if (this.pastureIcons[i].data.state == PastureState.Ripe) {
+                this.pastureIcons[i].canHarvest();
+                can = true;
+                break;
+            }
+        }
+
+        return can;
+    }
+
+    canClearSick() {
+        let can = false;
+        let len = this.pastureIcons.length;
+        for (var i = 0; i < len; i++) {
+            if (this.pastureIcons[i].data.state == PastureState.Sick) {
+                this.pastureIcons[i].canClearSick();
+                can = true;
+                break;
+            }
+        }
+
+        return can;
+    }
 }

+ 57 - 9
assets/script/game/data/GameData.ts

@@ -323,7 +323,7 @@ export class GameData {
      * @param add 增减变量
      */
     public changeLeftTimes(add) {
-        
+
         gData.gameData.leftTimes += add;
         gData.gameData.leftTimes = (gData.gameData.leftTimes > gData.gameData.maxTimes ? gData.gameData.maxTimes : gData.gameData.leftTimes);
         if (gData.gameData.leftTimes < 0) {
@@ -477,7 +477,13 @@ export class GameData {
         let flyRed = true;
         switch (this.nextType) {
             case 0:
-                mk.tip.pop('农场已满,无法继续生产');
+                // mk.tip.pop('农场已满,无法继续生产');
+                //弹出收获、生虫、加速
+                if (!this.checkCanHarvest()) {
+                    if (!this.checkCanClearSick()) {
+                        this.checkCanSpeedUp(true);
+                    }
+                }
                 flyRed = false;
                 break;
             case 1:
@@ -517,11 +523,10 @@ export class GameData {
             let com = this.playerProp.userFarmTaskInfo.completeCount;
             let count = this.playerProp.userFarmTaskInfo.taskCount;
 
-            if (com >= count)
-            {
+            if (com >= count) {
                 return false;
             }
-                
+
         }
 
         let data = {};
@@ -557,7 +562,7 @@ export class GameData {
         this.needFreshArr.push(id);
         //更新到服务器
         if (sendToServer) {
-            this.setProp(GameProp.farmData, this._farmData);
+            this.freshSendToServer(1);
         }
     }
 
@@ -729,7 +734,7 @@ export class GameData {
         this.needFreshArr.push(id);
         //更新到服务器
         if (sendToServer) {
-            this.setProp(GameProp.pastureData, this._pastureData);
+            this.freshSendToServer(2);
         }
     }
 
@@ -799,7 +804,7 @@ export class GameData {
         this.needFreshArr.push(id);
         //更新到服务器
         if (sendToServer) {
-            this.setProp(GameProp.factoryData, this._factoryData);
+            this.freshSendToServer(3);
         }
     }
 
@@ -905,6 +910,20 @@ export class GameData {
         return configID;
     }
 
+    /** 发送数据到服务器 */
+    freshSendToServer(type) {
+        switch (type) {
+            case 1:
+                this.setProp(GameProp.farmData, this._farmData);
+                break;
+            case 2:
+                this.setProp(GameProp.pastureData, this._pastureData);
+                break;
+            case 3:
+                this.setProp(GameProp.factoryData, this._factoryData);
+                break;
+        }
+    }
 
     /** 最大可种植/生产商品数组 */
     private _maxProduct = [];
@@ -1024,7 +1043,7 @@ export class GameData {
         }
     }
 
-    checkCanSpeedUp() {
+    checkCanSpeedUp(pop = false) {
         let can = false;
         can = gData.farmSystem.canSpeedUp();
         if (!can) {
@@ -1034,6 +1053,9 @@ export class GameData {
             }
         }
 
+        if (can && pop) {
+            mk.ui.openPanel('module/speedUpUI/speedUp');
+        }
         return can;
     }
 
@@ -1042,6 +1064,32 @@ export class GameData {
         gData.pastureSystem.setHarvest();
         gData.factorySystem.setHarvest();
     }
+
+    checkCanHarvest() {
+        let can = false;
+        can = gData.farmSystem.canHarvest();
+        if (!can) {
+            can = gData.pastureSystem.canHarvest();
+            if (!can) {
+                can = gData.factorySystem.canHarvest();
+            }
+        }
+
+        return can;
+    }
+
+    checkCanClearSick() {
+        let can = false;
+        can = gData.farmSystem.canClearSick();
+        if (!can) {
+            can = gData.pastureSystem.canClearSick();
+            if (!can) {
+                can = gData.factorySystem.canClearSick();
+            }
+        }
+
+        return can;
+    }
 }
 
 /**

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

@@ -431,10 +431,6 @@ export default class Game extends cc.Component {
 
         let flyRed = await gData.gameData.makeProduct();
 
-        // if (gData.gameData.playerProp.gradeLevel < 2) {
-        //     mk.tip.pop('生产次数+1');
-        // }
-
         if (flyRed) {
             //mk.audio.playEffect('redmoney');
             this.dpFlyRedAni();