120 lines
3.1 KiB
JavaScript
120 lines
3.1 KiB
JavaScript
const SvcItem = require("nx.fx.sv.expand.item");
|
|
var PathTool = require("pathtool");
|
|
const 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( _idx, _data, _key ) {
|
|
|
|
this._super( _idx, _data, _key );
|
|
|
|
// 刷新
|
|
this.setData(_data,_key)
|
|
|
|
},
|
|
|
|
onLoad () {
|
|
this.controller = BattleDramaController.getInstance();
|
|
},
|
|
|
|
start () {
|
|
},
|
|
|
|
onDisable(){
|
|
this.lay.rebuild([]);
|
|
},
|
|
|
|
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 (item_datas) {
|
|
if(nx.dt.arrEmpty(item_datas)){
|
|
return false;
|
|
}
|
|
|
|
// 创建物品显示对象
|
|
let list = [];
|
|
for (let index = 0; index < item_datas.length; index++) {
|
|
const element = item_datas[index];
|
|
list.push({ bid: element[0], num: element[1] });
|
|
}
|
|
|
|
this.lay.rebuild(list);
|
|
},
|
|
|
|
touchConfirm(){
|
|
if(this.mdata){
|
|
this.controller.send13009(0,this.mdata.id);
|
|
}
|
|
},
|
|
|
|
touchGoto(){
|
|
this.controller.openDramaRewardWindow(false);
|
|
}
|
|
|
|
// update (dt) {},
|
|
});
|