| /*: | |
| * @target MZ | |
| * @plugindesc 文章ウィンドウが下の時にオフセットさせます。 | |
| * @author munokura | |
| * | |
| * @help | |
| * 文章ウィンドウが下の時にオフセットさせます。 | |
| * | |
| * | |
| * @param offsetPosition | |
| * @text 文章ウィンドウオフセット量 | |
| * @desc 文章ウィンドウが下の時にオフセットする量。 | |
| * 正値で下、負値で上にオフセットします。 | |
| */ | |
| (() => { | |
| "use strict"; | |
| const pluginName = document.currentScript.src.split("/").pop().replace(/\.js$/, ""); | |
| const parameters = PluginManager.parameters(pluginName); | |
| const offsetPosition = Number(parameters['offsetPosition'] || 0); | |
| const _Window_Message_updatePlacement = Window_Message.prototype.updatePlacement; | |
| Window_Message.prototype.updatePlacement = function () { | |
| this._positionType = $gameMessage.positionType(); | |
| // console.log(this._positionType); | |
| // this._positionType // 上:0 / 中:1 下:2 と上記のログで分かる | |
| // 例えば下の時だけプラグインパラメーターで指定した分オフセットさせるとすると下記 | |
| if (this._positionType === 2) { | |
| this.y = ((this._positionType * (Graphics.boxHeight - this.height)) / 2) + offsetPosition; | |
| } else { | |
| _Window_Message_updatePlacement.call(this); | |
| } | |
| }; | |
| // 元のコード rmmz_windows.js 内 | |
| // Window_Message.prototype.updatePlacement = function() { | |
| // const goldWindow = this._goldWindow; | |
| // this._positionType = $gameMessage.positionType(); | |
| // this.y = (this._positionType * (Graphics.boxHeight - this.height)) / 2; | |
| // if (goldWindow) { | |
| // goldWindow.y = this.y > 0 ? 0 : Graphics.boxHeight - goldWindow.height; | |
| // } | |
| // }; | |
| })(); |