退出选项同样通过编写插件完成,代码如下:
Scene_Title.prototype.createCommandWindow = function() {
this._commandWindow = new Window_TitleCommand();
this._commandWindow.setHandler('newGame', this.commandNewGame.bind(this));
this._commandWindow.setHandler('continue', this.commandContinue.bind(this));
//this._commandWindow.setHandler('options', this.commandOptions.bind(this));
this._commandWindow.setHandler('quit', this.commandQuit.bind(this));
this.addWindow(this._commandWindow);
};
Scene_Title.prototype.commandQuit = function() {
SceneManager.exit();
};
Window_TitleCommand.prototype.makeCommandList = function() {
this.addCommand(TextManager.newGame, 'newGame');
this.addCommand(TextManager.continue_, 'continue', this.isContinueEnabled());
//this.addCommand(TextManager.options, 'options');
this.addCommand('退出游戏', 'quit');
};
效果:
![](http://imgsrc.baidu.com/forum/w%3D580/sign=02cbb8f8de00baa1ba2c47b37711b9b1/35d3814443a98226520a5e338582b9014b90ebf0.jpg)