//-----------------------------------------------------------------------------
// Window_Gold
//
// The window for displaying the party's gold.
/**
* The window for displaying the party's gold.
*
* @class
* @extends Window_Selectable
*/
function Window_Gold() {
this.initialize(...arguments);
}
Window_Gold.prototype = Object.create(Window_Selectable.prototype);
Window_Gold.prototype.constructor = Window_Gold;
Window_Gold.prototype.initialize = function(rect) {
Window_Selectable.prototype.initialize.call(this, rect);
this.refresh();
};
/**
* Get spacing between columns in the window
*
* @return {number} The spacing between columns
*/
Window_Gold.prototype.colSpacing = function() {
return 0;
};
/**
* Refresh the window
*/
Window_Gold.prototype.refresh = function() {
const rect = this.itemLineRect(0);
const x = rect.x;
const y = rect.y;
const width = rect.width;
this.contents.clear();
this.drawCurrencyValue(this.value(), this.currencyUnit(), x, y, width);
};
/**
* Get the value to draw in the window (amount of gold the party has)
*
* @return {number} The amount of gold the party has
*/
Window_Gold.prototype.value = function() {
return $gameParty.gold();
};
/**
* Get the currency unit
*
* @return {string} The currency unit
*/
Window_Gold.prototype.currencyUnit = function() {
return TextManager.currencyUnit;
};
Window_Gold.prototype.open = function() {
this.refresh();
Window_Selectable.prototype.open.call(this);
};