Zarsla

WindowCode

Nov 24th, 2019
98
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var Ossra = Ossra || {};
  2.  
  3. function Window_HelpRedux() {
  4. this.initialize.apply(this, arguments);
  5. }
  6.  
  7. Window_HelpRedux.prototype = Object.create(Window_Help.prototype);
  8. Window_HelpRedux.prototype.constructor = Window_HelpRedux;
  9.  
  10. Window_HelpRedux.prototype.initialize = function(numLines) {
  11. var width = this.width();
  12. this.setHeight(this.fittingHeight(numLines || 2));
  13. var height = this.height;
  14. Window_Base.prototype.initialize.call(this, 0, 0, width, height);
  15. this._text = '';
  16. };
  17.  
  18. Window_HelpRedux.prototype.width = function() {
  19. if(this._width === null || this._width === undefined){
  20. this._width = 300;
  21. }
  22. return this._width;
  23. };
  24.  
  25. Window_HelpRedux.prototype.setWidth = function(value) {
  26. this._width = value;
  27. };
  28.  
  29. Window_HelpRedux.prototype.height = function() {
  30. if(this._height === null || this._height === undefined){
  31. this._height = this.fittingHeight(2);
  32. }
  33. return this._height;
  34. };
  35.  
  36. Window_HelpRedux.prototype.setHeight = function(vakue) {
  37. this._height = value;
  38. };
  39.  
  40. Window_HelpRedux.prototype.setText = function(text) {
  41. if (this._text !== text) {
  42. this._text = text;
  43. this.refresh();
  44. }
  45. };
  46.  
  47. Window_HelpRedux.prototype.clear = function() {
  48. this.setText('');
  49. };
  50.  
  51. Window_HelpRedux.prototype.setItem = function(item) {
  52. this.setText(item ? item.description : '');
  53. };
  54.  
  55. Window_HelpRedux.prototype.refresh = function() {
  56. this.contents.clear();
  57. this.drawTextEx(this._text, this.textPadding(), 0);
  58. };
  59.  
  60. Ossra.Window_EventItem_updatePlacement = Window_EventItem.prototype.updatePlacement;
  61.  
  62. Window_EventItem.prototype.updatePlacement = function() {
  63. Ossra.Window_EventItem_updatePlacement.call(this);
  64.  
  65. if (this._helpWindow) {
  66. this._helpWindow.y = this.y;
  67. this.y = this._helpWindow.y + this._helpWindow.height;
  68. }
  69. };
  70.  
  71. Window_EventItem.prototype.setHelpWindow = function(helpWindow) {
  72. Window_ItemList.prototype.setHelpWindow.call(this, helpWindow);
  73. if (this._helpWindow) {
  74. this._helpWindow.hide();
  75. this._helpWindow.close();
  76. }
  77. };
  78.  
  79. Window_EventItem.prototype.open = function() {
  80. Window_ItemList.prototype.open.call(this);
  81. if (this._helpWindow) {
  82. this._helpWindow.show();
  83. this._helpWindow.open();
  84. }
  85. };
  86.  
  87. Window_EventItem.prototype.close = function() {
  88. Window_ItemList.prototype.close.call(this);
  89. if (this._helpWindow) {
  90. this._helpWindow.hide();
  91. this._helpWindow.close();
  92. }
  93. };
  94.  
  95. Ossra.Window_Message_subWindows = Window_Message.prototype.subWindows;
  96.  
  97. Window_Message.prototype.subWindows = function() {
  98. var tmpWindows = Ossra.Window_Message_subWindows.call(this);
  99. tmpWindows.push(this._helpWindow)
  100. return tmpWindows;
  101. };
  102.  
  103. Ossra.Window_Message_createSubWindows = Window_Message.prototype.createSubWindows;
  104.  
  105. Window_Message.prototype.createSubWindows = function() {
  106. Ossra.Window_Message_createSubWindows.call(this);
  107.  
  108. this._helpWindow = new Window_HelpRedux();
  109. this._itemWindow.setHelpWindow(this._helpWindow);
  110. };
RAW Paste Data