93 lines
2.3 KiB
JavaScript
93 lines
2.3 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, '01a69ZThOJCx4cEuauD4BA1', 'wnd.summon.crystal.card');
|
|
// Scripts/mod/summon/crystal/wnd.summon.crystal.card.js
|
|
|
|
"use strict";
|
|
|
|
/******************************************************************
|
|
*
|
|
* 水晶卡牌召喚
|
|
*
|
|
******************************************************************/
|
|
|
|
var BridgeWindow = require("bridge.window");
|
|
var CRYModel = require("summon.crystal.mod");
|
|
cc.Class({
|
|
"extends": BridgeWindow,
|
|
properties: {
|
|
lstChoices: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
nodSummon: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
defGroup: {
|
|
"default": 10000
|
|
}
|
|
},
|
|
// 重载:参数打开
|
|
onOpenConfigs: function onOpenConfigs(_params) {
|
|
this.lstChoices.children.forEach(function (_node) {
|
|
nx.gui.setActive(_node, "focus", false);
|
|
});
|
|
this.rebuild();
|
|
},
|
|
// 重建列表
|
|
rebuild: function rebuild() {
|
|
// 召唤配置
|
|
var IDS = [10000, 20000, 30000, 40000, 50000];
|
|
var DATA = game.configs.recruit_high_data.data_seerpalace_data;
|
|
for (var i = 0; i < IDS.length; ++i) {
|
|
var id = "" + IDS[i];
|
|
var price = DATA[id].item_once[0];
|
|
var node = nx.gui.find(this.lstChoices, "c" + id);
|
|
nx.gui.setString(node, "price/txt", price[1]);
|
|
nx.bridge.setIconS(node, "price/icon", price[0]);
|
|
}
|
|
|
|
// 默认
|
|
this.onTouchGroup(this.defGroup);
|
|
},
|
|
// 选择阵营
|
|
onTouchGroup: function onTouchGroup(_groupId) {
|
|
var gid = parseInt(_groupId) || 0;
|
|
if (this.group == gid) {
|
|
return;
|
|
}
|
|
this.group = gid;
|
|
this.lstChoices.children.forEach(function (_node) {
|
|
var focus = _node.name == 'c' + gid;
|
|
nx.gui.setActive(_node, "focus", focus);
|
|
});
|
|
},
|
|
// 点击召唤
|
|
onTouchSummon: function onTouchSummon() {
|
|
if (!nx.dt.numPositive(this.group)) {
|
|
return;
|
|
}
|
|
CRYModel.getInstance().reqSummon(this.group, function (_ok, _data) {
|
|
// 失败
|
|
if (!_ok) {
|
|
nx.tbox(_data);
|
|
return;
|
|
}
|
|
var list = [];
|
|
var rewards = _data.rewards || [];
|
|
rewards.forEach(function (_re) {
|
|
list.push({
|
|
bid: _re.base_id,
|
|
num: _re.num
|
|
});
|
|
});
|
|
if (nx.dt.arrNEmpty(list)) {
|
|
nx.bridge.createPanel("PopupRewards", {
|
|
list: list
|
|
});
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
cc._RF.pop(); |