99 lines
2.9 KiB
JavaScript
99 lines
2.9 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, '0a6948rmbNImqw6nwxgFx8G', 'cmp.battledrama.drop');
|
|
// Scripts/mod/battle_drama/cmp/cmp.battledrama.drop.js
|
|
|
|
"use strict";
|
|
|
|
var BattleDramaController = require("battle_drama_controller");
|
|
var DramaEvent = require("battle_drama_event");
|
|
var ItemLayout = require("cmp.item.layout");
|
|
var PathTool = require("pathtool");
|
|
cc.Class({
|
|
"extends": cc.Component,
|
|
properties: {
|
|
curDropName: {
|
|
"default": null,
|
|
type: cc.Label
|
|
},
|
|
nodList: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
incomList: {
|
|
"default": null,
|
|
type: ItemLayout
|
|
},
|
|
incomNd: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
mainView: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
beacon: {
|
|
"default": null,
|
|
type: cc.Node
|
|
}
|
|
},
|
|
// LIFE-CYCLE CALLBACKS:
|
|
onLoad: function onLoad() {
|
|
this.drama_controller = BattleDramaController.getInstance();
|
|
this.drama_model = this.drama_controller.getModel();
|
|
if (this.up_drop_info == null) {
|
|
this.up_drop_info = gcore.GlobalEvent.bind(DramaEvent.UpDramaDropInfo, this.updateDramaDropInfo.bind(this));
|
|
}
|
|
},
|
|
start: function start() {},
|
|
onEnable: function onEnable() {
|
|
this.updateDramaDropInfo();
|
|
},
|
|
touchShow: function touchShow() {
|
|
nx.gui.setActive(this.mainView, "", !this.mainView.active);
|
|
this.beacon.scaleY = -this.beacon.scaleY;
|
|
// nx.gui.setActive( this.incomNd, "", !this.incomNd.active );
|
|
},
|
|
|
|
//------------------资产掉落
|
|
// 更新副本掉落物品展示信息
|
|
updateDramaDropInfo: function updateDramaDropInfo() {
|
|
// if (!this.is_onshow) return;
|
|
var drama_data = this.drama_model.getDramaData();
|
|
if (nx.dt.objEmpty(drama_data)) {
|
|
return false;
|
|
}
|
|
if (this.cur_drama_max_id == drama_data.max_dun_id) return;
|
|
this.cur_drama_max_id = drama_data.max_dun_id;
|
|
if (this.cur_drama_max_id == 0) {
|
|
this.cur_drama_max_id = 10010;
|
|
}
|
|
var drama_config = game.configs.dungeon_data.data_drama_dungeon_info[this.cur_drama_max_id];
|
|
if (nx.dt.objEmpty(drama_config)) {
|
|
return false;
|
|
}
|
|
this.curDropName.string = nx.text.getKey("tip_battle_button_title6");
|
|
this.updatePerHookInfo(drama_config);
|
|
},
|
|
// 掉落资产信息展示
|
|
updatePerHookInfo: function updatePerHookInfo(config) {
|
|
var item_datas = config.per_hook_items;
|
|
var setProp = function setProp(_node, _data) {
|
|
var cfg = gitemdata(_data[0]);
|
|
nx.gui.setSpriteFrame(_node, "icon", PathTool.querySmallIconPath(cfg.icon));
|
|
nx.gui.setString(_node, "num", cc.js.formatStr("%s/m", _data[1]));
|
|
};
|
|
|
|
// 列表创建
|
|
var chds = this.nodList.children;
|
|
nx.gui.gocChildren(this.nodList, "", item_datas.length, chds[0]);
|
|
for (var i = 0; i < item_datas.length; ++i) {
|
|
setProp(chds[i], item_datas[i]);
|
|
}
|
|
}
|
|
|
|
//------------------资产掉落
|
|
|
|
// update (dt) {},
|
|
});
|
|
|
|
cc._RF.pop(); |