Bläddra i källkod

图鉴主界面展示

wuwangdong 4 år sedan
förälder
incheckning
bf1f828efc

+ 21 - 7
assets/resources/game/prefab/game.prefab

@@ -2258,7 +2258,7 @@
         "__id__": 61
       }
     ],
-    "_active": false,
+    "_active": true,
     "_components": [
       {
         "__id__": 64
@@ -2483,7 +2483,7 @@
         "__id__": 85
       }
     ],
-    "_active": true,
+    "_active": false,
     "_components": [],
     "_prefab": {
       "__id__": 97
@@ -7398,7 +7398,7 @@
     "asset": {
       "__uuid__": "b4dea4a9-29c8-46bc-a50d-5754afa7a2bd"
     },
-    "fileId": "aeItW2Z8xDnaEzKTFSTo3M",
+    "fileId": "6a5cmY2LpG+aFjnXARPpWH",
     "sync": false
   },
   {
@@ -7610,7 +7610,7 @@
     "asset": {
       "__uuid__": "b4dea4a9-29c8-46bc-a50d-5754afa7a2bd"
     },
-    "fileId": "7dLAlbzN5L5aQwPp/vQfgj",
+    "fileId": "4fj1oQKHhKu57GIKAFVNY5",
     "sync": false
   },
   {
@@ -7719,7 +7719,7 @@
     "asset": {
       "__uuid__": "b4dea4a9-29c8-46bc-a50d-5754afa7a2bd"
     },
-    "fileId": "f2GmmV5XFHIK1bIikwnp7+",
+    "fileId": "c1SqrdFXZF46YXr5A1pOVd",
     "sync": false
   },
   {
@@ -10970,8 +10970,22 @@
     "lbl_addHb": {
       "__id__": 237
     },
-    "sp_farmMapIcon": null,
-    "lbl_farmMapDes": null,
+    "node_farmMapUI": {
+      "__id__": 53
+    },
+    "node_farmMapGetReward": {
+      "__id__": 66
+    },
+    "node_farmMapProduct": {
+      "__id__": 60
+    },
+    "sp_farmMapIcon": {
+      "__id__": 56
+    },
+    "lbl_farmMapDes": {
+      "__id__": 62
+    },
+    "lbl_value": [],
     "_id": ""
   },
   {

+ 1 - 1
assets/script/game/data/module/FarmMapData.ts

@@ -12,7 +12,7 @@ export class FarmMapData extends Data {
     public maxUnluckValue: any;
 
     public isStateChange: boolean = false;
-    public isInit = false;
+    public isInit = true;
 
     public init_award = false;
 

+ 67 - 7
assets/script/game/game/Game.ts

@@ -79,8 +79,15 @@ export default class Game extends cc.Component {
     lbl_addHb: cc.Label = null;
 
     //图鉴部分
+    @property({ type: cc.Node, displayName: '图鉴ui总节点' })
+    node_farmMapUI: cc.Node = null;
+    @property({ type: cc.Node, displayName: '图鉴领奖节点' })
+    node_farmMapGetReward: cc.Node = null;
+    @property({ type: cc.Node, displayName: '图鉴种植节点' })
+    node_farmMapProduct: cc.Node = null;
+
     @property({ type: cc.Sprite, displayName: '图鉴图标' })
-    sp_farmMapIcon: cc.Label = null;
+    sp_farmMapIcon: cc.Sprite = null;
     @property({ type: cc.Label, displayName: '描述' })
     lbl_farmMapDes: cc.Label = null;
     @property({ displayName: '数字组', type: cc.Label })
@@ -579,28 +586,59 @@ export default class Game extends cc.Component {
     }
 
     //图鉴部分logic
-    public initRefreshEvent()
-    {
+    public initRefreshEvent() {
 
     }
 
-    public initFarmMapUi()
-    {
+    public async initFarmMapUi() {
+        let plantPath = '';
+        let namePath = '';
+        if (gData.farmMapData.chooseType == 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_';
+        }
+
+        //1:有可领奖的,2:正在解锁,3:所有奖励都领取完
+        let uiShowType = 3;
         for (let key in ProductType) {
             let max = gData.gameData.getMaxProduct(ProductType[key]);
             if (max) {
-                let list_data = gData.gameData.getProductArrByType(ProductType[key]);        
+                let list_data = gData.gameData.getProductArrByType(ProductType[key]);
                 for (let i = 0; i != list_data.length; ++i) {
                     if (list_data[i].picture <= max) {
                         let state = gData.gameData.getFarmMapRewardState(this.getIndex(list_data[i]));
                         if (state == 0) {
-                            
+                            uiShowType = 1;
+
+                            this.sp_farmMapIcon.spriteFrame = await mk.loader.load(plantPath + list_data[i].picture, cc.SpriteFrame);
                             return;
                         }
+                    } else if (list_data[i].picture - 1 == max) {
+                        uiShowType = 2
+
+                        let times = gData.gameData.getProductMakeTimesById(list_data[i].picture - 1);
+                        let plantName = gData.gameData.getProductMap(list_data[i].picture - 1).name;
+                        let des = this.getDesByType(list_data[i]);
+                        this.lbl_farmMapDes.string = `${des}${list_data[i].value}次${plantName}(${times}/${list_data[i].value})`;;
+                        this.sp_farmMapIcon.spriteFrame = await mk.loader.load('module/farmMap/texture/gift', cc.SpriteFrame);
+                        return;
                     }
                 }
             }
         }
+
+        if (uiShowType == 3) {
+            this.node_farmMapUI.active = false;
+        } else {
+            if (!this.node_farmMapUI.active) {
+                this.node_farmMapUI.active = true;
+            }
+        }
+
     }
 
     showChangePart() {
@@ -655,5 +693,27 @@ export default class Game extends cc.Component {
 
         return index;
     }
+
+    getDesByType(data) {
+        let des = ''
+        switch (data.tab) {
+            case '农作物':
+                des = '种植';
+                break;
+            case '动物':
+                des = '养殖';
+                break;
+            case '爆米花厂':
+            case '糕点铺':
+            case '制糖厂':
+            case '炼乳厂':
+            case '功夫面馆':
+            case '快餐店':
+                des = '制作';
+                break;
+        }
+
+        return des;
+    }
 }
 

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

@@ -11,6 +11,7 @@ export class RedPointControl extends cc.Component {
     start()
     {
         //this.changeStatus();
+        gData.farmMapData.isStateChange = false;
     }
 
     update(dt)

BIN
build/jsb-link/frameworks/runtime-src/proj.android-studio/.idea/caches/build_file_checksums.ser