//==============================================================================
// * WBLCenterTextYEP.js
// Scripter : Kyonides Arkanthes
// Release Date: 2023-07-03
//==============================================================================
/*:
* @plugindesc Center Text of Window_BattleLog Messages
* @author Kyonides
* @help Date: 2023-07-03
*
* @param Center Text
* @type switch
* @default 0
* @desc
*/
function WBLCenterText() {
throw new Error('This is a static class');
}
WBLCenterText.parameters = PluginManager.parameters('WBLCenterText');
WBLCenterText.switch_id = Number(WBLCenterText.parameters['Center Text']);
WBLCenterText.battlelog_draw_line_text = Window_BattleLog.prototype.drawLineText;
Window_BattleLog.prototype.drawLineText = function(index) {
let switch_on = $gameSwitches.value(WBLCenterText.switch_id);
if (switch_on) {
this.drawDirectCenterLine(index);
} else {
WBLCenterText.battlelog_draw_line_text.call(this, index);
}
};
Window_BattleLog.prototype.drawDirectCenterLine = function(index) {
let text = this._lines[index];
let rect = this.itemRectForText(index);
this.contents.clearRect(rect.x, rect.y, rect.width, rect.height);
let tw = this.textWidthEx(text);
let wx = rect.x + (rect.width - tw) / 2;
this.resetFontSettings();
this.drawTextEx(text, wx, rect.y);
};