//============================================================================= // MW_ChangeMessageText //============================================================================= /*: * @plugindesc メッセージの表示位置を変更するプラグイン * @author 銀河 * * * @param 調整サイズ * @type number * @desc 調整したいピクセル数を指定します(初期値:0) * @default 0 * @min -1000 * * @param スイッチ番号 * @type number * @desc スイッチ番号を指定します(初期値:0) * @default 0 * @min 0 */ (function() { var parameters = PluginManager.parameters('MW_ChangeMessageText'); var AdjustY = Number(parameters['調整サイズ'] || 0); var SwitchId = Number(parameters['指定したウィンドウ透明度に切り替えるスイッチ'] || 0); var _Window_Message_updatePlacement = Window_Message.prototype.updatePlacement; Window_Message.prototype.updatePlacement = function() { _Window_Message_updatePlacement.call(this); this._positionType = $gameMessage.positionType(); if(!$gameSwitches.value(7)){ this.y = this._positionType * (Graphics.boxHeight - this.height) / 2; if(this._positionType!=0){ this.y += + AdjustY; } }else if(this._positionType==1919){ this.y == 1000;//戦闘後のコモンイベントを動かす時にメッセージウィンドウ(\CE[n])を介すため、画面外に表示するようにするための調整 }else{ this.y = this._positionType * (Graphics.boxHeight - this.height) / 2; } this._goldWindow.y = this.y > 0 ? 0 : Graphics.boxHeight - this._goldWindow.height; //スキルメニュー中のテキスト位置強制調整[スイッチ11:スキルメニュー中] if($gameSwitches.value(11) && !SceneManager._scene.constructor === Scene_Equip){ this.x -=103; this.y -=44; } }; //20210721 ginga メッセージ中断から復帰時にウィンドウが中央に戻ってしまうバグを修正 //20210721 メモ nameboxの位置調整はmessagecoreの1161行目に追記した var _Message_Window_Message_newPage =Window_Message.prototype.newPage; Window_Message.prototype.newPage = function(textState) { _Message_Window_Message_newPage.call(this, textState); //立ち絵エロ中のテキスト位置強制調整[スイッチ251:立ち絵エロ中] if($gameSwitches.value(251)){ this.x -=103; this.width -=72; } }; Window_Base.prototype.processNormalCharacter = function(textState) { var c = textState.text[textState.index++]; var w = this.textWidth(c); //戦闘中とそれ以外で揃える高さが異なる。 if($gameParty.inBattle() && !$gameSwitches.value(144)){ this.contents.drawText(c, textState.x, textState.y+8, w * 2, textState.height); }else{ this.contents.drawText(c, textState.x, textState.y+3, w * 2, textState.height); } textState.x += w; }; Window_Message.prototype.setBackgroundType = function(type) { //同様の処理をmeesagecoreの1065行目に追記 if (type === 0) { if($gameSwitches.value(SwitchId) === false){ this.opacity = $gameVariables.value(158); }else{ this.opacity = $gameVariables.value(159); } } else { this.opacity = 0; } if (type === 1) { this.showBackgroundDimmer(); } else { this.hideBackgroundDimmer(); } }; Window_NumberInput.prototype.start = function() { this._maxDigits = $gameMessage.numInputMaxDigits(); this._number = $gameVariables.value($gameMessage.numInputVariableId()); this._number = this._number.clamp(0, Math.pow(10, this._maxDigits) - 1); this.updatePlacement(); this.placeButtons(); this.updateButtonsVisiblity(); this.createContents(); this.refresh(); this.open(); this.activate(); this.select(0); performNumberInputCalculation.call(this); }; Window_NumberInput.prototype.processDigitChange = function() { if (this.isOpenAndActive()) { if (Input.isRepeated('up')) { this.changeDigit(true); performNumberInputCalculation.call(this); } else if (Input.isRepeated('down')) { this.changeDigit(false); performNumberInputCalculation.call(this); } } Window_NumberInput.prototype.onButtonUp = function() { this.changeDigit(true); performNumberInputCalculation.call(this); }; Window_NumberInput.prototype.onButtonDown = function() { this.changeDigit(false); performNumberInputCalculation.call(this); }; }; })(); // 共通の計算処理を関数として外出し function performNumberInputCalculation() { if ($gameSwitches.value(228)) { if ($gameVariables.value(129) == 1) { var status = Math.floor($gameActors.actor(1).param(7) / 15); if (status > 20) { status = 20; } $gameVariables.setValue(18, status + Math.floor(5.3 * Math.pow(10, -5) * Math.pow(this._number / $gameVariables.value(17) * 100, 3) - 0.004 * Math.pow(this._number / $gameVariables.value(17) * 100, 2) - 1.13 * this._number / $gameVariables.value(17) * 100 + 110)); if ($gameVariables.value(18) >= 100) { $gameVariables.setValue(18, 100); } let mw = SceneManager._scene._messageWindow; mw.contents.clear(); mw.drawTextEx('\\V[20]', 0, 0); } else if ($gameVariables.value(129) == 2) { $gameVariables.setValue(18, $gameParty.gold() - this._number * 5); $gameVariables.setValue(19, $gameVariables.value(5) + this._number); let mw = SceneManager._scene._messageWindow; mw.contents.clear(); mw.drawTextEx('\\V[20]', 0, 0); } else if ($gameVariables.value(129) == 3) { $gameVariables.setValue(18, $gameVariables.value(122) + this._number); $gameVariables.setValue(19, $gameVariables.value(142) - this._number); let mw = SceneManager._scene._messageWindow; mw.contents.clear(); mw.drawTextEx('\\V[20]', 0, 0); } else if ($gameVariables.value(129) == 4) { $gameVariables.setValue(18, (30 - this._number)); $gameVariables.setValue(19, (30 - this._number) * 200); if (($gameSwitches.value(622) && $gameSwitches.value(887))) { $gameVariables.setValue(19, (30 - this._number) * 400); } if (($gameSwitches.value(623) && $gameSwitches.value(889))) { $gameVariables.setValue(19, (30 - this._number) * 500); } if ($gameVariables.value(18) < 10) { $gameVariables.setValue(18, " " + $gameVariables.value(18)); } let mw = SceneManager._scene._messageWindow; mw.contents.clear(); mw.drawTextEx('\\V[20]', 0, 0); } } }