//============================================================================= // RPG Maker MZ - Alternative Menu Screen //============================================================================= /*: * @target MZ * @plugindesc Alternative menu screen layout. * @author kaniheadcrab * * @help AltMenuScreenKANI.js * * This plugin changes the layout of the menu screen. */ /*:ja * @target MZ * @plugindesc メニュー画面のレイアウトを変更します。 * @author kaniheadcrab * * @help AltMenuScreenKANI.js * * このプラグインは、AltMenuScreen.jsをベースに * メニュー画面のレイアウトを変更したプラグインです。 * ステータスの表示・装備、スキルの表示をファストビューで表示されるよう改善します。 * * プラグインコマンドはありません。 */ (() => { let _Scene_Menu_prototype_start = Scene_Menu.prototype.start; Scene_Menu.prototype.start = function () { _Scene_Menu_prototype_start.call(this); //this._statusWindow.refresh(); //↑で実行されている let actorIndex = 0; this._mainPurposeWindow.refresh(); this._basicStatusWindow.refresh(actorIndex); this._detailStatusWindow.refresh(actorIndex); this._detailEquipWindow.refresh(actorIndex); this._adultStatusWindow.refresh(); { let sprite = new Sprite(); //sprite.scale.x = -1; //sprite.anchor.x = 1; //sprite.alpha = 0.5; sprite.bitmap = ImageManager.loadPicture("SystemPic/UI_MENU1"); this.addChildAt(sprite, 1); } // { // let sprite = new Sprite(); // sprite.scale.x = 1; // sprite.anchor.x = 1; // sprite.alpha = 0.5; // sprite.bitmap = ImageManager.loadPicture("SystemPic/UI_MENU1"); // this.addChildAt(sprite, 1); // } //FontManager.load("rmmz-mainfont", "f910-shin-comic-2.04"); }; //ステータス関連のウインドウ作成 var _Scene_Menu_prototype_createStatusWindow = Scene_Menu.prototype.createStatusWindow; Scene_Menu.prototype.createStatusWindow = function (rect) { //_Scene_Menu_prototype_createStatusWindow.call(this); const sw = Graphics.boxWidth - this.mainCommandWidth(); const sh = this.mainAreaHeight(); const sx = this.isRightInputMode() ? 0 : Graphics.boxWidth - sw; const sy = this.mainAreaTop(); const layoutTbl = { // 'menuStatus': {'x': sx, 'y': sy, 'w': sw/2, 'h': sh}, //立ち絵ウインドウ // 'mainPurpose': {'x': sx + sw/2, 'y': sy, 'w': sw/2, 'h': sh/4*1}, //現在目的ウインドウ // 'basicStatus': {'x': sx + sw/2, 'y': sy + sh/4*1, 'w': sw/2, 'h': sh/4*1}, //基本情報ウインドウ // 'detailStatus': {'x': sx + sw/2, 'y': sy + sh/4*2, 'w': sw/2, 'h': sh/4*2} //詳細情報ウインドウ //'detailStatus': {'x': sx, 'y': sy + sh/5*2.09, 'w': sw/2, 'h': sh/5*2.4}, //ステータスウインドウ menuStatus: { x: sx, y: sy, w: sw / 2, h: sh }, //立ち絵ウインドウ mainPurpose: { x: sx + sw / 2, y: sy - 45, w: sw / 2, h: sh / 5 }, //現在目的ウインドウ basicStatus: { x: sx + sw / 2, y: sy + sh / 5, w: sw / 2, h: sh / 5 }, //基本情報ウインドウ detailStatus: { x: sx + sw / 2, y: sy + (sh / 5) * 2.1, w: sw / 2, h: sh / 5, }, //ステータスウインドウ detailEquip: { x: sx + sw / 2, y: sy + (sh / 5) * 3, w: sw / 2, h: (sh / 5) * 1.45, }, //装備ウインドウ adultStatus: { x: sx + sw / 2, y: sy + (sh / 5) * 4.45, w: sw / 2, h: (sh / 10) * 1.1, }, //Adult }; //立ち絵用ウインドウ(旧ステータスウインドウ) { let layout = layoutTbl["menuStatus"]; let rect = new Rectangle(layout.x, layout.y, layout.w, layout.h); this._statusWindow = new Window_MenuStatus(rect); //this.addWindow(this._statusWindow); } //現在目的ウインドウ { let layout = layoutTbl["mainPurpose"]; let rect = new Rectangle(layout.x, layout.y, layout.w, layout.h); this._mainPurposeWindow = new Window_Menu_MainPurpose(rect); this.addWindow(this._mainPurposeWindow); } //基本情報ウインドウ { let layout = layoutTbl["basicStatus"]; let rect = new Rectangle(layout.x, layout.y, layout.w, layout.h); this._basicStatusWindow = new Window_Menu_BasicStatus(rect); this.addWindow(this._basicStatusWindow); } //詳細情報(ステータス)ウインドウ { let layout = layoutTbl["detailEquip"]; let rect = new Rectangle(layout.x, layout.y, layout.w, layout.h); this._detailEquipWindow = new Window_Menu_DetailEquip(rect); this.addWindow(this._detailEquipWindow); } //詳細情報(装備)ウインドウ { let layout = layoutTbl["detailStatus"]; let rect = new Rectangle(layout.x, layout.y, layout.w, layout.h); this._detailStatusWindow = new Window_Menu_DetailStatus(rect); this.addWindow(this._detailStatusWindow); } //Hst情報ウインドウ { let layout = layoutTbl["adultStatus"]; let rect = new Rectangle(layout.x, layout.y, layout.w, layout.h); this._adultStatusWindow = new Window_Menu_AdultStatus(rect); this.addWindow(this._adultStatusWindow); } }; ///------------------------------------------------- // Window_MenuStatus(立ち絵のみ表示に改修) Window_MenuStatus.prototype.maxCols = function () { return 1; }; Window_MenuStatus.prototype.numVisibleRows = function () { return 1; }; let _Window_MenuStatus_prototype_drawItemImage = Window_MenuStatus.prototype.drawItemImage; Window_MenuStatus.prototype.drawItemImage = function (index) { //立ち絵しか表示しないので何もしない //_Window_MenuStatus_prototype_drawItemImage.call(this, index); }; //Window_MenuStatus継承クラスは既存挙動 Window_MenuActor.prototype.drawItemImage = function (index) { _Window_MenuStatus_prototype_drawItemImage.call(this, index); }; let _Window_MenuStatus_prototype_drawItemStatus = Window_MenuStatus.prototype.drawItemStatus; Window_MenuStatus.prototype.drawItemStatus = function (index) { //立ち絵しか表示しないので何もしない //_Window_MenuStatus_prototype_drawItemStatus.call(this, index); }; //Window_MenuStatus継承クラスは既存挙動 Window_MenuActor.prototype.drawItemStatus = function (index) { _Window_MenuStatus_prototype_drawItemStatus.call(this, index); }; //---------------------------------------------------------------------------------------------------- // // 以下はオリジナルのウインドウ群 // //---------------------------------------------------------------------------------------------------- // ↓で新規に定義するウインドウの基底クラス(actor情報取得メソッド定義したかっただけ) class Window_Menu_SimpleStatus extends Window_StatusBase { constructor(rect) { super(rect); this._isWindow = false; this._windowskin = null; this._refreshAllParts(); } actor(index) { return $gameParty.members()[index]; } update() { super.update(); this._frameSprite.visible = false; this._contentsBackSprite.visible = false; } drawIcon2(iconIndex, x, y, w, h) { const bitmap = ImageManager.loadSystem("IconSet"); const pw = ImageManager.iconWidth; const ph = ImageManager.iconHeight; const sx = (iconIndex % 16) * pw; const sy = Math.floor(iconIndex / 16) * ph; this.contents.blt(bitmap, sx, sy, pw, ph, x, y, w, h); } resetFontSettings() { super.resetFontSettings(); this.contents.fontFace = "menufont, " + $gameSystem.mainFontFace(); } } ///------------------------------------------------- // 現在の目的 class Window_Menu_MainPurpose extends Window_Menu_SimpleStatus { constructor(rect) { super(rect); } refresh() { let varId = 15; //目標テキスト取得に用いる変数番号 if (!$dataPurpose) { return; } const varVal = $gameVariables.value(varId); let purposeText = "---"; let len = $dataPurpose.length; for (let i = 0; i < len; i++) { let data = $dataPurpose[i]; if (!data) { continue; } if (data.val <= varVal) { purposeText = data.purposeText; } else { break; } } const winWidth = this.contentsWidth(); const lineHeight = this.lineHeight(); this.drawTextEx($dataSystemTexts.Altmenu_purpose, 10, 0, winWidth); this.drawTextEx("\\}" + purposeText, 10, 0 + lineHeight, winWidth); this.drawMainQuest(10, 0 + lineHeight * 2, winWidth); } drawMainQuest = function (x, y, width) { let scenario = $gameVariables.value(15); //chapter 1 if (scenario >= 1010 && scenario < 1100) { let mainQ = [202, 203, 204, 205, 206, 207]; let count = 0; for (let i = 0; i < mainQ.length; i++) { if ( $gameVariables.value(mainQ[i]) >= 0 && $gameVariables.value(mainQ[i]) < 4 ) { count += 1; } } this.drawTextEx( $dataSystemTexts.Altmenu_mainQuestCount + count, x, y, width ); } //chapter 2 if (scenario >= 2100 && scenario < 2200) { let mainQ = [221, 222, 223, 225, 226]; let count = 0; for (let i = 0; i < mainQ.length; i++) { if ( $gameVariables.value(mainQ[i]) >= 0 && $gameVariables.value(mainQ[i]) < 4 ) { count += 1; } } this.drawTextEx( $dataSystemTexts.Altmenu_mainQuestCount + count, x, y, width ); } }; } ///------------------------------------------------- // 基本情報(キャラチップ・キャラ名・体・気・魂) class Window_Menu_BasicStatus extends Window_Menu_SimpleStatus { constructor(rect) { super(rect); } refresh(index) { const actor = this.actor(index); const winWidth = this.contentsWidth(); const lineHeight = this.lineHeight(); //アクター画像 var charaPw = 0, charaPh = 0; { //todo: キャラチップあたりの幅高さを取得しているが、仕様上画像サイズ固定ならこの処理不要 //読み込みも入りそうだし固定値に差し替え検討 let characterName = actor.characterName(); const bitmap = ImageManager.loadCharacter(characterName); const big = ImageManager.isBigCharacter(characterName); charaPw = bitmap.width / (big ? 3 : 12); charaPh = bitmap.height / (big ? 4 : 8); } this.drawActorCharacter(actor, charaPw / 2, charaPh); //アクター名・レベル var bw = (winWidth - charaPw) / 3; //アクター画像を覗いたウインドウ幅/3を1ブロック幅とする var sx = charaPw; this.drawActorName(actor, sx, 0, bw); this.drawActorLevel(actor, sx, lineHeight, bw); if (actor.isMaxLevel()) { this.drawTextEx( $dataSystemTexts.Altmenu_nextEXP + "---", sx, lineHeight * 2, bw - 4 ); } else { this.drawTextEx( $dataSystemTexts.Altmenu_nextEXP + $gameParty.members()[0].nextRequiredExp(), sx, lineHeight * 2, bw - 4 ); } this.drawActorClass(actor, sx + bw, 0, bw); this.placeBasicGauges(actor, sx + bw, lineHeight, bw); } } ///------------------------------------------------- // 詳細情報(現在装備情報) class Window_Menu_DetailEquip extends Window_Menu_SimpleStatus { constructor(rect) { super(rect); } refresh(index) { const actor = this.actor(index); const winWidth = this.contentsWidth(); const lineHeight = this.lineHeight(); this.drawBackgroundRect(new Rectangle(0, 0, this.width, this.height)); var sx = 10, sy = 10; var ssy = -5; // 装備タイプ・装備名 if ($gameParty._actors == 6) { //愚譜 [10, 16, 17].forEach((equipType, index) => { let lineNo = index; this.drawBackgroundRect( new Rectangle(sx + (winWidth / 4) * lineNo, sy + 36, 118, 26) ); this.drawEquipType(equipType, sx + (winWidth / 4) * lineNo, sy + 6); if (index < 1) { this.drawEquipParam( actor, index, sx + 34 + (winWidth / 4) * lineNo, sy, 2 ); } else { this.drawEquipParam( actor, index, sx + 34 + (winWidth / 4) * lineNo, sy, 3 ); } this.drawEquipName( actor, index, sx + (winWidth / 4) * lineNo, sy + ssy + lineHeight ); }, this); return; } if ($gameParty._actors == 2) { //鈴音 [14, 16].forEach((equipType, index) => { let lineNo = index; this.drawBackgroundRect( new Rectangle(sx + (winWidth / 4) * lineNo, sy + 36, 118, 26) ); this.drawEquipType(equipType, sx + (winWidth / 4) * lineNo, sy + 6); if (index < 1) { this.drawEquipParam( actor, index, sx + 34 + (winWidth / 4) * lineNo, sy, 2 ); } else { this.drawEquipParam( actor, index, sx + 34 + (winWidth / 4) * lineNo, sy, 3 ); } this.drawEquipName( actor, index, sx + (winWidth / 4) * lineNo, sy + ssy + lineHeight ); }, this); return; } else { [11, 12, 13, 14, 15, 16, 17, 18].forEach((equipType, index) => { let lineNo = index; let lineNo2 = index - 4; if (index < 4) { this.drawBackgroundRect( new Rectangle(sx + (winWidth / 4) * lineNo, sy + 36, 118, 26) ); this.drawEquipType(equipType, sx + (winWidth / 4) * lineNo, sy + 6); this.drawEquipParam( actor, index, sx + 34 + (winWidth / 4) * lineNo, sy, 2 ); this.drawEquipName( actor, index, sx + (winWidth / 4) * lineNo, sy + ssy + lineHeight ); } else { this.drawBackgroundRect( new Rectangle(sx + (winWidth / 4) * lineNo2, sy + 116, 118, 26) ); this.drawEquipType( equipType, sx + (winWidth / 4) * lineNo2, sy + 86 ); if (equipType < 16) { this.drawEquipParam( actor, index, sx + 34 + (winWidth / 4) * lineNo2, sy + 80, 2 ); } else if (equipType == 16) { this.drawEquipParam( actor, index, sx + 34 + (winWidth / 4) * lineNo2, sy + 80, 3 ); } this.drawEquipName( actor, index, sx + (winWidth / 4) * lineNo2, sy + ssy + 80 + lineHeight ); } }, this); } } //指定したtypeIdxの装備種別名を表示 drawEquipType = function (typeIdx, x, y) { this.changeTextColor(ColorManager.systemColor()); switch (typeIdx) { case 10: this.drawIcon2(100, x, y, 24, 24); break; case 11: this.drawIcon2(96, x, y, 24, 24); break; case 12: this.drawIcon2(97, x, y, 24, 24); break; case 13: this.drawIcon2(98, x, y, 24, 24); break; case 14: this.drawIcon2(99, x, y, 24, 24); break; case 15: this.drawIcon2(100, x, y, 24, 24); break; case 16: this.drawIcon2(128, x, y, 24, 24); break; case 17: this.drawIcon2(129, x, y, 24, 24); break; case 18: this.drawIcon2(129, x, y, 24, 24); break; default: break; } //装備部位の項目は非表示に this.resetTextColor(); }; //指定したactorのindex番目の装備名を表示 drawEquipName = function (actor, index, x, y) { let equips = actor ? actor.equips() : null; if (!equips || !equips[index]) { this.drawText($dataSystemTexts.Altmenu_EquipNON, x, y, 50); return; } const equip = equips[index]; const equipName = equip.name; this.drawTextExStatus("\\}\\}" + equipName + "\\{\\{", x + 2, y, 80); }; //指定したactorのindex番目の装備能力値(paramIdx)を表示 drawEquipParam = function (actor, index, x, y, paramIdx) { let equips = actor ? actor.equips() : null; //桜以外の特殊処理 if (actor._actorId >= 2) { if (!equips || !equips[index]) { this.drawText($dataSystemTexts.Altmenu_EquipNON, x, y, 50); return; } const equip = equips[index]; if (index <= 0) { this.drawText( $dataSystemTexts.Altmenu_EquipATK + equip.params[paramIdx], x, y, 60 ); } else this.drawText( $dataSystemTexts.Altmenu_EquipDEF + equip.params[paramIdx], x, y, 60 ); return; } //桜のステータス描画 if (!equips || !equips[index]) { this.drawText($dataSystemTexts.Altmenu_EquipNON, x, y, 50); return; } const equip = equips[index]; if (index != 5) { this.drawText( $dataSystemTexts.Altmenu_EquipATK + equip.params[paramIdx], x, y, 60 ); } else this.drawText( $dataSystemTexts.Altmenu_EquipDEF + equip.params[paramIdx], x, y, 60 ); }; } class Window_Menu_DetailStatus extends Window_Menu_SimpleStatus { constructor(rect) { super(rect); } refresh(index) { const actor = this.actor(index); const winWidth = this.contentsWidth(); const lineHeight = this.lineHeight(); var sx = 10, sy = 0; // 基本攻撃・防御・闘志(魔法力)・敏捷性 //let hoge = true || false ? true : false; let UPatk = actor.actor().id == 1 ? Math.round( (actor.paramBase(2) + $gameVariables.value(188) + $gameVariables.value(134)) * actor.paramRate(2) ) : actor.paramBase(2); this.drawTextEx($dataSystemTexts.Altmenu_TitleStatus, sx - 8, sy, 110); [2, 3, 4, 6].forEach((paramTypeIdx, index) => { let lineNo = index; this.drawBackgroundRect( new Rectangle(sx + (winWidth / 4) * lineNo, sy + 38, 110, 34) ); this.drawActorParamName( actor, paramTypeIdx, sx + (winWidth / 4) * lineNo, sy + lineHeight ); if (paramTypeIdx == 2) { this.drawTextEx( " " + `${UPatk}`, sx + (winWidth / 2) * lineNo + 55, sy + lineHeight, 110 ); this.drawTextEx( $dataSystemTexts.Altmenu_AtkHosoku, sx + (winWidth / 4) * lineNo, sy + lineHeight * 2, 110 ); } else { this.drawActorParam( actor, paramTypeIdx, sx + (winWidth / 4) * lineNo + 68, sy + lineHeight ); } }, this); } //指定したアクターの能力値名を表示 drawActorParamName = function (actor, paramId, x, y) { const name = TextManager.param(paramId); //status name this.changeTextColor(ColorManager.systemColor()); this.drawTextEx("\\}\\c[4] " + name + ": \\{", x, y, 160); this.resetTextColor(); }; //指定したアクターの能力値を表示 drawActorParam = function (actor, paramId, x, y) { const val = paramId == 2 ? actor.paramBase(paramId) : actor.param(paramId); this.drawText(val, x, y, 50); }; } const _Window_Menu_makeFontBigger = Window_Base.prototype.makeFontBigger; Window_Base.prototype.makeFontBigger = function () { if (this.contents.fontSize <= 96) { this.contents.fontSize += 4; } else { _Window_Menu_makeFontBigger.apply(this, arguments); } }; const _Window_Menu_makeFontSmaller = Window_Base.prototype.makeFontSmaller; Window_Base.prototype.makeFontSmaller = function () { if (this.contents.fontSize >= 20) { this.contents.fontSize -= 4; } else { _Window_Menu_makeFontSmaller.apply(this, arguments); } }; ///------------------------------------------------- // アダルトステータス class Window_Menu_AdultStatus extends Window_Menu_SimpleStatus { constructor(rect) { super(rect); } colSpacing() { return 0; } getVal(id) { return $gameVariables.value(id); } refresh() { let lx = 0; let ly = 8; let iconWidth = 32; if ($gameParty._actors == 2) { //鈴音 let hlv = $gameVariables.value(25); switch (hlv) { case 12: this.drawText( $dataSystemTexts.Altmenu_Hst_S_lv12, lx + 70, ly, 500 ); break; case 11: this.drawText( $dataSystemTexts.Altmenu_Hst_S_lv11, lx + 70, ly, 500 ); break; case 10: this.drawText( $dataSystemTexts.Altmenu_Hst_S_lv10, lx + 70, ly, 500 ); break; case 9: this.drawText($dataSystemTexts.Altmenu_Hst_S_lv9, lx + 70, ly, 500); break; case 8: this.drawText($dataSystemTexts.Altmenu_Hst_S_lv8, lx + 70, ly, 500); break; case 7: this.drawText($dataSystemTexts.Altmenu_Hst_S_lv7, lx + 70, ly, 500); break; case 6: this.drawText($dataSystemTexts.Altmenu_Hst_S_lv6, lx + 70, ly, 500); break; case 5: this.drawText($dataSystemTexts.Altmenu_Hst_S_lv5, lx + 70, ly, 500); break; default: this.drawText($dataSystemTexts.Altmenu_Hst_S_lv4, lx + 70, ly, 500); break; } return; } if ($gameParty._actors == 6) { //愚譜 this.drawText($dataSystemTexts.Altmenu_Hst_G, lx + 70, ly, 500); return; } const paramTbl = [ { iconId: 238, valueId: 25 }, { iconId: 220, valueId: 56 }, { iconId: 221, valueId: 57 }, { iconId: 222, valueId: 58 }, { iconId: 223, valueId: 59 }, ]; var textWidth = iconWidth + 65; paramTbl.forEach((elm, index) => { let lx = 20 + index * textWidth; this.drawIcon(elm.iconId, lx, ly); lx += iconWidth + 5; this.drawText(`Lv${this.getVal(elm.valueId)}`, lx, ly, 60); if (index != 0) { this.drawTextEx( "\\FS[18]" + `${this.getVal(elm.valueId - 35)}` + "\\FS[24]", lx - 35, ly + 15, 60 ); } }, this); } } const _Window_MenuCommand_maxCols = Window_MenuCommand.prototype.maxCols; Window_MenuCommand.prototype.maxCols = function () { return 1; }; const _Window_MenuCommand_prototype_resetFontSettings = Window_MenuCommand.prototype.resetFontSettings; Window_MenuCommand.prototype.resetFontSettings = function () { _Window_MenuCommand_prototype_resetFontSettings.call(this); this.contents.fontFace = "uifont, " + $gameSystem.mainFontFace(); }; })();