//============================================================================= // WindowBackImage.js // ---------------------------------------------------------------------------- // (C)2017 Triacontane // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 2.11.3 2024/11/24 タイトルヘルププラグインに合わせた調整 // 2.11.2 2024/11/01 ウィンドウ余白のパラメータの定義場所を変更(動作に影響はありません) // 2.11.1 2024/11/01 2.11.0の修正で余白を0に設定した場合も適用されてしまう問題を修正 // 2.11.0 2024/11/01 ウィンドウの余白を変更できる機能を追加 // 2.10.0 2024/10/25 画像差し替えの条件にウィンドウの開閉度を追加 // 2.9.1 2024/07/16 スキンの差し替えがスイッチとは無関係に適用される旨のヘルプを追加 // 2.9.0 2024/05/25 フォントのアウトライン幅を指定できる機能を追加 // 2.8.2 2023/11/21 フォント関連設定は差し替えスイッチとは無関係に適用される旨の説明を追加 // 2.8.1 2023/10/23 サウンドテストプラグイン用の凡例がMV向けになっていたのを修正 // 2.8.0 2023/10/19 アウトラインカラーの指定機能を追加 // 2.7.3 2023/10/05 背景画像の原点をウィンドウの左上にする機能を追加 // 2.7.2 2023/08/26 戦闘リトライプラグインのウィンドウを追加 // 2.7.1 2023/07/29 アイコン説明プラグイン用のウィンドウをパラメータに追加 // 2.7.0 2023/07/19 ウィンドウのベースフォントサイズ、テキストカラーを変更できる機能を追加 // 2.6.3 2023/07/01 2.6.2の変更でウィンドウの幅か高さが0のときは背景画像を非表示にする仕様が無効になっていた問題を修正 // 2.6.2 2023/06/22 差し替えスイッチが無効なときでも、差し替え画像が一瞬表示されてしまう問題を修正 // 2.6.1 2023/05/01 参照されていないメソッドを削除し、一部パラメータのデフォルト値を変更 // 2.6.0 2022/12/15 項目、項目背景、カーソルをパーツ単位で非表示にできる機能を追加 // 2.5.0 2022/06/06 ステータス画面用の装備、パラメータウィンドウを編集対象に追加 // 2.4.0 2022/05/16 マウスオーバーしたときにさらに別の画像に差し替える機能を追加 // 2.3.2 2021/11/14 メニュー画面などで開いたときに一瞬だけウィンドウフレームが見えてしまう問題を修正 // 2.3.1 2021/09/04 ウィンドウの幅か高さが0のときは背景画像を非表示にするよう修正 // 2.3.0 2021/05/06 名前ウィンドウがプリセットになかったので追加 // ウィンドウが重なったときに背後をマスキングしない設定を追加 // 2.2.0 2021/02/27 ウィンドウごとに個別のフォントを指定できる機能を追加 // 2.1.0 2021/01/24 ウィンドウごとに個別のウィンドウスキンを指定できる機能を追加 // 2.0.3 2020/12/16 指定対象外のウィンドウで余計な処理が実行されてしまう問題を修正 // 2.0.2 2020/10/15 指定可能なウィンドウに戦闘画面のステータスウィンドウを追加 // 2.0.1 2020/08/22 カスタムメニュープラグインで作成したウィンドウ背景を変えられる機能を追加 // 2.0.0 2020/08/13 MZ対応版作成 // 1.3.0 2019/01/13 ウィンドウ背景の画像を複数表示できる機能を追加 // ウィンドウ背景を指定した場合も元のウィンドウフレームを表示したままにできる機能を追加 // 1.2.0 2018/11/29 ウィンドウ背景を有効にするかどうかを動的に制御するスイッチを追加 // 1.1.0 2017/11/19 拡大率を設定できる機能を追加 // 1.0.0 2017/11/18 初版 // ---------------------------------------------------------------------------- // [Blog] : https://triacontane.blogspot.jp/ // [Twitter]: https://twitter.com/triacontane/ // [GitHub] : https://github.com/triacontane/ //============================================================================= /*: @target MZ @url https://github.com/triacontane/RPGMakerMV/tree/mz_master/WindowBackImage.js @plugindesc Window background image specification plugin @author Triacontane @license MIT License @help English Help Translator: munokura This is an unofficial English translation of the plugin help, created to support global RPG Maker users. Feedback is welcome to improve translation quality (see: https://github.com/munokura/triacontane-MZ-plugins ). Original plugin by Triacontane. Please check the latest official version at: https://triacontane.blogspot.com ----- WindowBackImage.js Replaces the window background with any image. Multiple images can be specified, and appearance conditions can be set for each. When the image is displayed, you can choose whether to hide the original window frame. The background image is displayed at the center of the window, regardless of the window size. While you can adjust the zoom and coordinates, we do not recommend specifying a background image for windows with variable or indefinite sizes. You can also specify a background image for windows added by plugins, but this may not work properly. If you want to change the background of a window added with SceneCustomMenu.js, specify the "window identifier" of the plugin instead of the WindowClass. This plugin does not have any plugin commands. Terms of Use: You may modify and redistribute this plugin without permission, and there are no restrictions on its use (commercial, 18+, etc.). This plugin is now yours. @param windowImageInfo @text Window Image Information @desc Information about the window whose background image you want to replace. @type struct[] */ /*~struct~WindowImages: @param WindowClass @text window @desc This is the window to be replaced with a dedicated image. If it is not in the list, please enter it directly. @type select @option [General Game] Help window @value Window_Help @option [General Game] Money Window @value Window_Gold @option [General Game] Icon Description Window (requires plugin) @value Window_IconCaption @option [Main Menu] Main Command Window @value Window_MenuCommand @option [Main Menu] Actor Status Window @value Window_MenuStatus @option [Item Screen] Item Category Window @value Window_ItemCategory @option [Item Screen] Item List Window @value Window_ItemList @option [Item Screen] Actor Selection Window @value Window_MenuActor @option [Skill Screen] Skill Type Window @value Window_SkillType @option [Skills Screen] Status Window @value Window_SkillStatus @option [Skills Screen] Skill List Window @value Window_SkillList @option [Equipment Screen] Status Window @value Window_EquipStatus @option [Equipment Screen] Equip Command Window @value Window_EquipCommand @option [Equipment Screen] Equipment Slot Window @value Window_EquipSlot @option [Equipment Screen] Equipment List Window @value Window_EquipItem @option [Status Screen] Status Window @value Window_Status @option [Status Screen] Equipment Window @value Window_StatusEquip @option [Status Screen] Parameter Window @value Window_StatusParams @option [Options Screen] Options Window @value Window_Options @option [Save/Load Screen] File List Window @value Window_SavefileList @option [Shop Screen] Shop Command Window @value Window_ShopCommand @option [Shop Screen] Purchased Items Window @value Window_ShopBuy @option [Shop Screen] Selling Item Window @value Window_ShopSell @option [Shop Screen] Numerical Input Window @value Window_ShopNumber @option [Shop Screen] Status Window @value Window_ShopStatus @option [Name entry screen] Name window @value Window_NameEdit @option [Name entry screen] Name entry window @value Window_NameInput @option [Map Screen] Choices Window @value Window_ChoiceList @option [Map screen] Numerical value input window @value Window_NumberInput @option [Map Screen] Item Selection Window @value Window_EventItem @option [Map Screen] Name Window @value Window_NameBox @option [Map Screen] Message Window @value Window_Message @option [Map Screen] Scrolling Message Window @value Window_ScrollText @option [Map Screen] Map Name Window @value Window_MapName @option [Battle Screen] Battle Log Window @value Window_BattleLog @option [Battle Screen] Party Command Window @value Window_PartyCommand @option [Battle Screen] Actor Command Window @value Window_ActorCommand @option [Battle Screen] Battler Status Window @value Window_BattleStatus @option [Battle Screen] Actor List Window @value Window_BattleActor @option [Battle screen] Enemy character list window @value Window_BattleEnemy @option [Battle Screen] Skill List Window @value Window_BattleSkill @option [Battle Screen] Item List Window @value Window_BattleItem @option [Title Screen] Title Window @value Window_TitleCommand @option [Title Screen] Title Help Window @value Window_TitleHelp @option [Game End Screen] Exit confirmation window @value Window_GameEnd @option [Debug screen] Variable selection window @value Window_DebugRange @option [Debug Screen] Variables Settings Window @value Window_DebugEdit @option [Behavior Goal Window Plugin] Behavior Goal Window @value Window_Destination @option [Behavior Objective Window Plugin] Menu Behavior Objective Window @value Window_DestinationMenu @option [In-game time plugin] Time window @value Window_Chronus @option [Terminology Plug-in] Term Category Window @value Window_GlossaryCategory @option [Glossary Plug-in] Term List Window @value Window_GlossaryList @option [Terminology Dictionary Plug-in] Usage confirmation window @value Window_GlossaryConfirm @option [Glossary Plugin] Collection Rate Window @value Window_GlossaryComplete @option [Glossary Plug-in] Terminology window @value Window_Glossary @option [Sound Test Plugin] Sound Category Window @value Window_SoundCategory @option [Sound Test Plug-in] Sound List Window @value Window_SoundList @option [Sound Test Plugin] Audio Settings Window @value Window_AudioConfig @option [Sound Test Plug-in] Audio Window @value Window_Audio @option [Sound Test Plugin] Audio Seekbar Window @value Sprite_AudioSeek @option [Numeric Input Screen Plug-in] Numeric Input Window @value Window_NumberInput @option [Numeric Input Screen Plugin] Numeric Window @value Window_NumberEdit @option [Battle Retry Plugin] Retry window @value Window_RetryCommand @param ImageFile @text Replacement file name @desc The file name of the image to replace. (Select from img/picture) If you specify empty, only the frame will be hidden. @type file @dir img/pictures/ @param ImageFileHover @text Hover File Name @desc The file name of the image that will be replaced when you hover the mouse over it. @type file @dir img/pictures/ @param Origin @text origin @desc The origin of the background image. @type select @default 1 @option Top left (the top left of the window and the top left of the image match) @value 0 @option Center (the center of the window and the center of the image are aligned) @value 1 @param OffsetX @text X coordinate correction @desc Correction value for the display X coordinate. @type number @default 0 @min -2000 @max 2000 @param OffsetY @text Y coordinate correction @desc Display Y coordinate correction value. @type number @default 0 @min -2000 @max 2000 @param ScaleX @text Magnification (width) @desc X-axis magnification (specified in %). @type number @default 100 @min -2000 @max 2000 @param ScaleY @text Magnification (height) @desc Magnification rate in the Y direction (specified as a percentage). @type number @default 100 @min -2000 @max 2000 @param WindowShow @text Leave the window @desc Keeps the original background of the window visible. @type boolean @default true @param ItemHide @text Hide items @desc Hides the contents of the window. @type boolean @default false @param ItemBackHide @text Hide item background @desc Hides the window's item background. @type boolean @default false @param CursorHide @text Cursor Hidden @desc Hides the window cursor. @type boolean @default false @param AllHide @text Hide all @desc Hides the entire window. Use with caution. @type boolean @default false @param SwitchId @text Replacement switch number @desc The window will be replaced only when the specified switch is ON. @type switch @default 0 @param Openness @text Opening and closing conditions @desc The window will only be replaced if the opening/closing degree of the window is greater than or equal to the specified value. @type number @default 0 @max 255 @param OverlapOther @text Overlay on other windows @desc When displayed overlapping other windows, it will no longer mask the windows behind it. @type boolean @default false @param Padding @text Window Margins @desc Change the window margins. The default value is 12. If you change it, you may need to adjust the window height and width. @type number @default 0 @param Font @text Font-related settings @desc These are settings related to window skins and fonts. These settings are applied regardless of the replacement switch. @param WindowSkin @text Window Skin @desc This is a dedicated window skin image. This setting is applied regardless of the replacement switch. @type file @dir img/system/ @parent Font @param FontFace @text font @desc This is a dedicated font for windows. Please specify the woff file with the extension. @parent Font @param FontSize @text Font size @desc The base font size for the window. @type number @default 0 @parent Font @param FontColor @text Font color @desc The window text color number. Select from the text colors or specify it directly in CSS format (e.g., rgba(0,0,0,0)). @type color @default 0 @parent Font @param OutlineColor @text Outline Color @desc The window text color number. Select from the text colors or specify it directly in CSS format (e.g., rgba(0,0,0,0)). @type color @default 0 @parent Font @param OutlineWidth @text Outline Width @desc The width of the window's text outline. @type number @default 3 @parent Font */ /*:ja @plugindesc ウィンドウ背景画像指定プラグイン @target MZ @url https://github.com/triacontane/RPGMakerMV/tree/mz_master/WindowBackImage.js @base PluginCommonBase @author トリアコンタン @param windowImageInfo @text ウィンドウ画像情報 @desc 背景画像を差し替えるウィンドウの情報です。 @default @type struct[] @help WindowBackImage.js ウィンドウの背景を任意の画像に置き換えます。 画像は複数指定可能で、それぞれに出現条件スイッチを指定できます。 画像が表示された場合、元のウィンドウフレームを非表示するかどうかを 選択できます。 背景画像はウィンドウのサイズにかかわらず、中央を原点に表示されます。 拡大率と座標を補正することは可能ですがサイズが可変、不定のウィンドウに 対して背景画像を指定することは推奨しません。 プラグインによって追加されたウィンドウにも指定可能ですが 正常に動作するとは限りません。 SceneCustomMenu.jsで追加したウィンドウの背景を変えたい場合は WindowClassの指定を同プラグインの『ウィンドウ識別子』を指定してください。 このプラグインにはプラグインコマンドはありません。 利用規約: 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) についても制限はありません。 このプラグインはもうあなたのものです。 */ /*~struct~WindowImages:ja @param WindowClass @text ウィンドウ @desc 専用の画像に差し替える対象のウィンドウです。一覧にない場合は直接入力してください。 @type select @default @option [ゲーム全般]ヘルプウィンドウ @value Window_Help @option [ゲーム全般]お金ウィンドウ @value Window_Gold @option [ゲーム全般]アイコン説明ウィンドウ(要プラグイン) @value Window_IconCaption @option [メインメニュー]メインコマンドウィンドウ @value Window_MenuCommand @option [メインメニュー]アクターステータスウィンドウ @value Window_MenuStatus @option [アイテム画面]アイテムカテゴリウィンドウ @value Window_ItemCategory @option [アイテム画面]アイテムリストウィンドウ @value Window_ItemList @option [アイテム画面]アクター選択ウィンドウ @value Window_MenuActor @option [スキル画面]スキルタイプウィンドウ @value Window_SkillType @option [スキル画面]ステータスウィンドウ @value Window_SkillStatus @option [スキル画面]スキルリストウィンドウ @value Window_SkillList @option [装備画面]ステータスウィンドウ @value Window_EquipStatus @option [装備画面]装備コマンドウィンドウ @value Window_EquipCommand @option [装備画面]装備スロットウィンドウ @value Window_EquipSlot @option [装備画面]装備リストウィンドウ @value Window_EquipItem @option [ステータス画面]ステータスウィンドウ @value Window_Status @option [ステータス画面]装備ウィンドウ @value Window_StatusEquip @option [ステータス画面]パラメータウィンドウ @value Window_StatusParams @option [オプション画面]オプションウィンドウ @value Window_Options @option [セーブ、ロード画面]ファイルリストウィンドウ @value Window_SavefileList @option [ショップ画面]ショップコマンドウィンドウ @value Window_ShopCommand @option [ショップ画面]購入アイテムウィンドウ @value Window_ShopBuy @option [ショップ画面]売却アイテムウィンドウ @value Window_ShopSell @option [ショップ画面]数値入力ウィンドウ @value Window_ShopNumber @option [ショップ画面]ステータスウィンドウ @value Window_ShopStatus @option [名前入力画面]名前ウィンドウ @value Window_NameEdit @option [名前入力画面]名前入力ウィンドウ @value Window_NameInput @option [マップ画面]選択肢ウィンドウ @value Window_ChoiceList @option [マップ画面]数値入力ウィンドウ @value Window_NumberInput @option [マップ画面]アイテム選択ウィンドウ @value Window_EventItem @option [マップ画面]名前ウィンドウ @value Window_NameBox @option [マップ画面]メッセージウィンドウ @value Window_Message @option [マップ画面]スクロールメッセージウィンドウ @value Window_ScrollText @option [マップ画面]マップ名ウィンドウ @value Window_MapName @option [戦闘画面]バトルログウィンドウ @value Window_BattleLog @option [戦闘画面]パーティコマンドウィンドウ @value Window_PartyCommand @option [戦闘画面]アクターコマンドウィンドウ @value Window_ActorCommand @option [戦闘画面]バトラーステータスウィンドウ @value Window_BattleStatus @option [戦闘画面]アクター一覧ウィンドウ @value Window_BattleActor @option [戦闘画面]敵キャラ一覧ウィンドウ @value Window_BattleEnemy @option [戦闘画面]スキル一覧ウィンドウ @value Window_BattleSkill @option [戦闘画面]アイテム一覧ウィンドウ @value Window_BattleItem @option [タイトル画面]タイトルウィンドウ @value Window_TitleCommand @option [タイトル画面]タイトルヘルプウィンドウ @value Window_TitleHelp @option [ゲーム終了画面]終了確認ウィンドウ @value Window_GameEnd @option [デバッグ画面]変数選択ウィンドウ @value Window_DebugRange @option [デバッグ画面]変数設定ウィンドウ @value Window_DebugEdit @option [行動目標ウィンドウプラグイン]行動目標ウィンドウ @value Window_Destination @option [行動目標ウィンドウプラグイン]メニュー行動目標ウィンドウ @value Window_DestinationMenu @option [ゲーム内時間の導入プラグイン]時間ウィンドウ @value Window_Chronus @option [用語辞典プラグイン]用語カテゴリウィンドウ @value Window_GlossaryCategory @option [用語辞典プラグイン]用語リストウィンドウ @value Window_GlossaryList @option [用語辞典プラグイン]使用確認ウィンドウ @value Window_GlossaryConfirm @option [用語辞典プラグイン]収集率ウィンドウ @value Window_GlossaryComplete @option [用語辞典プラグイン]用語ウィンドウ @value Window_Glossary @option [サウンドテストプラグイン]サウンドカテゴリウィンドウ @value Window_SoundCategory @option [サウンドテストプラグイン]サウンドリストウィンドウ @value Window_SoundList @option [サウンドテストプラグイン]オーディオ設定ウィンドウ @value Window_AudioConfig @option [サウンドテストプラグイン]オーディオウィンドウ @value Window_Audio @option [サウンドテストプラグイン]オーディオシークバーウィンドウ @value Sprite_AudioSeek @option [数値入力画面プラグイン]数値入力ウィンドウ @value Window_NumberInput @option [数値入力画面プラグイン]数値ウィンドウ @value Window_NumberEdit @option [戦闘リトライプラグイン]リトライウィンドウ @value Window_RetryCommand @param ImageFile @text 差し替えファイル名 @desc 差し替える画像のファイル名です。(img/pictureの中から選択します) 空を指定すると枠だけが非表示になります。 @default @dir img/pictures/ @type file @param ImageFileHover @text ホバーファイル名 @desc マウスを重ねたときに差し替えられる画像のファイル名です。 @default @dir img/pictures/ @type file @param Origin @text 原点 @desc 背景画像の原点です。 @default 1 @type select @option 左上(ウィンドウの左上と画像の左上が一致) @value 0 @option 中央(ウィンドウの中央と画像の中央が一致) @value 1 @param OffsetX @text X座標補正 @desc 表示X座標の補正値です。 @default 0 @type number @min -2000 @max 2000 @param OffsetY @text Y座標補正 @desc 表示Y座標の補正値です。 @default 0 @type number @min -2000 @max 2000 @param ScaleX @text 拡大率(横幅) @desc X方向の拡大率(%指定)です。 @default 100 @type number @min -2000 @max 2000 @param ScaleY @text 拡大率(高さ) @desc Y方向の拡大率(%指定)です。 @default 100 @type number @min -2000 @max 2000 @param WindowShow @text ウィンドウを残す @desc ウィンドウの元背景を表示したままにします。 @default true @type boolean @param ItemHide @text 項目非表示 @desc ウィンドウの中身を非表示にします。 @default false @type boolean @param ItemBackHide @text 項目背景非表示 @desc ウィンドウの項目背景を非表示にします。 @default false @type boolean @param CursorHide @text カーソル非表示 @desc ウィンドウのカーソルを非表示にします。 @default false @type boolean @param AllHide @text 全体非表示 @desc ウィンドウ全体を非表示にします。注意して設定してください。 @default false @type boolean @param SwitchId @text 差し替えスイッチ番号 @desc 指定したスイッチがONのときのみウィンドウを差し替えます。 @default 0 @type switch @param Openness @text 開閉度条件 @desc ウィンドウの開閉度が指定値以上のときのみウィンドウを差し替えます。 @default 0 @type number @max 255 @param OverlapOther @text 他ウィンドウに重ねる @desc 他のウィンドウと重なって表示させたときに背後のウィンドウをマスキングさせなくなります。 @default false @type boolean @param Padding @text ウィンドウ余白 @desc ウィンドウの余白を変更します。標準値は12です。変更する場合、ウィンドウ高さや幅の調整が必要になる場合があります。 @default 0 @type number @param Font @text フォント関連設定 @desc ウィンドウスキンやフォント関連設定です。この設定は差し替えスイッチとは無関係に適用されます。 @param WindowSkin @text ウィンドウスキン @desc 専用のウィンドウスキン画像です。この設定は差し替えスイッチとは無関係に適用されます。 @default @dir img/system/ @type file @parent Font @param FontFace @text フォント @desc ウィンドウの専用フォントです。woffファイルを拡張子付きで指定してください。 @default @parent Font @param FontSize @text フォントサイズ @desc ウィンドウの基本フォントサイズです。 @default 0 @type number @parent Font @param FontColor @text フォントカラー @desc ウィンドウのテキストカラー番号です。テキストカラーから選択するかCSS形式(rgba(0,0,0,0)など)で直接指定してください。 @default 0 @type color @parent Font @param OutlineColor @text アウトラインカラー @desc ウィンドウのテキストカラー番号です。テキストカラーから選択するかCSS形式(rgba(0,0,0,0)など)で直接指定してください。 @default 0 @type color @parent Font @param OutlineWidth @text アウトライン幅 @desc ウィンドウのテキストアウトラインの幅です。 @default 3 @type number @parent Font */ (function() { 'use strict'; const script = document.currentScript; const param = PluginManagerEx.createParameter(script); if (!param.windowImageInfo) { param.windowImageInfo = []; } const _Scene_Boot_loadGameFonts = Scene_Boot.prototype.loadGameFonts; Scene_Boot.prototype.loadGameFonts = function() { _Scene_Boot_loadGameFonts.apply(this, arguments); param.windowImageInfo.forEach(data => { if (data.FontFace) { FontManager.load(data.FontFace.replace(/\..*/, ''), data.FontFace); } }) }; //============================================================================= // Window // 専用の背景画像を設定します。 //============================================================================= const _Window_initialize = Window.prototype.initialize; Window.prototype.initialize = function() { _Window_initialize.apply(this, arguments); this.frameVisible = this._frameSprite.visible; }; const _Window__createAllParts = Window.prototype._createAllParts; Window.prototype._createAllParts = function() { _Window__createAllParts.apply(this, arguments); this._backImageDataList = this.initBackImageData(); if (this._backImageDataList.length > 0) { this._createBackImage(); } }; /** * 背景画像を作成します。 * @private */ Window.prototype._createBackImage = function() { this._backSprite.visible = false; this._frameSprite.visible = false; this.frameVisible = false; this._windowBackImageSprites = []; this._backImageDataList.forEach(backImageData => { const bitmap = ImageManager.loadPicture(backImageData['ImageFile']); const hoverBitmapName = backImageData['ImageFileHover']; const hoverBitmap = hoverBitmapName ? ImageManager.loadPicture(hoverBitmapName) : null; const sprite = new Sprite_WindowBackImage(bitmap, hoverBitmap); sprite.scale.x = (backImageData['ScaleX'] || 100) / 100; sprite.scale.y = (backImageData['ScaleY'] || 100) / 100; this._windowBackImageSprites.push(sprite); this._container.addChild(sprite); if (backImageData.OverlapOther) { this._isWindow = false; } }); this.updateBackImageList(); }; Window.prototype.initBackImageData = function() { let className = PluginManagerEx.findClassName(this); // for SceneCustomMenu.js if (this._data && this._data.Id) { className = this._data.Id; } return param.windowImageInfo.filter(function(data) { return data['WindowClass'] === className; }, this); }; Window.prototype.getBackImageDataItem = function(index, propName) { return this._backImageDataList[index][propName]; }; const _Window__refreshAllParts = Window.prototype._refreshAllParts; Window.prototype._refreshAllParts = function() { if (this._windowBackImageSprites) { this._refreshBackImage(); } _Window__refreshAllParts.apply(this, arguments); }; /** * 背景画像をリフレッシュします。 * @private */ Window.prototype._refreshBackImage = function() { this._windowBackImageSprites.forEach((sprite, index) => { const origin = this.getBackImageDataItem(index, 'Origin'); const offsetX = this.getBackImageDataItem(index, 'OffsetX'); const offsetY = this.getBackImageDataItem(index, 'OffsetY'); sprite.refreshPosition(this, origin, offsetX, offsetY); }); }; const _Window_update = Window.prototype.update; Window.prototype.update = function() { _Window_update.apply(this, arguments); if (this._windowBackImageSprites) { this.updateBackImageList(); this.updateBackImageVisibly(); } }; Window.prototype.updateBackImageList = function() { let defaultVisible = true; this._windowBackImageSprites.forEach((sprite, index) => { const switchId = this.getBackImageDataItem(index, 'SwitchId'); sprite.visible = this.isValidBackImage(index); if (sprite.visible && !this.getBackImageDataItem(index, 'WindowShow')) { defaultVisible = false; } if (this.getBackImageDataItem(index, 'ItemHide')) { this._contentsSprite.visible = false; } if (this.getBackImageDataItem(index, 'ItemBackHide')) { this._contentsBackSprite.visible = false; } if (this.getBackImageDataItem(index, 'CursorHide')) { this.cursorVisible = false; } if (this.getBackImageDataItem(index, 'AllHide')) { this.visible = false; } sprite.update(); }); this._backSprite.visible = defaultVisible; this._frameSprite.visible = defaultVisible; this.frameVisible = defaultVisible; }; Window.prototype.isValidBackImage = function(index) { const switchId = this.getBackImageDataItem(index, 'SwitchId'); if (switchId && !$gameSwitches.value(switchId)) { return false; } const openness = this.getBackImageDataItem(index, 'Openness'); if (openness > 0 && this.openness < openness) { return false; } return true; }; Window.prototype.updateBackImageVisibly = function() { const visibly = this.width !== 0 && this.height !== 0; if (!visibly) { this._windowBackImageSprites.forEach(sprite => sprite.visible = visibly); } }; const _Window_Base_loadWindowskin = Window_Base.prototype.loadWindowskin; Window_Base.prototype.loadWindowskin = function() { _Window_Base_loadWindowskin.apply(this, arguments); const list = this._backImageDataList || []; list.filter(data => !!data.WindowSkin) .forEach(data => this.windowskin = ImageManager.loadSystem(data.WindowSkin)); }; const _Window_Base_resetFontSettings = Window_Base.prototype.resetFontSettings; Window_Base.prototype.resetFontSettings = function() { _Window_Base_resetFontSettings.apply(this, arguments); const list = this._backImageDataList || []; list.forEach(data => this.setCustomFontSettings(data)); }; const _Window_Base_resetTextColor = Window_Base.prototype.resetTextColor; Window_Base.prototype.resetTextColor = function() { _Window_Base_resetTextColor.apply(this, arguments); const list = this._backImageDataList || []; list.forEach(data => this.setCustomFontColor(data)); }; Window_Base.prototype.setCustomFontSettings = function(data) { if (data.FontFace) { this.contents.fontFace = data.FontFace.replace(/\..*/, ''); } if (data.FontSize) { this.contents.fontSize = data.FontSize; } }; const _Window_Base_updatePadding = Window_Base.prototype.updatePadding; Window_Base.prototype.updatePadding = function() { _Window_Base_updatePadding.apply(this, arguments); const list = this._backImageDataList || []; list.forEach(data => { if (data.Padding > 0) { this.padding = data.Padding; } }); }; Window_Base.prototype.setCustomFontColor = function(data) { const fontColor = data.FontColor; if (fontColor) { const color = isFinite(fontColor) ? ColorManager.textColor(fontColor) : fontColor; this.changeTextColor(color); } const outlineColor = data.OutlineColor; if (outlineColor) { const color = isFinite(outlineColor) ? ColorManager.textColor(outlineColor) : outlineColor; this.changeOutlineColor(color); } const outlineWidth = data.OutlineWidth; if (outlineWidth >= 0) { this.contents.outlineWidth = outlineWidth; } }; //============================================================================= // Sprite_WindowBackImage // ウィンドウ背景画像のスプライトです。 //============================================================================= function Sprite_WindowBackImage() { this.initialize.apply(this, arguments); } Sprite_WindowBackImage.prototype = Object.create(Sprite_Clickable.prototype); Sprite_WindowBackImage.prototype.constructor = Sprite_WindowBackImage; Sprite_WindowBackImage.prototype.initialize = function(bitmap, hoverBitmap) { Sprite_Clickable.prototype.initialize.call(this); this.bitmap = bitmap; this._hoverBitmap = hoverBitmap; this._originalBitmap = bitmap; }; Sprite_WindowBackImage.prototype.refreshPosition = function(parent, origin, offsetX, offsetY) { if (origin === 0) { this.x = 0; this.y = 0; this.anchor.x = 0.0; this.anchor.y = 0.0; } else { this.x = parent.width / 2; this.y = parent.height / 2; this.anchor.x = 0.5; this.anchor.y = 0.5; } this.x += offsetX; this.y += offsetY; }; Sprite_WindowBackImage.prototype.onMouseEnter = function() { if (this._hoverBitmap) { this.bitmap = this._hoverBitmap; } }; Sprite_WindowBackImage.prototype.onMouseExit = function() { this.bitmap = this._originalBitmap; }; })();