774 lines
No EOL
29 KiB
JavaScript
774 lines
No EOL
29 KiB
JavaScript
//=============================================================================
|
||
// One-Actor Menu Version 1.19 (Final Version) - Modified Ver.14 for user
|
||
//=============================================================================
|
||
/*:
|
||
* @target MZ
|
||
* @plugindesc 一人用アクターのメニュー画面です。このプラグインは、プレイアブルアクターが1人の場合のみを想定しています。
|
||
* @author Ventiqu - 2017 (transplanted for RMMZ with GrayOgre 2021), Modified by user request
|
||
*
|
||
* @param Position Settings
|
||
* @text ■全体位置設定
|
||
*
|
||
* @param Status_Window_X
|
||
* @parent Position Settings
|
||
* @text ステータスウィンドウ X座標
|
||
* @desc ステータスウィンドウ全体のX座標です。
|
||
* @type number
|
||
* @default 0
|
||
*
|
||
* @param Status_Window_Y
|
||
* @parent Position Settings
|
||
* @text ステータスウィンドウ Y座標
|
||
* @desc ステータスウィンドウ全体のY座標です。
|
||
* @type number
|
||
* @default 50
|
||
*
|
||
* @param Font Settings
|
||
* @text ■フォント設定
|
||
*
|
||
* @param Status_Font_Size
|
||
* @parent Font Settings
|
||
* @text ステータスのフォントサイズ
|
||
* @desc メニューのステータスウィンドウに表示される文字のサイズです。デフォルト: 26
|
||
* @type number
|
||
* @default 26
|
||
*
|
||
* @param Layout Settings
|
||
* @text ■レイアウト設定
|
||
*
|
||
* @param Status_Window_Width
|
||
* @parent Layout Settings
|
||
* @text ステータスウィンドウ全体の幅
|
||
* @desc ステータスウィンドウ全体の幅を設定します。
|
||
* @type number
|
||
* @default 440
|
||
*
|
||
* @param Status_Column2_Width
|
||
* @parent Layout Settings
|
||
* @text ステータス右列の幅
|
||
* @desc 「攻撃力」などを表示する右側エリアの幅です。
|
||
* @type number
|
||
* @default 200
|
||
*
|
||
* @param Status_Value_Width
|
||
* @parent Layout Settings
|
||
* @text 数値の表示幅
|
||
* @desc ステータス右列の「数値」部分の表示幅です。右揃えの基準になります。
|
||
* @type number
|
||
* @default 50
|
||
*
|
||
* @param Status_Unit_Padding
|
||
* @parent Layout Settings
|
||
* @text 数値と単位の間隔
|
||
* @desc 数値と単位の間のスペース(ピクセル数)です。
|
||
* @type number
|
||
* @default 4
|
||
*
|
||
* @param Status_Unit_Width
|
||
* @parent Layout Settings
|
||
* @text 単位の表示幅
|
||
* @desc ステータス右列の「単位」部分の表示幅です。(%, expなど)
|
||
* @type number
|
||
* @default 40
|
||
*
|
||
* @param Padding Settings
|
||
* @text ■パディング設定 (ウィンドウ内部の余白)
|
||
*
|
||
* @param Padding_Top
|
||
* @parent Padding Settings
|
||
* @text 上部の余白
|
||
* @desc ウィンドウ上端とコンテンツの間の余白です。
|
||
* @type number
|
||
* @default 12
|
||
*
|
||
* @param Padding_Bottom
|
||
* @parent Padding Settings
|
||
* @text 下部の余白
|
||
* @desc ウィンドウ下端とコンテンツの間の余白です。
|
||
* @type number
|
||
* @default 12
|
||
*
|
||
* @param Padding_Left
|
||
* @parent Padding Settings
|
||
* @text 左側の余白
|
||
* @desc ウィンドウ左端とコンテンツの間の余白です。
|
||
* @type number
|
||
* @default 12
|
||
*
|
||
* @param Padding_Right
|
||
* @parent Padding Settings
|
||
* @text 右側の余白
|
||
* @desc ウィンドウ右端とコンテンツの間の余白です。
|
||
* @type number
|
||
* @default 12
|
||
*
|
||
* @param Color Settings
|
||
* @text ■カラー設定
|
||
*
|
||
* @param Normal Text Color
|
||
* @parent Color Settings
|
||
* @text 標準の文字色
|
||
* @desc ステータスウィンドウの標準テキストの色です。CSSカラーコードで指定します。
|
||
* @type string
|
||
* @default #ffffff
|
||
*
|
||
* @param Gauge Background Color
|
||
* @parent Color Settings
|
||
* @text ゲージの背景色
|
||
* @desc ゲージの背景色です。書式: R, G, B (例: 50, 50, 50)
|
||
* @type string
|
||
* @default 50, 50, 50
|
||
*
|
||
* @param HP Gauge Color 1
|
||
* @parent Color Settings
|
||
* @text HPゲージ色1 (グラデーション開始)
|
||
* @desc HPゲージのグラデーション開始色です。書式: R, G, B
|
||
* @type string
|
||
* @default 255, 90, 90
|
||
*
|
||
* @param HP Gauge Color 2
|
||
* @parent Color Settings
|
||
* @text HPゲージ色2 (グラデーション終了)
|
||
* @desc HPゲージのグラデーション終了色です。書式: R, G, B
|
||
* @type string
|
||
* @default 220, 40, 40
|
||
*
|
||
* @param MP Gauge Color 1
|
||
* @parent Color Settings
|
||
* @text MPゲージ色1 (グラデーション開始)
|
||
* @desc MPゲージのグラデーション開始色です。書式: R, G, B
|
||
* @type string
|
||
* @default 90, 180, 255
|
||
*
|
||
* @param MP Gauge Color 2
|
||
* @parent Color Settings
|
||
* @text MPゲージ色2 (グラデーション終了)
|
||
* @desc MPゲージのグラデーション終了色です。書式: R, G, B
|
||
* @type string
|
||
* @default 40, 120, 220
|
||
*
|
||
* @param TP Gauge Color 1
|
||
* @parent Color Settings
|
||
* @text TPゲージ色1 (グラデーション開始)
|
||
* @desc TPゲージのグラデーション開始色です。書式: R, G, B
|
||
* @type string
|
||
* @default 100, 220, 100
|
||
*
|
||
* @param TP Gauge Color 2
|
||
* @parent Color Settings
|
||
* @text TPゲージ色2 (グラデーション終了)
|
||
* @desc TPゲージのグラデーション終了色です。書式: R, G, B
|
||
* @type string
|
||
* @default 60, 180, 60
|
||
*
|
||
* @param DText Settings
|
||
* @text ■追加DText設定
|
||
*
|
||
* @param enableExtraDText
|
||
* @parent DText Settings
|
||
* @text 追加DTextを有効化
|
||
* @desc trueにすると、以下で設定した変数をDTextPictureでメニューに表示します。
|
||
* @type boolean
|
||
* @default true
|
||
*
|
||
* @param extraDText1
|
||
* @parent DText Settings
|
||
* @text 追加DText 1設定
|
||
* @type struct<ExtraDText>
|
||
* @default {"variableId":"70","pictureId":"60","x":"100","y":"400","fontSize":"24","format":"変数70: %1","width":"200","align":"left"}
|
||
*
|
||
* @param extraDText2
|
||
* @parent DText Settings
|
||
* @text 追加DText 2設定
|
||
* @type struct<ExtraDText>
|
||
* @default {"variableId":"71","pictureId":"61","x":"100","y":"430","fontSize":"24","format":"変数71: %1","width":"200","align":"left"}
|
||
*
|
||
* @param extraDText3
|
||
* @parent DText Settings
|
||
* @text 追加DText 3設定
|
||
* @type struct<ExtraDText>
|
||
* @default {"variableId":"72","pictureId":"62","x":"100","y":"460","fontSize":"24","format":"変数72: %1","width":"200","align":"left"}
|
||
*
|
||
* @param extraDText4
|
||
* @parent DText Settings
|
||
* @text 追加DText 4設定
|
||
* @type struct<ExtraDText>
|
||
* @default {"variableId":"73","pictureId":"63","x":"400","y":"400","fontSize":"24","format":"変数73: %1","width":"200","align":"right"}
|
||
*
|
||
* @param extraDText5
|
||
* @parent DText Settings
|
||
* @text 追加DText 5設定
|
||
* @type struct<ExtraDText>
|
||
* @default {"variableId":"74","pictureId":"64","x":"400","y":"430","fontSize":"24","format":"変数74: %1","width":"200","align":"right"}
|
||
*
|
||
* @param extraDText6
|
||
* @parent DText Settings
|
||
* @text 追加DText 6設定
|
||
* @type struct<ExtraDText>
|
||
* @default {"variableId":"75","pictureId":"65","x":"400","y":"460","fontSize":"24","format":"変数75: %1","width":"200","align":"right"}
|
||
*
|
||
* @param extraDText7
|
||
* @parent DText Settings
|
||
* @text 追加DText 7設定
|
||
* @type struct<ExtraDText>
|
||
* @default {"variableId":"0","pictureId":"66","x":"100","y":"500","fontSize":"24","format":"変数: %1","width":"200","align":"left"}
|
||
*
|
||
* @param extraDText8
|
||
* @parent DText Settings
|
||
* @text 追加DText 8設定
|
||
* @type struct<ExtraDText>
|
||
* @default {"variableId":"0","pictureId":"67","x":"400","y":"500","fontSize":"24","format":"変数: %1","width":"200","align":"left"}
|
||
*
|
||
* @help
|
||
* このプラグインは、メニュー画面を一人旅用に変更します。
|
||
* データベースの「システム1」にあるメニューコマンドから「隊列」を
|
||
* 必ず非表示にしてください。
|
||
*
|
||
* --- 更新履歴 ---
|
||
* 1.19+mod14 - 追加DTextの表示数を8に増加
|
||
* 1.19+mod13 - 追加DTextに横幅と揃えのカスタム機能を追加
|
||
* 1.19+mod12 - DTextPicture連携機能を追加。変数70-75をメニューに表示できるよう拡張
|
||
* (以下略)
|
||
*/
|
||
/*~struct~ExtraDText:
|
||
* @param variableId
|
||
* @text 表示する変数番号
|
||
* @desc メニュー画面に表示する変数の番号です。0を指定すると無効になります。
|
||
* @type variable
|
||
* @default 0
|
||
*
|
||
* @param pictureId
|
||
* @text ピクチャ番号
|
||
* @desc DTextPictureで使用するピクチャ番号です。他のピクチャと重複しないようにしてください。
|
||
* @type number
|
||
* @min 1
|
||
* @default 60
|
||
*
|
||
* @param x
|
||
* @text X座標
|
||
* @desc テキストを表示するX座標です。
|
||
* @type number
|
||
* @default 100
|
||
*
|
||
* @param y
|
||
* @text Y座標
|
||
* @desc テキストを表示するY座標です。
|
||
* @type number
|
||
* @default 400
|
||
*
|
||
* @param fontSize
|
||
* @text フォントサイズ
|
||
* @desc テキストのフォントサイズです。
|
||
* @type number
|
||
* @default 24
|
||
*
|
||
* @param format
|
||
* @text 表示フォーマット
|
||
* @desc 表示するテキストの書式です。「%1」が変数の値に置き換えられます。(例: RP: %1)
|
||
* @type string
|
||
* @default "%1"
|
||
*
|
||
* @param width
|
||
* @text 横幅
|
||
* @desc テキストを描画するエリアの横幅(ピクセル)。中央・右揃えにはこの設定が必須です。
|
||
* @type number
|
||
* @default 0
|
||
*
|
||
* @param align
|
||
* @text 横揃え
|
||
* @desc テキストの横揃えです。右揃えなどには対応する「横幅」の設定が必須です。
|
||
* @type select
|
||
* @option 左揃え
|
||
* @value left
|
||
* @option 中央揃え
|
||
* @value center
|
||
* @option 右揃え
|
||
* @value right
|
||
* @default left
|
||
*/
|
||
|
||
(function() {
|
||
'use strict';
|
||
|
||
const pluginName = 'VE_Single_Actor_MZ';
|
||
const parameters = PluginManager.parameters(pluginName);
|
||
// Position
|
||
const statusWindowX = Number(parameters['Status_Window_X'] || 0);
|
||
const statusWindowY = Number(parameters['Status_Window_Y'] || 50);
|
||
// Font
|
||
const statusFontSize = Number(parameters['Status_Font_Size'] || 26);
|
||
// Layout
|
||
const statusWindowWidth = Number(parameters['Status_Window_Width'] || 440);
|
||
const statusCol2Width = Number(parameters['Status_Column2_Width'] || 200);
|
||
const statusValueWidth = Number(parameters['Status_Value_Width'] || 50);
|
||
const statusUnitPadding = Number(parameters['Status_Unit_Padding'] || 4);
|
||
const statusUnitWidth = Number(parameters['Status_Unit_Width'] || 40);
|
||
// Padding
|
||
const paddingTop = Number(parameters['Padding_Top'] || 12);
|
||
const paddingBottom = Number(parameters['Padding_Bottom'] || 12);
|
||
const paddingLeft = Number(parameters['Padding_Left'] || 12);
|
||
const paddingRight = Number(parameters['Padding_Right'] || 12);
|
||
// Color
|
||
const normalTextColor = String(parameters['Normal Text Color'] || '#ffffff');
|
||
const gaugeBackColor = `rgb(${String(parameters['Gauge Background Color'] || '50, 50, 50')})`;
|
||
const hpColor1 = `rgb(${String(parameters['HP Gauge Color 1'] || '255, 90, 90')})`;
|
||
const hpColor2 = `rgb(${String(parameters['HP Gauge Color 2'] || '220, 40, 40')})`;
|
||
const mpColor1 = `rgb(${String(parameters['MP Gauge Color 1'] || '90, 180, 255')})`;
|
||
const mpColor2 = `rgb(${String(parameters['MP Gauge Color 2'] || '40, 120, 220')})`;
|
||
const tpColor1 = `rgb(${String(parameters['TP Gauge Color 1'] || '100, 220, 100')})`;
|
||
const tpColor2 = `rgb(${String(parameters['TP Gauge Color 2'] || '60, 180, 60')})`;
|
||
|
||
// [追加] DTextPicture連携用のパラメータをパース
|
||
const enableExtraDText = parameters['enableExtraDText'] === 'true';
|
||
const extraDTextParams = [];
|
||
// [更新] ループの上限を8に増やす
|
||
for (let i = 1; i <= 8; i++) {
|
||
const param = parameters['extraDText' + i];
|
||
if (param) {
|
||
extraDTextParams.push(JSON.parse(param));
|
||
}
|
||
}
|
||
|
||
// [改変箇所] メニュー生成処理
|
||
const _Scene_Menu_create_original = Scene_Menu.prototype.create;
|
||
Scene_Menu.prototype.create = function() {
|
||
_Scene_Menu_create_original.call(this);
|
||
|
||
if (this._goldWindow) {
|
||
this._goldWindow.visible = false;
|
||
}
|
||
|
||
this._commandWindow.frameVisible = false;
|
||
this._commandWindow.opacity = 0;
|
||
this._commandWindow.backOpacity = 0;
|
||
this._statusWindow.frameVisible = false;
|
||
this._statusWindow.opacity = 0;
|
||
this._statusWindow.backOpacity = 0;
|
||
|
||
const rect = this.expAndGoldWindowRect();
|
||
this._expAndGoldWindow = new Window_ExpAndGold(rect);
|
||
this.addWindow(this._expAndGoldWindow);
|
||
|
||
if (this._backgroundSprite) {
|
||
this.removeChild(this._backgroundSprite);
|
||
}
|
||
|
||
const v5 = $gameVariables.value(5);
|
||
const v7 = $gameVariables.value(7);
|
||
const v8 = $gameVariables.value(8);
|
||
let filename;
|
||
|
||
if ($gameSwitches.value(110)) {
|
||
if (v5 >= v8) {
|
||
filename = "EroStatus_3";
|
||
} else if (v5 >= v7) {
|
||
filename = "EroStatus_2";
|
||
} else {
|
||
filename = "EroStatus_1";
|
||
}
|
||
} else {
|
||
if (v5 >= v8) {
|
||
filename = "EroStatus_6";
|
||
} else if (v5 >= v7) {
|
||
filename = "EroStatus_5";
|
||
} else {
|
||
filename = "EroStatus_4";
|
||
}
|
||
}
|
||
|
||
this._variableImageSprite = new Sprite();
|
||
this._variableImageSprite.bitmap = ImageManager.loadBitmap("img/pictures/Hstatue/", filename);
|
||
this.addChildAt(this._variableImageSprite, this.children.indexOf(this._windowLayer));
|
||
|
||
$gameScreen.setDTextPicture("\\c[0]\\v[5]\\c[0]", 80);
|
||
const pictureId = 55;
|
||
//念のためピクチャオブジェクトを初期化
|
||
if (!$gameScreen.picture(pictureId)) {
|
||
$gameScreen._pictures[pictureId] = new Game_Picture();
|
||
}
|
||
$gameScreen.picture(pictureId).show("", 1, 376, 345, 100, 100, 255, 0);
|
||
this._variableTextSprite = new Sprite_Picture(pictureId);
|
||
this.addChild(this._variableTextSprite);
|
||
|
||
// [追加] DTextPicture連携機能
|
||
this.createExtraDTextPictures();
|
||
};
|
||
|
||
// DTextPicture連携機能の本体 (揃えと横幅に対応)
|
||
Scene_Menu.prototype.createExtraDTextPictures = function() {
|
||
this._extraDTextSprites = [];
|
||
if (!enableExtraDText || typeof $gameScreen.setDTextPicture !== "function") {
|
||
return;
|
||
}
|
||
// DTextPictureの設定を一度リセット
|
||
$gameScreen.clearDtextSetting();
|
||
|
||
extraDTextParams.forEach(param => {
|
||
const varId = Number(param.variableId);
|
||
const picId = Number(param.pictureId);
|
||
if (!varId || !picId) return;
|
||
|
||
const x = Number(param.x);
|
||
const y = Number(param.y);
|
||
const fontSize = Number(param.fontSize);
|
||
const format = String(param.format || "%1");
|
||
const text = format.replace("%1", `\\v[${varId}]`);
|
||
const width = Number(param.width || 0);
|
||
const align = String(param.align || 'left');
|
||
|
||
const settings = {
|
||
align: align,
|
||
pictureWidth: width
|
||
};
|
||
$gameScreen.setDtextSetting(settings);
|
||
|
||
$gameScreen.setDTextPicture(text, fontSize);
|
||
|
||
if (!$gameScreen.picture(picId)) {
|
||
$gameScreen._pictures[picId] = new Game_Picture();
|
||
}
|
||
$gameScreen.picture(picId).show("", 0, x, y, 100, 100, 255, 0);
|
||
|
||
const sprite = new Sprite_Picture(picId);
|
||
this._extraDTextSprites.push(sprite);
|
||
this.addChild(sprite);
|
||
});
|
||
|
||
// DTextPictureの設定を再度リセット
|
||
$gameScreen.clearDtextSetting();
|
||
};
|
||
|
||
|
||
Scene_Menu.prototype.expAndGoldWindowRect = function() {
|
||
const wh = this.calcWindowHeight(1, true);
|
||
const ww = Graphics.boxWidth;
|
||
const wx = 0;
|
||
const wy = Graphics.boxHeight - wh;
|
||
return new Rectangle(wx, wy, ww, wh);
|
||
};
|
||
|
||
Scene_Menu.prototype.createCommandWindow = function() {
|
||
const rect = this.commandWindowRect();
|
||
this._commandWindow = new Window_MenuCommand(rect);
|
||
this._commandWindow.setHandler('item', this.commandItem.bind(this));
|
||
this._commandWindow.setHandler('skill', this.commandPersonal.bind(this));
|
||
this._commandWindow.setHandler('equip', this.commandPersonal.bind(this));
|
||
this._commandWindow.setHandler('status', this.commandPersonal.bind(this));
|
||
this._commandWindow.setHandler('formation', this.commandFormation.bind(this));
|
||
this._commandWindow.setHandler('options', this.commandOptions.bind(this));
|
||
this._commandWindow.setHandler('save', this.commandSave.bind(this));
|
||
this._commandWindow.setHandler('gameEnd', this.commandGameEnd.bind(this));
|
||
this._commandWindow.setHandler('cancel', this.popScene.bind(this));
|
||
this.addWindow(this._commandWindow);
|
||
};
|
||
|
||
Scene_Menu.prototype.commandWindowRect = function() {
|
||
const ww = this.mainCommandWidth();
|
||
const wh = this.calcWindowHeight(8, true);
|
||
const wx = 0;
|
||
const wy = 215;
|
||
return new Rectangle(wx, wy, ww, wh);
|
||
};
|
||
|
||
Scene_Menu.prototype.commandPersonal = function() {
|
||
this._statusWindow.setFormationMode(false);
|
||
switch (this._commandWindow.currentSymbol()) {
|
||
case 'skill':
|
||
SceneManager.push(Scene_Skill);
|
||
break;
|
||
case 'equip':
|
||
SceneManager.push(Scene_Equip);
|
||
break;
|
||
case 'status':
|
||
SceneManager.push(Scene_Status);
|
||
break;
|
||
}
|
||
};
|
||
|
||
Scene_Menu.prototype.onPersonalOk = function() {
|
||
};
|
||
|
||
Scene_Menu.prototype.statusWindowRect = function() {
|
||
const ww = statusWindowWidth;
|
||
const wh = this.calcWindowHeight(4, false) + paddingTop + paddingBottom;
|
||
const wx = statusWindowX;
|
||
const wy = statusWindowY;
|
||
return new Rectangle(wx, wy, ww, wh);
|
||
};
|
||
|
||
Window_MenuCommand.prototype.numVisibleRows = function() {
|
||
return 7;
|
||
};
|
||
|
||
Window_MenuStatus.prototype.maxCols = function() {
|
||
return 1;
|
||
};
|
||
|
||
Window_MenuStatus.prototype.numVisibleRows = function() {
|
||
return 1;
|
||
};
|
||
|
||
Window_MenuStatus.prototype.resetFontSettings = function() {
|
||
Window_Base.prototype.resetFontSettings.call(this);
|
||
this.contents.fontSize = statusFontSize;
|
||
};
|
||
|
||
|
||
Window_MenuStatus.prototype.drawItemImage = function(index) {
|
||
};
|
||
|
||
Window_MenuStatus.prototype.drawActorTp = function(actor, x, y, width) {
|
||
width = width || 186;
|
||
const color1 = tpColor1;
|
||
const color2 = tpColor2;
|
||
this.drawGauge(x, y, width, actor.tpRate(), color1, color2);
|
||
this.changeTextColor(normalTextColor);
|
||
this.drawText(TextManager.tpA, x, y, 44);
|
||
this.drawText(actor.tp, x + width - 64, y, 64, "right");
|
||
};
|
||
|
||
Window_MenuStatus.prototype.drawItemStatus = function(index) {
|
||
const actor = $gameParty.members()[index];
|
||
const rect = this.itemRectForText(index);
|
||
const x = rect.x + paddingLeft;
|
||
const y = rect.y + paddingTop;
|
||
const lineHeight = this.lineHeight();
|
||
|
||
const gaugeWidth = 186;
|
||
this.drawActorHp(actor, x, y + lineHeight * 0, gaugeWidth);
|
||
this.drawActorMp(actor, x, y + lineHeight * 1, gaugeWidth);
|
||
this.drawActorTp(actor, x, y + lineHeight * 2, gaugeWidth);
|
||
this.drawActorIcons(actor, x, y + lineHeight * 3, gaugeWidth);
|
||
|
||
const col2X = x + gaugeWidth + 24;
|
||
const labelWidth = 110;
|
||
|
||
const valueX = col2X + statusCol2Width - statusUnitWidth - statusValueWidth - statusUnitPadding;
|
||
const unitX = valueX + statusValueWidth + statusUnitPadding;
|
||
|
||
this.changeTextColor(normalTextColor);
|
||
|
||
this.drawText(TextManager.param(2), col2X, y + lineHeight * 0, labelWidth);
|
||
this.drawText(actor.atk, valueX, y + lineHeight * 0, statusValueWidth, 'right');
|
||
|
||
this.drawText(TextManager.param(3), col2X, y + lineHeight * 1, labelWidth);
|
||
this.drawText(actor.def, valueX, y + lineHeight * 1, statusValueWidth, 'right');
|
||
|
||
this.drawText("会心率", col2X, y + lineHeight * 2, labelWidth);
|
||
const finalCri = actor.cri + (actor.luk / 10 / 100);
|
||
this.drawText(Math.floor(finalCri * 100), valueX, y + lineHeight * 2, statusValueWidth, 'right');
|
||
this.drawText("%", unitX, y + lineHeight * 2, statusUnitWidth, 'left');
|
||
|
||
this.drawText("", col2X, y + lineHeight * 3, labelWidth + 20);
|
||
};
|
||
|
||
Window_Selectable.prototype.itemRectForText = function(index) {
|
||
const rect = this.itemRect(index);
|
||
rect.x += this.textPadding();
|
||
rect.width -= this.textPadding() * 2;
|
||
return rect;
|
||
};
|
||
|
||
Window_MenuStatus.prototype.textPadding = function() {
|
||
return 6;
|
||
};
|
||
|
||
Window_MenuStatus.prototype.drawActorHp = function(actor, x, y, width) {
|
||
width = width || 186;
|
||
const color1 = hpColor1;
|
||
const color2 = hpColor2;
|
||
this.drawGauge(x, y, width, actor.hpRate(), color1, color2);
|
||
this.changeTextColor(normalTextColor);
|
||
this.drawText(TextManager.hpA, x, y, 44);
|
||
this.drawCurrentAndMax(actor.hp, actor.mhp, x, y, width,
|
||
normalTextColor, normalTextColor);
|
||
};
|
||
|
||
Window_MenuStatus.prototype.drawGauge = function(x, y, width, rate, color1, color2) {
|
||
const fillW = Math.floor(width * rate);
|
||
const gaugeY = y + this.lineHeight() - 8;
|
||
this.contents.fillRect(x, gaugeY, width, 6, gaugeBackColor);
|
||
this.contents.gradientFillRect(x, gaugeY, fillW, 6, color1, color2);
|
||
};
|
||
|
||
Window_MenuStatus.prototype.drawCurrentAndMax = function(current, max, x, y, width, color1, color2) {
|
||
const labelWidth = this.textWidth('HP');
|
||
const valueWidth = this.textWidth('0000');
|
||
const slashWidth = this.textWidth('/');
|
||
const x1 = x + width - valueWidth;
|
||
const x2 = x1 - slashWidth;
|
||
const x3 = x2 - valueWidth;
|
||
|
||
this.changeTextColor(color1);
|
||
|
||
if (x3 >= x + labelWidth) {
|
||
this.drawText(current, x3, y, valueWidth, 'right');
|
||
this.drawText('/', x2, y, slashWidth, 'right');
|
||
this.drawText(max, x1, y, valueWidth, 'right');
|
||
} else {
|
||
this.drawText(current, x1, y, valueWidth, 'right');
|
||
}
|
||
};
|
||
|
||
Window_MenuStatus.prototype.drawActorMp = function(actor, x, y, width) {
|
||
width = width || 186;
|
||
const color1 = mpColor1;
|
||
const color2 = mpColor2;
|
||
this.drawGauge(x, y, width, actor.mpRate(), color1, color2);
|
||
this.changeTextColor(normalTextColor);
|
||
this.drawText(TextManager.mpA, x, y, 44);
|
||
this.drawCurrentAndMax(actor.mp, actor.mmp, x, y, width, normalTextColor, normalTextColor);
|
||
};
|
||
|
||
const _Scene_Menu_terminate = Scene_Menu.prototype.terminate;
|
||
Scene_Menu.prototype.terminate = function() {
|
||
_Scene_Menu_terminate.call(this);
|
||
if (this._variableImageSprite) {
|
||
this.removeChild(this._variableImageSprite);
|
||
this._variableImageSprite = null;
|
||
}
|
||
if (this._variableTextSprite) {
|
||
this.removeChild(this._variableTextSprite);
|
||
this._variableTextSprite = null;
|
||
}
|
||
if (this._expAndGoldWindow) {
|
||
this.removeChild(this._expAndGoldWindow);
|
||
this._expAndGoldWindow = null;
|
||
}
|
||
$gameScreen.erasePicture(55);
|
||
|
||
// [追加] DTextPicture連携で追加した要素を消去
|
||
if (this._extraDTextSprites) {
|
||
this._extraDTextSprites.forEach(sprite => this.removeChild(sprite));
|
||
this._extraDTextSprites = null;
|
||
}
|
||
if (enableExtraDText) {
|
||
extraDTextParams.forEach(param => {
|
||
const picId = Number(param.pictureId);
|
||
if (picId) {
|
||
$gameScreen.erasePicture(picId);
|
||
}
|
||
});
|
||
}
|
||
};
|
||
|
||
// ★★★ ここから改修部分 ★★★
|
||
// レベル・所持金表示用のウィンドウ定義を、ご要望に合わせて変更しました。
|
||
function Window_ExpAndGold() {
|
||
this.initialize(...arguments);
|
||
}
|
||
|
||
Window_ExpAndGold.prototype = Object.create(Window_Selectable.prototype);
|
||
Window_ExpAndGold.prototype.constructor = Window_ExpAndGold;
|
||
|
||
// ウィンドウの初期化処理
|
||
Window_ExpAndGold.prototype.initialize = function(rect) {
|
||
Window_Selectable.prototype.initialize.call(this, rect);
|
||
// ウィンドウの枠と背景を完全に透明にします。
|
||
this.opacity = 0;
|
||
this.backOpacity = 0;
|
||
this.refresh();
|
||
};
|
||
|
||
Window_ExpAndGold.prototype.colSpacing = function() {
|
||
return 0;
|
||
};
|
||
|
||
// [改修] ウィンドウの描画内容を更新する処理
|
||
Window_ExpAndGold.prototype.refresh = function() {
|
||
const actor = $gameParty.leader();
|
||
if (!actor) return;
|
||
|
||
this.contents.clear();
|
||
|
||
const y = 0;
|
||
const lineHeight = this.lineHeight();
|
||
const space = 8; // ラベルと数値の間のスペース
|
||
const blockPadding = 8; // テキストと背景の間の余白
|
||
const backColor = 'rgba(0, 0, 0, 0.6)'; // 背景色
|
||
|
||
// --- 描画処理用のヘルパー関数 ---
|
||
const drawBackground = (x, width) => {
|
||
// 指定されたX座標と幅で背景の矩形を描画します。
|
||
this.contents.fillRect(x, y, width, lineHeight, backColor);
|
||
};
|
||
|
||
// --- 列1 & 2: レベル と 次のレベルまで (左寄せ・背景結合) ---
|
||
const leftSidePadding = 12; // ウィンドウ左端からの余白
|
||
const background1_x = leftSidePadding; // 結合背景の開始X座標
|
||
const col1_x = background1_x + blockPadding; // レベルテキストの開始X座標
|
||
const col2_x = 220; // 次のレベルまでテキストの開始X座標
|
||
|
||
// 各要素のテキストとその幅を計算
|
||
const label1 = TextManager.levelA;
|
||
const value1 = actor.level;
|
||
const label1Width = this.textWidth(label1);
|
||
const value1Width = this.textWidth(String(value1));
|
||
|
||
const label2 = "次のレベルまで";
|
||
const value2 = actor.isMaxLevel() ? "MAX" : actor.nextRequiredExp().toLocaleString();
|
||
const label2Width = this.textWidth(label2);
|
||
const value2Width = this.textWidth(value2);
|
||
|
||
// 2つのブロックを包括する1つの結合された背景を描画
|
||
// 背景の終了X = 次のレベルまでのテキストブロックの右端 + 余白
|
||
const background1_end_x = col2_x + label2Width + space + value2Width + blockPadding;
|
||
const background1_width = background1_end_x - background1_x;
|
||
drawBackground(background1_x, background1_width);
|
||
|
||
// テキストを描画 (レベル)
|
||
this.changeTextColor(this.systemColor());
|
||
this.drawText(label1, col1_x, y, label1Width, 'left');
|
||
this.resetTextColor();
|
||
this.drawText(value1, col1_x + label1Width + space, y, value1Width, 'left');
|
||
|
||
// テキストを描画 (次のレベルまで)
|
||
this.changeTextColor(this.systemColor());
|
||
this.drawText(label2, col2_x, y, label2Width, 'left');
|
||
this.resetTextColor();
|
||
this.drawText(value2, col2_x + label2Width + space, y, value2Width, 'left');
|
||
|
||
// --- 列3: 所持金 (右下配置) ---
|
||
const rightSidePadding = 12; // ウィンドウ右端からの余白
|
||
|
||
// 所持金ブロックの各要素のテキストとその幅を計算
|
||
const label3 = "所持金";
|
||
const value3 = $gameParty.gold().toLocaleString();
|
||
const unit3 = TextManager.currencyUnit;
|
||
const label3Width = this.textWidth(label3);
|
||
const value3Width = this.textWidth(value3);
|
||
const unit3Width = this.textWidth(unit3);
|
||
// ブロック全体のテキスト幅 + 左右の余白から、背景全体の幅を計算
|
||
const block3_text_width = label3Width + space + value3Width + space + unit3Width;
|
||
const background3_width = block3_text_width + blockPadding * 2;
|
||
|
||
// 所持金ブロックの背景とテキストの描画開始X座標を、ウィンドウの右端基準で計算
|
||
const background3_x = this.contents.width - rightSidePadding - background3_width;
|
||
const col3_x = background3_x + blockPadding;
|
||
|
||
// 所持金ブロックの背景とテキストを描画
|
||
drawBackground(background3_x, background3_width);
|
||
let currentX = col3_x;
|
||
|
||
this.changeTextColor(this.systemColor());
|
||
this.drawText(label3, currentX, y, label3Width, 'left');
|
||
currentX += label3Width + space;
|
||
|
||
this.resetTextColor();
|
||
this.drawText(value3, currentX, y, value3Width, 'left');
|
||
currentX += value3Width + space;
|
||
|
||
this.changeTextColor(this.systemColor());
|
||
this.drawText(unit3, currentX, y, unit3Width, 'left');
|
||
|
||
this.resetTextColor();
|
||
};
|
||
|
||
|
||
Window_ExpAndGold.prototype.open = function() {
|
||
this.refresh();
|
||
Window_Selectable.prototype.open.call(this);
|
||
};
|
||
// ★★★ ここまで ★★★
|
||
|
||
})(); |