2012-10-10 14:50:04 +08:00
|
|
|
var GameControlMenu = cc.Layer.extend({
|
|
|
|
ctor:function() {
|
|
|
|
// needed for JS-Bindings compatibility
|
|
|
|
cc.associateWithNative( this, cc.Layer);
|
|
|
|
},
|
|
|
|
init:function () {
|
|
|
|
var bRet = false;
|
|
|
|
if (this._super()) {
|
|
|
|
cc.MenuItemFont.setFontSize(18);
|
|
|
|
cc.MenuItemFont.setFontName("Arial");
|
2012-11-05 23:22:59 +08:00
|
|
|
var systemMenu = cc.MenuItemFont.create("Main Menu", this.onSysMenu);
|
2012-10-10 14:50:04 +08:00
|
|
|
var menu = cc.Menu.create(systemMenu);
|
2012-11-05 23:22:59 +08:00
|
|
|
menu.setPosition(0, 0);
|
2012-10-10 14:50:04 +08:00
|
|
|
systemMenu.setAnchorPoint(cc.p(0, 0));
|
2012-11-05 23:22:59 +08:00
|
|
|
systemMenu.setPosition(winSize.width-95, 5);
|
2012-10-10 14:50:04 +08:00
|
|
|
this.addChild(menu, 1, 2);
|
|
|
|
bRet = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return bRet;
|
|
|
|
},
|
2012-11-05 23:22:59 +08:00
|
|
|
onSysMenu:function (pSender) {
|
2012-10-10 14:50:04 +08:00
|
|
|
var scene = cc.Scene.create();
|
|
|
|
scene.addChild(SysMenu.create());
|
|
|
|
cc.Director.getInstance().replaceScene(cc.TransitionFade.create(1.2,scene));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
GameControlMenu.create = function () {
|
|
|
|
var sg = new GameControlMenu();
|
|
|
|
if (sg && sg.init()) {
|
|
|
|
return sg;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
};
|