定义:
var Global = function(){
/**界面相关变量 */
this.curPlaneID = 1;
//当前关卡
this.curStageID = 2;
}
module.exports = new Global();
使用如下:
var Global = require("Global")
cc.Class({
extends: cc.Component,
properties: {
},
onLoad: function () {
this.curPlaneID = Global.curPlaneID; //this.curPlaneID = 1
},
update: function (dt) {
},
});