115 lines
3.0 KiB
JavaScript
115 lines
3.0 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, '53a84kEKVJOVYMpwbKNcdui', 'cmp.item.openserver.wnd');
|
|
// Scripts/mod/open_server/cmp.item.openserver.wnd.js
|
|
|
|
"use strict";
|
|
|
|
var SvcItem = require("nx.fx.sv.expand.item");
|
|
var BaseLayout = require("cmp.common.itemlayout");
|
|
var BattleConst = require("battle_const");
|
|
var BattleController = require("battle_controller");
|
|
var 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 rebind(_idx, _data, _key) {
|
|
this._super(_idx, _data, _key);
|
|
|
|
// 刷新
|
|
this.setData(_data, _key);
|
|
},
|
|
onLoad: function onLoad() {},
|
|
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);
|
|
// 引导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 updateDramaDropInfo(item_datas) {
|
|
if (nx.dt.arrEmpty(item_datas)) {
|
|
return false;
|
|
}
|
|
|
|
// 创建物品显示对象,只展示1个
|
|
var list = [];
|
|
for (var index = 0; index < 1; index++) {
|
|
var element = item_datas[index];
|
|
list.push({
|
|
bid: element[0],
|
|
num: element[1]
|
|
});
|
|
}
|
|
this.lay.rebuild(list);
|
|
},
|
|
touchGoto: function touchGoto() {
|
|
nx.bridge.closePanel("WndOpenServer");
|
|
//因为有2个地方能弹框,所以这边要判断下
|
|
if (BattleController.getInstance().hadBattleScene()) {
|
|
BTD.getInstance().openDramaRewardWindow(true);
|
|
} else {
|
|
cc.sys.localStorage.setItem("openServer1Open", 1);
|
|
var MC = BattleController.getInstance();
|
|
if (MC) {
|
|
MC.requestOpenBattleRelevanceWindow(BattleConst.Fight_Type.Darma);
|
|
}
|
|
}
|
|
} // update (dt) {},
|
|
});
|
|
|
|
cc._RF.pop(); |