//-----------------------------------------------------------------------------
// Scene_Options
//
// The scene class of the options screen.
/**
* The scene class of the options screen.
*
* @class
* @extends Scene_MenuBase
*/
function Scene_Options() {
this.initialize(...arguments);
}
Scene_Options.prototype = Object.create(Scene_MenuBase.prototype);
Scene_Options.prototype.constructor = Scene_Options;
Scene_Options.prototype.initialize = function() {
Scene_MenuBase.prototype.initialize.call(this);
};
Scene_Options.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
this.createOptionsWindow();
};
Scene_Options.prototype.terminate = function() {
Scene_MenuBase.prototype.terminate.call(this);
ConfigManager.save();
};
/**
* Creates the Options window
*/
Scene_Options.prototype.createOptionsWindow = function() {
const rect = this.optionsWindowRect();
this._optionsWindow = new Window_Options(rect);
this._optionsWindow.setHandler("cancel", this.popScene.bind(this));
this.addWindow(this._optionsWindow);
};
/**
* Gets the rectangle that represents the options window's x/y/width/height
*
* @return {Rectangle} The rectangle that represents the options window
*/
Scene_Options.prototype.optionsWindowRect = function() {
const n = Math.min(this.maxCommands(), this.maxVisibleCommands());
const ww = 400;
const wh = this.calcWindowHeight(n, true);
const wx = (Graphics.boxWidth - ww) / 2;
const wy = (Graphics.boxHeight - wh) / 2;
return new Rectangle(wx, wy, ww, wh);
};
/**
* Gets the number of options that exist
*
* @return {number} Number of options that exist
*/
Scene_Options.prototype.maxCommands = function() {
// Increase this value when adding option items.
return 7;
};
/**
* Gets the number of visible options to display
*
* @return {number} Maximum number of options to display
*/
Scene_Options.prototype.maxVisibleCommands = function() {
return 12;
};