消息传递:
var info ={
path:"prefabes/alerts/alert_chouse",
layerIndex:2,
showBack:false,
backName:"",
scriptName:"alert_chouse_script",
detail:detail,
single:false,
store:false
};
var event = new cc.Event.EventCustom( cc.page.SHOW_PAGE, true);
event.detail = info;
this.node.dispatchEvent( event );
界面显示:::在core.js,界面里面处理界面的逻辑,添加注册监听消息,然后
// use this for initialization
onLoad: function () {
cc.http = require("HTTP");
cc.page = {
SHOW_PAGE:"show_page",
BACK_PAGE:"back_page",
REMOVE_PAGE:"remove_page",
CLEAN_LAYER:"clean_layer",
CLEAN_ALL_LAYERS:"clean_all_layers"
};
this.initEventListener();
},
start: function () {
cc.log("框架初始完毕。。。");
},
initEventListener:function () {
this.node.on(cc.page.SHOW_PAGE,this.onShowPage.bind(this));
this.node.on(cc.page.BACK_PAGE,this.onBackPage.bind(this));
this.node.on(cc.page.REMOVE_PAGE,this.onRemovePage.bind(this));
this.node.on(cc.page.CLEAN_LAYER,this.cleanLayer.bind(this));
this.node.on(cc.page.CLEAN_ALL_LAYERS,this.cleanAllLayers.bind(this));
},