130 lines
3.4 KiB
JavaScript
130 lines
3.4 KiB
JavaScript
// --------------------------------------------------------------------
|
|
// @author: shiraho@syg.com(必填, 创建模块的人员)
|
|
// @description:
|
|
// 好友主界面
|
|
// <br/>Create: new Date().toISOString()
|
|
// --------------------------------------------------------------------
|
|
var StrongerController = require("stronger_controller")
|
|
var PathTool = require("pathtool");
|
|
var StrongerEvent = require("stronger_event")
|
|
const FxTogs = require( "nx.fx.togs" );
|
|
const BridgeWindow = require("bridge.window")
|
|
const 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 () {
|
|
this.ctrl = StrongerController.getInstance();
|
|
this.model = this.ctrl.getModel();
|
|
|
|
this.togs.posTog = this.onTogMenu.bind( this );
|
|
this.togs.togTo(0);
|
|
},
|
|
|
|
//当前根节点销毁前进行的预处理操作
|
|
onPreClosed(){
|
|
this.StrongerPanel.getComponent("cmp.stronger.panel").desPartners();
|
|
|
|
this.ziyuan_sv.rebuild([]);
|
|
this.wenti_sv.rebuild([]);
|
|
},
|
|
|
|
start () {
|
|
|
|
},
|
|
|
|
createSubPanel: function (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(let 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(params){
|
|
this.partner_id = params.partner_id || 0;
|
|
let cur_index = params.index || 0
|
|
this.ctrl.setIsFirst(false)
|
|
this.createSubPanel(cur_index)
|
|
},
|
|
|
|
//获取资源
|
|
resourcePanel(){
|
|
let list = []
|
|
for(let i in gdata("stronger_data","data_resource_one")){
|
|
let cfg = {};
|
|
cfg.type = 2;
|
|
cfg.data = game.configs.stronger_data.data_resource_one[i];
|
|
list.push(cfg)
|
|
}
|
|
|
|
this.ziyuan_sv.rebuild(list);
|
|
},
|
|
|
|
problemPanel(){
|
|
let list = []
|
|
for(let i in game.configs.stronger_data.data_problem){
|
|
list.push(game.configs.stronger_data.data_problem[i])
|
|
}
|
|
this.wenti_sv.rebuild(list);
|
|
},
|
|
|
|
onTogMenu(_type){
|
|
this.createSubPanel(Number(_type))
|
|
},
|
|
// update (dt) {},
|
|
}); |