Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // MenuLocation.js
- /*:
- * @plugindesc Provides a location window for your menu. Works with Yanfly Engine Plugins.
- * @author JGreene
- *
- * @help Place this plugin below all of Yanfly's Plugins in your load order.
- */
- (function() {
- var _Scene_Menu_new = Scene_Menu.prototype.create;
- Scene_Menu.prototype.create = function() {
- _Scene_Menu_new.call(this);
- this._statusWindow.x = this._commandWindow.width;
- this._statusWindow.y = 0;
- this.createLocationWindow();
- this._goldWindow.x = 0;
- this._goldWindow.width = this._commandWindow.width;
- this._goldWindow.y = Graphics.boxHeight - this._goldWindow.height;
- };
- // Location window
- Scene_Menu.prototype.createLocationWindow = function() {
- this._locationWindow = new Window_Location(0, 0);
- this._locationWindow.width = this._commandWindow.width;
- this._locationWindow.x = 0;
- this._locationWindow.y = Graphics.boxHeight - (this._locationWindow.height*2);
- this.addWindow(this._locationWindow);
- };
- function Window_Location() {
- this.initialize.apply(this, arguments);
- }
- Window_Location.prototype = Object.create(Window_Base.prototype);
- Window_Location.prototype.constructor = Window_Location;
- Window_Location.prototype.initialize = function(x, y) {
- var width = this.windowWidth();
- var height = this.windowHeight();
- Window_Base.prototype.initialize.call(this, x, y, width, height);
- this.refresh();
- };
- Window_Location.prototype.windowWidth = function() {
- return 240;
- };
- Window_Location.prototype.windowHeight = function() {
- return this.fittingHeight(1);
- };
- Window_Location.prototype.refresh = function() {
- var x = this.textPadding();
- var width = this.contents.width - this.textPadding() * 2;
- this.contents.clear();
- this.drawText(this.value(), x, 0, width);
- };
- Window_Location.prototype.value = function() {
- if ($gameMap.displayName())
- return $gameMap.displayName();
- else
- return 'N/A';
- };
- Window_Location.prototype.open = function() {
- this.refresh();
- Window_Base.prototype.open.call(this);
- };
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement