Advertisement
Guest User

MenuLocation

a guest
Nov 21st, 2015
535
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. // MenuLocation.js
  2.  
  3. /*:
  4. * @plugindesc Provides a location window for your menu. Works with Yanfly Engine Plugins.
  5. * @author JGreene
  6. *
  7. * @help Place this plugin below all of Yanfly's Plugins in your load order.
  8. */
  9.  
  10. (function() {
  11.  
  12. var _Scene_Menu_new = Scene_Menu.prototype.create;
  13. Scene_Menu.prototype.create = function() {
  14. _Scene_Menu_new.call(this);
  15. this._statusWindow.x = this._commandWindow.width;
  16. this._statusWindow.y = 0;
  17. this.createLocationWindow();
  18. this._goldWindow.x = 0;
  19. this._goldWindow.width = this._commandWindow.width;
  20. this._goldWindow.y = Graphics.boxHeight - this._goldWindow.height;
  21. };
  22.  
  23. // Location window
  24.  
  25. Scene_Menu.prototype.createLocationWindow = function() {
  26. this._locationWindow = new Window_Location(0, 0);
  27. this._locationWindow.width = this._commandWindow.width;
  28. this._locationWindow.x = 0;
  29. this._locationWindow.y = Graphics.boxHeight - (this._locationWindow.height*2);
  30. this.addWindow(this._locationWindow);
  31. };
  32.  
  33. function Window_Location() {
  34. this.initialize.apply(this, arguments);
  35. }
  36.  
  37. Window_Location.prototype = Object.create(Window_Base.prototype);
  38. Window_Location.prototype.constructor = Window_Location;
  39.  
  40. Window_Location.prototype.initialize = function(x, y) {
  41. var width = this.windowWidth();
  42. var height = this.windowHeight();
  43. Window_Base.prototype.initialize.call(this, x, y, width, height);
  44. this.refresh();
  45. };
  46.  
  47. Window_Location.prototype.windowWidth = function() {
  48. return 240;
  49. };
  50.  
  51. Window_Location.prototype.windowHeight = function() {
  52. return this.fittingHeight(1);
  53. };
  54.  
  55. Window_Location.prototype.refresh = function() {
  56. var x = this.textPadding();
  57. var width = this.contents.width - this.textPadding() * 2;
  58. this.contents.clear();
  59. this.drawText(this.value(), x, 0, width);
  60. };
  61.  
  62. Window_Location.prototype.value = function() {
  63. if ($gameMap.displayName())
  64. return $gameMap.displayName();
  65. else
  66. return 'N/A';
  67. };
  68.  
  69.  
  70. Window_Location.prototype.open = function() {
  71. this.refresh();
  72. Window_Base.prototype.open.call(this);
  73. };
  74.  
  75. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement