Files
fc/dev/project/library/imports/b8/b8e2ac20-4407-41e8-9412-244c9f3aca78.js
2026-05-24 10:21:26 +08:00

112 lines
3.0 KiB
JavaScript

"use strict";
cc._RF.push(module, 'b8e2awgRAdB6JQSJEyfOsp4', 'cmp.item.battledrama.reward');
// Scripts/mod/battle_drama/cmp/cmp.item.battledrama.reward.js
"use strict";
var SvcItem = require("nx.fx.sv.expand.item");
var PathTool = require("pathtool");
var BaseLayout = require("cmp.common.itemlayout");
var BattleDramaController = require("battle_drama_controller");
cc.Class({
"extends": SvcItem,
properties: {
lay: {
"default": null,
type: BaseLayout
},
img_received: {
"default": null,
type: cc.Node
},
name_lb: {
"default": null,
type: cc.Label
},
name_lb2: {
"default": null,
type: cc.RichText
},
comfirm_btn: {
"default": null,
type: cc.Node
},
goto_btn: {
"default": null,
type: cc.Node
}
},
// LIFE-CYCLE CALLBACKS:
// 数据重置
rebind: function rebind(_idx, _data, _key) {
this._super(_idx, _data, _key);
// 刷新
this.setData(_data, _key);
},
onLoad: function onLoad() {
this.controller = BattleDramaController.getInstance();
},
start: function start() {},
onDisable: function onDisable() {
this.lay.rebuild([]);
},
setData: function setData(data, _key) {
if (nx.dt.objEmpty(data)) {
return false;
}
var config = data.config_data;
var str = cc.js.formatStr(nx.text.getKey("action_str32"), data.cur_dunname);
if (data.cur_dun >= data.target_dun) var str2 = cc.js.formatStr(nx.text.getKey("action_str33"), data.cur_dun, data.target_dun);else var str2 = cc.js.formatStr(nx.text.getKey("action_str34"), data.cur_dun, data.target_dun);
// 引导tag
if (data.id == 1) this.comfirm_btn.ui_tag = config.limit_id;
this.name_lb.string = str;
this.name_lb2.string = str2;
if (data.sort_index == 3) {
// 已领取
this.goto_btn.active = false;
this.comfirm_btn.active = false;
this.img_received.active = true;
} else if (data.sort_index == 2) {
// 未达条件
this.goto_btn.active = true;
this.comfirm_btn.active = false;
this.img_received.active = false;
} else {
// 可领取
this.goto_btn.active = false;
this.comfirm_btn.active = true;
this.img_received.active = false;
}
// 展示掉落物品
this.updateDramaDropInfo(config.items);
},
// 更新副本掉落物品展示信息
updateDramaDropInfo: function updateDramaDropInfo(item_datas) {
if (nx.dt.arrEmpty(item_datas)) {
return false;
}
// 创建物品显示对象
var list = [];
for (var index = 0; index < item_datas.length; index++) {
var element = item_datas[index];
list.push({
bid: element[0],
num: element[1]
});
}
this.lay.rebuild(list);
},
touchConfirm: function touchConfirm() {
if (this.mdata) {
this.controller.send13009(0, this.mdata.id);
}
},
touchGoto: function touchGoto() {
this.controller.openDramaRewardWindow(false);
} // update (dt) {},
});
cc._RF.pop();