206 lines
6.2 KiB
JavaScript
206 lines
6.2 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, '37947HPRk5IAKsMVePSmCyQ', 'cmp.adventure.selectmodel');
|
||
|
|
// Scripts/mod/pve/adventure/cmp/cmp.adventure.selectmodel.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
var BridgeWindow = require("bridge.window");
|
||
|
|
var ADVCT = require("adventure_controller");
|
||
|
|
var ADVCONST = require("adventure_const");
|
||
|
|
var ADEVT = require("adventure_event");
|
||
|
|
var ItemLay = require("cmp.common.itemlayout");
|
||
|
|
var TipsController = require("tips_controller");
|
||
|
|
cc.Class({
|
||
|
|
"extends": BridgeWindow,
|
||
|
|
properties: {
|
||
|
|
//周回
|
||
|
|
times: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
energy: {
|
||
|
|
//體力值
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
exps: {
|
||
|
|
//進度
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
upHeros: {
|
||
|
|
//up英雄
|
||
|
|
"default": null,
|
||
|
|
type: ItemLay
|
||
|
|
},
|
||
|
|
upCamps: {
|
||
|
|
//up陣營
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
itemCamp: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
//無盡
|
||
|
|
lastNum: {
|
||
|
|
//剩餘次數
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
curFloor: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
maxFloor: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
times2: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// LIFE-CYCLE CALLBACKS:
|
||
|
|
onLoad: function onLoad() {
|
||
|
|
this.ctrl = ADVCT.getInstance();
|
||
|
|
this.bindGEvent(ADEVT.Init_Model_Win, this.initBase.bind(this));
|
||
|
|
this.bindGEvent(ADEVT.UpModel_Up_Cfg, this.initUpCfgs.bind(this));
|
||
|
|
this.bindGEvent(ADEVT.Buy_Energy, this.updateBuyEnergy.bind(this));
|
||
|
|
},
|
||
|
|
updateBuyEnergy: function updateBuyEnergy(energy) {
|
||
|
|
nx.gui.setString(this.energy, "", energy);
|
||
|
|
},
|
||
|
|
initBase: function initBase(data) {
|
||
|
|
this.ctrl.send29509(2); //需要周回模式的up英雄
|
||
|
|
this.data = data;
|
||
|
|
//周回
|
||
|
|
nx.gui.setString(this.energy, "", data.energy);
|
||
|
|
nx.gui.setCdTxt(this.times, "", data.end_time - data.start_time);
|
||
|
|
nx.gui.setString(this.exps, "", cc.js.formatStr(nx.text.getKey("AdvenExplore"), data.explore));
|
||
|
|
//無盡
|
||
|
|
nx.gui.setString(this.lastNum, "", nx.text.getKey("lab_limitexercise_panel_tip2") + data.times);
|
||
|
|
nx.gui.setString(this.curFloor, "", cc.js.formatStr(nx.text.getKey("AdvenFloors"), data.id));
|
||
|
|
nx.gui.setString(this.maxFloor, "", data.pass_id);
|
||
|
|
nx.gui.setCdTxt(this.times2, "", data.end_time - data.start_time);
|
||
|
|
},
|
||
|
|
initUpCfgs: function initUpCfgs(data) {
|
||
|
|
var list = [];
|
||
|
|
for (var i in data.partner_up_list) {
|
||
|
|
var bid = data.partner_up_list[i].bid;
|
||
|
|
var cfg = game.configs.partner_data.data_partner_base[bid];
|
||
|
|
if (cfg) {
|
||
|
|
list.push(cfg);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
this.upHeros.rebuild(list);
|
||
|
|
nx.bridge.NodeChidrenDestroy(this.upCamps);
|
||
|
|
for (var id in data.camp_list) {
|
||
|
|
var res_path = cc.js.formatStr("coms/images/camps%s", data.camp_list[id].camp_id);
|
||
|
|
var camp = cc.instantiate(this.itemCamp);
|
||
|
|
camp.parent = this.upCamps;
|
||
|
|
camp.active = true;
|
||
|
|
camp.y = 0;
|
||
|
|
nx.gui.setSpriteFrame(camp, "", res_path);
|
||
|
|
}
|
||
|
|
},
|
||
|
|
start: function start() {},
|
||
|
|
onOpenConfigs: function onOpenConfigs(params) {
|
||
|
|
var _this = this;
|
||
|
|
this.ctrl.send29500(1);
|
||
|
|
// 引导辅助
|
||
|
|
if (nx.bridge.plot && nx.bridge.plot.isDoing()) {
|
||
|
|
this.scheduleOnce(function () {
|
||
|
|
_this.positionPlotCells();
|
||
|
|
}, 1);
|
||
|
|
}
|
||
|
|
},
|
||
|
|
onPreClosed: function onPreClosed() {
|
||
|
|
this.upHeros.rebuild([]);
|
||
|
|
nx.bridge.NodeChidrenDestroy(this.upCamps);
|
||
|
|
},
|
||
|
|
selectModel: function selectModel(e) {
|
||
|
|
var model_type = Number(e);
|
||
|
|
this.ctrl.setPlayModel(model_type || 1);
|
||
|
|
if (model_type == ADVCONST.PLAY_MODEL.ENDLESS) {
|
||
|
|
//直接进入主界面,再确认是不是需要选英雄
|
||
|
|
nx.bridge.createPanel("WndAdventureMain", {
|
||
|
|
type: model_type
|
||
|
|
});
|
||
|
|
} else if (model_type == ADVCONST.PLAY_MODEL.WEEKLY) {
|
||
|
|
//进入英雄上阵专属界面,此功能基于玩家背包英雄数据
|
||
|
|
if (this.data.explore == 0) {
|
||
|
|
//未开始,则可以选择英雄
|
||
|
|
nx.bridge.createPanel("WndAdventureWeeklyHero", {});
|
||
|
|
} else {
|
||
|
|
nx.bridge.createPanel("WndAdventureMain", {
|
||
|
|
type: model_type
|
||
|
|
});
|
||
|
|
}
|
||
|
|
}
|
||
|
|
this.close();
|
||
|
|
},
|
||
|
|
onClickWeeklyAward: function onClickWeeklyAward() {
|
||
|
|
nx.bridge.createPanel("WndAdventureExploreAward", {});
|
||
|
|
},
|
||
|
|
onClickEndlessAward: function onClickEndlessAward() {
|
||
|
|
nx.bridge.createPanel("WndAdventureEndlessAward", {});
|
||
|
|
},
|
||
|
|
onTouchWeeklyRule: function onTouchWeeklyRule() {
|
||
|
|
var txt = game.configs.adventure_weekly_data.data_explain;
|
||
|
|
TipsController.getInstance().showDetailPanel(txt);
|
||
|
|
},
|
||
|
|
onTouchEndlessRule: function onTouchEndlessRule() {
|
||
|
|
var txt = game.configs.adventure_endless_data.data_explain;
|
||
|
|
TipsController.getInstance().showDetailPanel(txt);
|
||
|
|
},
|
||
|
|
clickAddPower: function clickAddPower() {
|
||
|
|
var _this2 = this;
|
||
|
|
var cfg = game.configs.adventure_weekly_data.data_adventure_const.prize;
|
||
|
|
var buyLimit = game.configs.adventure_weekly_data.data_adventure_const.buy_condition.val;
|
||
|
|
var str = cc.js.formatStr(nx.text.getKey("AdvenBuyEnerg"), cfg.val[0], cfg.val[1], buyLimit[1], buyLimit[0]);
|
||
|
|
nx.mbox(str, ["cancel", "confirm"], function (_key, _box) {
|
||
|
|
_box.close();
|
||
|
|
if (_key == "confirm") {
|
||
|
|
_this2.ctrl.send29513();
|
||
|
|
}
|
||
|
|
});
|
||
|
|
},
|
||
|
|
clickReset: function clickReset() {
|
||
|
|
// if(this.data.times > 0){
|
||
|
|
this.ctrl.send29512();
|
||
|
|
// }
|
||
|
|
},
|
||
|
|
clickHelp: function clickHelp() {
|
||
|
|
nx.bridge.createPanel("WndPlotPictures", {
|
||
|
|
id: "adventure"
|
||
|
|
});
|
||
|
|
},
|
||
|
|
// ============================================
|
||
|
|
// 引导辅助
|
||
|
|
// ============================================
|
||
|
|
|
||
|
|
// 定位副本輔助热区
|
||
|
|
positionPlotCells: function positionPlotCells() {
|
||
|
|
var node = nx.gui.find(this, "main/help");
|
||
|
|
if (!node) {
|
||
|
|
return nx.error("$Dispatch:定位第一个派遣订单失败!");
|
||
|
|
}
|
||
|
|
var cell = nx.gui.find(this, "plotCell");
|
||
|
|
var btn = node;
|
||
|
|
var pos = btn.convertToWorldSpaceAR(cc.Vec2.ZERO);
|
||
|
|
cell.position = cell.parent.convertToNodeSpaceAR(pos);
|
||
|
|
cell.width = btn.width;
|
||
|
|
cell.height = btn.height;
|
||
|
|
},
|
||
|
|
onTouchFirstHelp: function onTouchFirstHelp() {
|
||
|
|
var cell = nx.gui.find(this, "plotCell");
|
||
|
|
if (cell) {
|
||
|
|
this.clickHelp();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// update (dt) {},
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|