124 lines
3.2 KiB
JavaScript
124 lines
3.2 KiB
JavaScript
const SvcItem = require("nx.fx.sv.expand.item");
|
|
const BaseLayout = require( "cmp.common.itemlayout" );
|
|
const BattleConst = require( "battle_const" );
|
|
const BattleController = require( "battle_controller" );
|
|
const BTD = 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 () {
|
|
},
|
|
|
|
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);
|
|
// 引导tag
|
|
if (data.id == 1)
|
|
this.comfirm_btn.ui_tag = config.limit_id;
|
|
|
|
this.name_lb.string = str;
|
|
this.name_lb2.string = data.prediction_desc;
|
|
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;
|
|
}
|
|
|
|
// 创建物品显示对象,只展示1个
|
|
let list = [];
|
|
for (let index = 0; index < 1; index++) {
|
|
const element = item_datas[index];
|
|
list.push({ bid: element[0], num: element[1] });
|
|
}
|
|
|
|
this.lay.rebuild(list);
|
|
},
|
|
|
|
touchGoto(){
|
|
nx.bridge.closePanel("WndOpenServer");
|
|
//因为有2个地方能弹框,所以这边要判断下
|
|
if(BattleController.getInstance().hadBattleScene())
|
|
{
|
|
BTD.getInstance().openDramaRewardWindow( true );
|
|
}
|
|
else
|
|
{
|
|
cc.sys.localStorage.setItem( "openServer1Open", 1);
|
|
const MC = BattleController.getInstance();
|
|
if( MC ) {
|
|
MC.requestOpenBattleRelevanceWindow( BattleConst.Fight_Type.Darma );
|
|
}
|
|
}
|
|
}
|
|
|
|
// update (dt) {},
|
|
});
|