106 lines
2.8 KiB
JavaScript
106 lines
2.8 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, '0f8f1nBOHFFLb4KtxtRZ7kV', 'cmp.planesafk.wnd.evtshop');
|
|
// Scripts/mod/pve/planesafk/cmp/cmp.planesafk.wnd.evtshop.js
|
|
|
|
"use strict";
|
|
|
|
var BridgeWindow = require("bridge.window");
|
|
var NxExpand = require("nx.fx.sv.expand");
|
|
var PlanesafkController = require("planesafk_controller");
|
|
var PlanesafkEvent = require("planesafk_event");
|
|
var PlanesafkConst = require("planesafk_const");
|
|
cc.Class({
|
|
"extends": BridgeWindow,
|
|
properties: {
|
|
list: {
|
|
"default": null,
|
|
type: NxExpand
|
|
},
|
|
left_btn: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
left_txt: {
|
|
"default": null,
|
|
type: cc.Label
|
|
}
|
|
},
|
|
// LIFE-CYCLE CALLBACKS:
|
|
onLoad: function onLoad() {
|
|
this.ctrl = PlanesafkController.getInstance();
|
|
this.model = this.ctrl.getModel();
|
|
this.bindGEvent(PlanesafkEvent.Evt_Shop_Event, this.upEvtShop.bind(this));
|
|
},
|
|
upEvtShop: function upEvtShop(data) {
|
|
if (!data) return;
|
|
this.data = data;
|
|
this.updateData();
|
|
this.updateListInfo();
|
|
},
|
|
start: function start() {},
|
|
onOpenConfigs: function onOpenConfigs(setting) {
|
|
if (!setting) return;
|
|
this.data = setting;
|
|
var evt_data = this.ctrl.getMapEvtData(this.data.line, this.data.index);
|
|
if (evt_data && evt_data.is_black) {
|
|
this.left_btn.active = false;
|
|
}
|
|
this.setData();
|
|
this.updateData();
|
|
this.ctrl.sender28600(this.data.line, this.data.index, 1, [{
|
|
type: PlanesafkConst.Proto_28600._6,
|
|
val1: 0,
|
|
val2: 0
|
|
}]);
|
|
},
|
|
updateData: function updateData() {
|
|
var evt_data = this.ctrl.getMapEvtData(this.data.line, this.data.index);
|
|
if (evt_data && evt_data.is_black) {
|
|
this.left_btn.active = false;
|
|
} else {
|
|
if (this.data.is_select == 1) {
|
|
this.left_btn.active = true;
|
|
this.left_txt.string = nx.text.getKey("btn_giveup");
|
|
} else {
|
|
this.left_txt.string = nx.text.getKey("btn_goto");
|
|
}
|
|
}
|
|
},
|
|
setData: function setData() {
|
|
this.show_list = this.data.item_list;
|
|
this.list.svcKey = this.data.is_select;
|
|
this.list.rebuild(this.show_list);
|
|
},
|
|
updateListInfo: function updateListInfo() {
|
|
this.show_list = this.data.item_list;
|
|
this.list.svcKey = this.data.is_select;
|
|
this.list.rebuild(this.show_list);
|
|
},
|
|
onPreClosed: function onPreClosed() {
|
|
this.list.rebuild([]);
|
|
},
|
|
// 确定使用
|
|
onClickBtnRight: function onClickBtnRight() {
|
|
if (!this.data) {
|
|
return;
|
|
}
|
|
if (this.data.is_select == 1) {
|
|
this.ctrl.sender28600(this.data.line, this.data.index, 1, [{
|
|
type: PlanesafkConst.Proto_28600._8,
|
|
val1: 0,
|
|
val2: 0
|
|
}]);
|
|
this.close();
|
|
} else {
|
|
this.ctrl.sender28600(this.data.line, this.data.index, 1, [{
|
|
type: PlanesafkConst.Proto_28600._6,
|
|
val1: 0,
|
|
val2: 0
|
|
}]);
|
|
}
|
|
}
|
|
|
|
// update (dt) {},
|
|
});
|
|
|
|
cc._RF.pop(); |