|
|
@@ -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;
|
|
|
+ }
|
|
|
}
|
|
|
|