79 lines
2.2 KiB
JavaScript
79 lines
2.2 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, '425aedy2cJDbrMjTXXWrvTa', 'cmp.startower.item.award');
|
|
// Scripts/mod/pve/startower/cmp/cmp.startower.item.award.js
|
|
|
|
"use strict";
|
|
|
|
var ItemBase = require("nx.fx.sv.expand.item");
|
|
var TowerMod = require("startower.mod");
|
|
var ItemLay = require("cmp.common.itemlayout");
|
|
var StartowerEvent = require("startower.define");
|
|
cc.Class({
|
|
"extends": ItemBase,
|
|
properties: {
|
|
sprite_get: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
btn_get: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
btn_goto: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
text_floor: {
|
|
"default": null,
|
|
type: cc.Label
|
|
},
|
|
item_list: {
|
|
"default": null,
|
|
type: ItemLay
|
|
}
|
|
},
|
|
// LIFE-CYCLE CALLBACKS:
|
|
onLoad: function onLoad() {
|
|
this.ctrl = TowerMod.getInstance();
|
|
},
|
|
// 数据重置
|
|
rebind: function rebind(_idx, _data, _key) {
|
|
this._super(_idx, _data, _key);
|
|
|
|
// 刷新
|
|
this.setData(_data);
|
|
},
|
|
setData: function setData(data) {
|
|
if (nx.dt.objEmpty(data)) {
|
|
return false;
|
|
}
|
|
this.reward_data = game.configs.star_tower_data.data_get_floor_award;
|
|
var item_data = this.ctrl.getRewardData(data.id - 1);
|
|
this.tower_data = item_data;
|
|
this.sprite_get.active = this.tower_data.status == 2;
|
|
this.btn_get.active = this.tower_data.status == 1;
|
|
this.btn_goto.active = this.tower_data.status == 0;
|
|
var str = cc.js.formatStr(nx.text.getKey("lab_star_tower_award_item_panel_tip1"), this.reward_data[this.tower_data.id].tower, this.ctrl.getNowTowerId(), this.reward_data[this.tower_data.id].tower);
|
|
this.text_floor.string = str;
|
|
var list = [];
|
|
for (var i in this.reward_data[this.tower_data.id].award) {
|
|
var tab = {};
|
|
tab.bid = this.reward_data[this.tower_data.id].award[i][0];
|
|
tab.num = this.reward_data[this.tower_data.id].award[i][1];
|
|
list.push(tab);
|
|
}
|
|
this.item_list.rebuild(list);
|
|
},
|
|
onDisable: function onDisable() {
|
|
this.item_list.rebuild([]);
|
|
},
|
|
clickGoto: function clickGoto() {
|
|
gcore.GlobalEvent.fire(StartowerEvent.Fight_Success_Event);
|
|
this.ctrl.openAwardWindow(false);
|
|
},
|
|
clickGet: function clickGet() {
|
|
this.ctrl.sender11328(this.tower_data.id);
|
|
} // update (dt) {},
|
|
});
|
|
|
|
cc._RF.pop(); |