119 lines
3.3 KiB
JavaScript
119 lines
3.3 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, '759d0ssxgRCEb9v6nwyWU1u', 'cmp.stronger.main');
|
||
|
|
// Scripts/mod/stronger/cmp/cmp.stronger.main.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
// --------------------------------------------------------------------
|
||
|
|
// @author: shiraho@syg.com(必填, 创建模块的人员)
|
||
|
|
// @description:
|
||
|
|
// 好友主界面
|
||
|
|
// <br/>Create: new Date().toISOString()
|
||
|
|
// --------------------------------------------------------------------
|
||
|
|
var StrongerController = require("stronger_controller");
|
||
|
|
var PathTool = require("pathtool");
|
||
|
|
var StrongerEvent = require("stronger_event");
|
||
|
|
var FxTogs = require("nx.fx.togs");
|
||
|
|
var BridgeWindow = require("bridge.window");
|
||
|
|
var BaseLayout = require("cmp.common.itemlayout");
|
||
|
|
cc.Class({
|
||
|
|
"extends": BridgeWindow,
|
||
|
|
properties: {
|
||
|
|
togs: {
|
||
|
|
"default": null,
|
||
|
|
type: FxTogs
|
||
|
|
},
|
||
|
|
communal_nd: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
StrongerPanel: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
ziyuan_sv: {
|
||
|
|
"default": null,
|
||
|
|
type: BaseLayout
|
||
|
|
},
|
||
|
|
zhenrong_sv: {
|
||
|
|
"default": null,
|
||
|
|
type: BaseLayout
|
||
|
|
},
|
||
|
|
wenti_sv: {
|
||
|
|
"default": null,
|
||
|
|
type: BaseLayout
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// LIFE-CYCLE CALLBACKS:
|
||
|
|
onLoad: function onLoad() {
|
||
|
|
this.ctrl = StrongerController.getInstance();
|
||
|
|
this.model = this.ctrl.getModel();
|
||
|
|
this.togs.posTog = this.onTogMenu.bind(this);
|
||
|
|
this.togs.togTo(0);
|
||
|
|
},
|
||
|
|
//当前根节点销毁前进行的预处理操作
|
||
|
|
onPreClosed: function onPreClosed() {
|
||
|
|
this.StrongerPanel.getComponent("cmp.stronger.panel").desPartners();
|
||
|
|
this.ziyuan_sv.rebuild([]);
|
||
|
|
this.wenti_sv.rebuild([]);
|
||
|
|
},
|
||
|
|
start: function start() {},
|
||
|
|
createSubPanel: function createSubPanel(index) {
|
||
|
|
switch (index) {
|
||
|
|
case 0:
|
||
|
|
this.StrongerPanel.active = true;
|
||
|
|
gcore.GlobalEvent.fire(StrongerEvent.PATCH_DATA_BY_TYPE, this.partner_id);
|
||
|
|
break;
|
||
|
|
case 1:
|
||
|
|
// this.view_list[index] = this.ziyuan_sv.content
|
||
|
|
this.resourcePanel();
|
||
|
|
break;
|
||
|
|
case 3:
|
||
|
|
// this.view_list[index] = this.zhenrong_sv.content
|
||
|
|
// this.recommandPanel()
|
||
|
|
break;
|
||
|
|
case 2:
|
||
|
|
this.problemPanel();
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
if (index == 0) {
|
||
|
|
this.communal_nd.active = false;
|
||
|
|
} else {
|
||
|
|
this.communal_nd.active = true;
|
||
|
|
this.StrongerPanel.active = false;
|
||
|
|
for (var i = 0; i < this.communal_nd.children.length; i++) {
|
||
|
|
this.communal_nd.children[i].active = false;
|
||
|
|
}
|
||
|
|
this.communal_nd.children[index - 1].active = true;
|
||
|
|
}
|
||
|
|
},
|
||
|
|
onOpenConfigs: function onOpenConfigs(params) {
|
||
|
|
this.partner_id = params.partner_id || 0;
|
||
|
|
var cur_index = params.index || 0;
|
||
|
|
this.ctrl.setIsFirst(false);
|
||
|
|
this.createSubPanel(cur_index);
|
||
|
|
},
|
||
|
|
//获取资源
|
||
|
|
resourcePanel: function resourcePanel() {
|
||
|
|
var list = [];
|
||
|
|
for (var i in gdata("stronger_data", "data_resource_one")) {
|
||
|
|
var cfg = {};
|
||
|
|
cfg.type = 2;
|
||
|
|
cfg.data = game.configs.stronger_data.data_resource_one[i];
|
||
|
|
list.push(cfg);
|
||
|
|
}
|
||
|
|
this.ziyuan_sv.rebuild(list);
|
||
|
|
},
|
||
|
|
problemPanel: function problemPanel() {
|
||
|
|
var list = [];
|
||
|
|
for (var i in game.configs.stronger_data.data_problem) {
|
||
|
|
list.push(game.configs.stronger_data.data_problem[i]);
|
||
|
|
}
|
||
|
|
this.wenti_sv.rebuild(list);
|
||
|
|
},
|
||
|
|
onTogMenu: function onTogMenu(_type) {
|
||
|
|
this.createSubPanel(Number(_type));
|
||
|
|
} // update (dt) {},
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|