//-----------------------------------------------------------------------------
// Scene_GameEnd
//
// The scene class of the game end screen.
/**
* The scene class of the game end screen.
*
* @class
* @extends Scene_MenuBase
*/
function Scene_GameEnd() {
this.initialize(...arguments);
}
Scene_GameEnd.prototype = Object.create(Scene_MenuBase.prototype);
Scene_GameEnd.prototype.constructor = Scene_GameEnd;
Scene_GameEnd.prototype.initialize = function() {
Scene_MenuBase.prototype.initialize.call(this);
};
Scene_GameEnd.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
this.createCommandWindow();
};
Scene_GameEnd.prototype.stop = function() {
Scene_MenuBase.prototype.stop.call(this);
this._commandWindow.close();
};
Scene_GameEnd.prototype.createBackground = function() {
Scene_MenuBase.prototype.createBackground.call(this);
this.setBackgroundOpacity(128);
};
/**
* Creates the command window
*/
Scene_GameEnd.prototype.createCommandWindow = function() {
const rect = this.commandWindowRect();
this._commandWindow = new Window_GameEnd(rect);
this._commandWindow.setHandler("toTitle", this.commandToTitle.bind(this));
this._commandWindow.setHandler("cancel", this.popScene.bind(this));
this.addWindow(this._commandWindow);
};
/**
* Gets the rectangle that represents the command window's x/y/width/height
*
* @return {Rectangle} The rectangle that represents the command window
*/
Scene_GameEnd.prototype.commandWindowRect = function() {
const ww = this.mainCommandWidth();
const wh = this.calcWindowHeight(2, true);
const wx = (Graphics.boxWidth - ww) / 2;
const wy = (Graphics.boxHeight - wh) / 2;
return new Rectangle(wx, wy, ww, wh);
};
/**
* Handling when the To Title command is selected
*/
Scene_GameEnd.prototype.commandToTitle = function() {
this.fadeOutAll();
SceneManager.goto(Scene_Title);
Window_TitleCommand.initCommandPosition();
};