- //============================================================================= 
- // A1PopupMessage.js 
- //============================================================================= 
- /*: 
-  * @plugindesc 吹き出しメッセージを表示します。 
-  * @author ツクール工房A1(仮) 
-  * 
-  * @help メッセージを吹き出しで表示します。 
-  * ※表示した吹き出しメッセージは 
-  *   プラグインコマンドでクローズするまで表示し続けます。 
-  * 
-  * 必要プラグイン 
-  *   ツクール工房A1(仮)共通スクリプト Ver 1.20 以上 
-  * 
-  * 必要ファイル 
-  *   Window_Popup.png 
-  *   img/system に配置してください。 
-  * 
-  * 併用プラグイン 
-  *   ネームウィンドウ Ver 1.10 以上 
-  * 
-  * データベース「アクター」の「メモ」に記載 
-  *   <顔グラフィック FaceName> 
-  *    顔グラフィックとアクターを紐づけます。 
-  *    FaceName で指定した顔グラフィックファイル全てに同じ表示名を適用します。 
-  *     ※ネームウィンドウと共用です 
-  * 
-  *   <顔グラフィック FaceName,FaceIndex,,FaceIndex,FaceIndex...> 
-  *    顔グラフィックとアクターを紐づけます。 
-  *    FaceName で指定した顔グラフィックファイルの内、続けて列挙する FaceIndex を表示名に適用します。 
-  *     ※ネームウィンドウと共用です 
-  * 
-  *   <歩行グラフィック characterName> 
-  *    歩行グラフィックとアクターを紐づけます。 
-  *    characterName で指定した顔グラフィックファイル全てに同じ表示名を適用します。 
-  * 
-  *   <歩行グラフィック characterName,characterIndex,characterIndex,characterIndex...> 
-  *    歩行グラフィックとアクターを紐づけます。 
-  *    characterName で指定した歩行グラフィックファイルの内、続けて列挙する characterIndex を表示名に適用します。 
-  * 
-  * プラグインコマンド: 
-  *   吹き出しメッセージ on|off 
-  *     吹き出しメッセージの使用状態を切り替えます。 
-  * 
-  *   吹き出しメッセージ eventID 
-  *     続くメッセージを eventID で指定したイベントの吹き出しとして表示します。 
-  * 
-  *   吹き出しクローズ 
-  *     現在表示している吹き出しメッセージを全てクローズします。 
-  * 
-  *   --------------------------------------注-------------------------------------- 
-  *    説明が煩雑になっていますが 
-  *    1キャラにつき顔グラフィックと歩行グラフィックが 
-  *    1ファイルずつになっていると扱いやすいので、おすすめです。 
-  * 
-  *    例:歩行グラフィック登録 アレックス顔 アレックス歩行 
-  *        歩行グラフィック解除 ブライアン顔 
-  *        吹き出しクローズ 顔 キャロル顔 
-  *        吹き出しクローズ 歩行 デイジー歩行 
-  *   ------------------------------------------------------------------------------ 
-  * 
-  *   吹き出しクローズ ID eventID,eventID,eventID... 
-  *     列挙した eventID のイベントに表示されている吹き出しメッセージをクローズします。 
-  * 
-  *   吹き出しクローズ 顔 faceName 
-  *   吹き出しクローズ 顔 [faceName],[faceName]... 
-  *     指定した faceName に紐づいたイベントに表示されている吹き出しメッセージをクローズします。 
-  *     列挙する場合は、faceName 一つ毎に [ ] で囲ってください 
-  * 
-  *   吹き出しクローズ 顔 faceName,faceIndex 
-  *   吹き出しクローズ 顔 faceName,faceIndex,faceIndex,faceIndex... 
-  *     指定した faceName faceIndex に紐づいたイベントに表示されている吹き出しメッセージをクローズします。 
-  *     faceName の後に faceIndex を列挙できます。 
-  * 
-  *   吹き出しクローズ 顔 [faceName,faceIndex],[faceName,faceIndex]... 
-  *   吹き出しクローズ 顔 [faceName,faceIndex,faceIndex,faceIndex...],[faceName,faceIndex,faceIndex,faceIndex...]... 
-  *     [ ] で囲むことで、faceName faceIndex のセットを列挙できます。 
-  * 
-  *   吹き出しクローズ 歩行 characterName 
-  *   吹き出しクローズ 歩行 [characterName],[characterName]... 
-  *     上記「吹き出しクローズ 顔」の歩行グラフィック版です 
-  *     同様の使い方ができます。 
-  * 
-  *   吹き出しクローズ 歩行 characterName,characterIndex 
-  *   吹き出しクローズ 歩行 characterName,characterIndex,characterIndex,characterIndex... 
-  *     上記「吹き出しクローズ 顔」の歩行グラフィック版です 
-  *     同様の使い方ができます。 
-  * 
-  *   吹き出しクローズ 歩行 [characterName,characterIndex],[characterName,characterIndex]... 
-  *   吹き出しクローズ 歩行 [characterName,characterIndex,characterIndex,characterIndex...],[characterName,characterIndex,characterIndex,characterIndex...]... 
-  *     上記「吹き出しクローズ 顔」の歩行グラフィック版です 
-  *     同様の使い方ができます。 
-  * 
-  *   歩行グラフィック登録 FaceName characterName 
-  *    顔グラフィックと歩行グラフィックを紐づけます。 
-  *    FaceName で指定した顔グラフィックファイル全てに、characterNameで指定した歩行グラフィック全てを適用します。 
-  * 
-  *   歩行グラフィック登録 FaceName,FaceIndex characterName,characterIndex 
-  *   歩行グラフィック登録 FaceName,FaceIndex,FaceIndex,FaceIndex... characterName,characterIndex,characterIndex,characterIndex... 
-  *    顔グラフィックと歩行グラフィックを紐づけます。 
-  *    FaceName で指定した顔グラフィックファイルの内、続けて列挙する FaceIndex を 
-  *    characterName で指定した歩行グラフィックファイルの内、続けて列挙する characterIndex に紐づけます。 
-  * 
-  *   歩行グラフィック解除 FaceName 
-  *    「歩行グラフィック登録 FaceName characterName」にて登録した紐づけを解除します。 
-  * 
-  *   歩行グラフィック解除 FaceName,FaceIndex characterName,characterIndex 
-  *   歩行グラフィック解除 FaceName,FaceIndex,FaceIndex,FaceIndex... characterName,characterIndex,characterIndex,characterIndex... 
-  *    顔グラフィックと歩行グラフィックの紐づけを解除します。。 
-  *    FaceName で指定した顔グラフィックファイルの内、続けて列挙する FaceIndex を 
-  *    characterName で指定した歩行グラフィックファイルの内、続けて列挙する characterIndex の紐づけを解除します。 
-  * 
-  * ネームウィンドウ併用時プラグインコマンド: 
-  *   吹き出しクローズ 名前 表示名 
-  *   吹き出しクローズ 名前 表示名,表示名,表示名... 
-  *     指定した 表示名 に紐づいたイベントに表示されている吹き出しメッセージをクローズします。 
-  * 
-  * 「登録用コモンイベント番号」に設定したコモンイベントに 
-  *  上記プラグインコマンドを記載することで、ゲーム起動時に歩行グラフィック登録します。 
-  * 
-  *  データベース「アクター」の「メモ」やプラグインコマンドにて登録していないアクターは 
-  *  データベース「アクター」で設定しているcharacterName characterIndexにてアクターを紐づけます。 
-  * 
-  * @param 歩行登録用コモンイベント番号 
-  * @desc 歩行グラフィック登録用のコモンイベント番号 
-  * デフォルト: 0 
-  * @default 0 
-  * 
-  * @param 表示位置補正[x座標] 
-  * @desc 吹き出しメッセージの x 座標を補正します 
-  * デフォルト: 0 
-  * @default 0 
-  * 
-  * @param 表示位置補正[y座標・上] 
-  * @desc メッセージのウィンドウ位置が「上」の際の y 座標を補正します 
-  * デフォルト: 0 
-  * @default 0 
-  * 
-  * @param 表示位置補正[y座標・下] 
-  * @desc メッセージのウィンドウ位置が「下」の際の y 座標を補正します 
-  * デフォルト: 0 
-  * @default 0 
-  * 
-  * @param ヒレ表示位置補正[x座標] 
-  * @desc 吹き出しメッセージのヒレの x 座標を補正します 
-  * デフォルト: 0 
-  * @default 0 
-  * 
-  * @param ヒレ表示位置補正[y座標・上] 
-  * @desc メッセージのウィンドウ位置が「上」の際のヒレの y 座標を補正します 
-  * デフォルト: 0 
-  * @default 0 
-  * 
-  * @param ヒレ表示位置補正[y座標・下] 
-  * @desc メッセージのウィンドウ位置が「下」の際のヒレの y 座標を補正します 
-  * デフォルト: 0 
-  * @default 0 
-  * 
- */ 
- //============================================================================= 
- // 更新履歴  2020/06/30 Ver1.00 リリース 
- //           2020/06/30 Ver1.01 ネームウィンドウプラグインを導入しないと 
- //                              メッセージが表示される不具合を修正 
- //           2020/07/02 Ver1.02 エスケープ文字の処理に対応 
- //============================================================================= 
- // ■ バージョン定義 
- //============================================================================= 
- $A1PlugInImpoted["吹き出しメッセージ"] = 1.02; 
- //============================================================================= 
- // ■ バージョンチェック 
- //============================================================================= 
- var common = A1Common.VersionCheck("吹き出しメッセージ", 1.20); 
- if (common){ 
- //============================================================================= 
- // ■ プラグイン設定値 
- //============================================================================= 
- A1PlugInParams.PopupWindow = {}; 
- A1PlugInParams.PopupWindow.Parameters = PluginManager.parameters('A1PopupMessage'); 
- A1PlugInParams.PopupWindow.CharRegisterCommonEventID = Number(A1PlugInParams.PopupWindow.Parameters["歩行登録用コモンイベント番号"]) || 0; 
- A1PlugInParams.PopupWindow.RevisionPosX          = Number(A1PlugInParams.PopupWindow.Parameters["表示位置補正[x座標]"]) || 0; 
- A1PlugInParams.PopupWindow.RevisionUpPosY        = Number(A1PlugInParams.PopupWindow.Parameters["表示位置補正[y座標・上]"]) || 0; 
- A1PlugInParams.PopupWindow.RevisionBottomPosY    = Number(A1PlugInParams.PopupWindow.Parameters["表示位置補正[y座標・下]"]) || 0; 
- A1PlugInParams.PopupWindow.RevisionPopPosX       = Number(A1PlugInParams.PopupWindow.Parameters["ヒレ表示位置補正[x座標]"]) || 0; 
- A1PlugInParams.PopupWindow.RevisionPopUpPosY     = Number(A1PlugInParams.PopupWindow.Parameters["ヒレ表示位置補正[y座標・上]"]) || 0; 
- A1PlugInParams.PopupWindow.RevisionPopBottomPosY = Number(A1PlugInParams.PopupWindow.Parameters["ヒレ表示位置補正[y座標・下]"]) || 0; 
- //============================================================================= 
- // ■ グローバル変数定義 
- //============================================================================= 
- var $dataCharLink = null; 
- //============================================================================= 
- // ■ DataCharLink 
- //============================================================================= 
- function DataCharLink() { 
-   this.initialize.apply(this, arguments); 
- }; 
- //============================================================================= 
- // ○ DataCharLink オブジェクト初期化 
- //============================================================================= 
- DataCharLink.prototype.initialize = function() { 
-   this._linkChar    = {}; 
-   this._linkIndex   = -1; 
-   this._removeChar  = []; 
-   this.SearchLinkActor(); 
-   this.SearchLinkRegister("歩行グラフィック登録",   A1PlugInParams.PopupWindow.CharRegisterCommonEventID); 
- }; 
- //============================================================================= 
- // ○ DataCharLink 歩行グラフィックのリンク先を探す [アクター] 
- //============================================================================= 
- DataCharLink.prototype.SearchLinkActor = function() { 
-   for(var i = 1; i < $dataActors.length; i++){ 
-     var face_key = []; 
-     var char_key = []; 
-     var face_note_data = A1Common.ReadNote("顔グラフィック", $dataActors[i].note, TO_INT); 
-     var char_note_data = A1Common.ReadNote("歩行グラフィック", $dataActors[i].note, TO_INT); 
-     if(char_note_data === false){ char_key.push([$dataActors[i].characterName, $dataActors[i].characterIndex]) } 
-     else { char_key = this.CreateKeys([char_note_data]) } 
-     if(face_note_data === false){ face_key.push([$dataActors[i].faceName,      $dataActors[i].faceIndex])      } 
-     else { face_key = this.CreateKeys(face_note_data) } 
-     this.AddLinkFromNote(face_key, char_key); 
-     this.addSearchLinkActor(i, face_key, char_key); 
-   } 
- }; 
- //============================================================================= 
- // ○ DataCharLink 歩行グラフィックのリンク先を探す [アクター・拡張用] 
- //============================================================================= 
- DataCharLink.prototype.addSearchLinkActor = function(i, face_key, char_key) { 
- }; 
- //============================================================================= 
- // ○ DataCharLink キーを作成する 
- //============================================================================= 
- DataCharLink.prototype.CreateKeys = function(note_data, keys = []) { 
-  return A1Common.makeFaceCharKeys(note_data); 
- }; 
- //============================================================================= 
- // ○ DataCharLink 歩行グラフィックのリンク先を探す [レジスター] 
- //============================================================================= 
- DataCharLink.prototype.SearchLinkRegister = function(command_name, commonEventID) { 
-   if(commonEventID === void 0 || commonEventID === 0){ return false } 
-   var commonEvent = $dataCommonEvents[commonEventID]; 
-   var list = commonEvent.list; 
-   for(var i = 0; i < list.length; i++){ 
-     var line = list[i]; 
-     if (line.code !== 356){ continue }; 
-     var params = line.parameters; 
-     var args = params[0].split(" "); 
-     var command = args.shift(); 
-     if (command !== command_name) { continue }; 
-     if(command_name === "歩行グラフィック登録"){ this.AddLinkFromEvent(args[0], args[1]) } 
-     this.addSearchLinkRegister(i, args[0], args[1], command_name); 
-   } 
- }; 
- //============================================================================= 
- // ○ DataCharLink 歩行グラフィックのリンク先を探す [レジスター・拡張用] 
- //============================================================================= 
- DataCharLink.prototype.addSearchLinkRegister = function(i, face_args, char_args, command_name) { 
- }; 
- //============================================================================= 
- // ○ DataCharLink 歩行グラフィックのリンク先を追加する [イベントから] 
- //============================================================================= 
- DataCharLink.prototype.AddLinkFromEvent = function(face_args, char_args) { 
-   var keys = this.CreateFaceAndCharKeys(face_args, char_args); 
-   var face_key = keys[0]; 
-   var char_key = keys[1]; 
-   this.AddLinkFromNote(face_key, char_key); 
- }; 
- //============================================================================= 
- // ○ DataCharLink 歩行グラフィックのリンク先を削除する [イベントから] 
- //============================================================================= 
- DataCharLink.prototype.RemoveLinkFromEvent = function(face_args) { 
-   var face_key = this.CreateKeys(face_args); 
-   this.AddLinkFromNote(face_key, null, true); 
- }; 
- //============================================================================= 
- // ○ DataCharLink 顔グラフィックと歩行グラフィックのキーを作成する 
- //============================================================================= 
- DataCharLink.prototype.CreateFaceAndCharKeys = function(face_args, char_args) { 
-   var result_args = []; 
-   if(Array.isArray(face_args) === false){ A1Common.SplitArgs(face_args, result_args, TO_INT) } 
-   var face_key = this.CreateKeys(result_args.length > 0 ? result_args : face_args); 
-   var result_args = []; 
-   if(Array.isArray(char_args) === false){ A1Common.SplitArgs(char_args, result_args, TO_INT) } 
-   var char_key = this.CreateKeys(result_args.length > 0 ? result_args : char_args); 
-   return [face_key, char_key]; 
- }; 
- //============================================================================= 
- // ○ DataCharLink 歩行グラフィックのリンク先を追加する [メモから] 
- //============================================================================= 
- DataCharLink.prototype.AddLinkFromNote = function(face_key, char_key, remove = false) { 
-   for(var i = 0; i < face_key.length; i++){ 
-     if(remove === false) { this.AddLink(face_key[i], char_key) }; 
-     if(remove === true)  { this.RemoveLink(face_key[i]) }; 
-   } 
- }; 
- //============================================================================= 
- // ○ DataCharLink 歩行グラフィックのリンク先を追加する 
- //============================================================================= 
- DataCharLink.prototype.AddLink = function(face_key, char_key) { 
-   if(this._linkChar[face_key] === void 0){ this._linkChar[face_key] = char_key }; 
- }; 
- //============================================================================= 
- // ○ DataCharLink 歩行グラフィックのリンク先を解除する 
- //============================================================================= 
- DataCharLink.prototype.RemoveLink = function(face_key) { 
-   if(this._linkChar[face_key] !== void 0){ 
-     delete this._linkChar[face_key] 
-     this._removeChar.push(face_key); 
-   } 
- }; 
- //============================================================================= 
- // ○ DataCharLink 歩行グラフィック解除済の顔グラフィックを取得する 
- //============================================================================= 
- DataCharLink.prototype.RemoveChar = function(face_key) { 
-   return this._removeChar; 
- }; 
- //============================================================================= 
- // ○ DataCharLink 歩行グラフィック解除済の顔グラフィックをクリアする 
- //============================================================================= 
- DataCharLink.prototype.clearRemoveChar = function() { 
-   this._removeChar = []; 
- }; 
- //============================================================================= 
- // ○ DataCharLink 歩行グラフィックのリンク名称 
- //============================================================================= 
- DataCharLink.prototype.LinkChar = function(face_key) { 
-   return this._linkChar[face_key]; 
- }; 
- //============================================================================= 
- // ■ Window_PopupMessage 
- //============================================================================= 
- function Window_PopupMessage() { 
-   this.initialize.apply(this, arguments); 
- }; 
- //============================================================================= 
- // ○ Window_PopupMessage 継承元設定 
- //============================================================================= 
- Window_PopupMessage.prototype = Object.create(Window_Base.prototype); 
- Window_PopupMessage.prototype.constructor = Window_PopupMessage; 
- //============================================================================= 
- // ○ Window_PopupMessage オブジェクト初期化 
- //============================================================================= 
- Window_PopupMessage.prototype.initialize = function(LinkEvent, messageWindow) { 
-   this._messageWindow = messageWindow; 
-   this._linkEvent   = LinkEvent; 
-   this._windowWidth = Graphics.boxWidth; 
-   this.createPopupSplite(); 
-   var x      = this.windowX(); 
-   var y      = this.windowY(); 
-   var width  = this.windowWidth(); 
-   var height = this.windowHeight(); 
-   Window_Base.prototype.initialize.call(this, x, y, width, height); 
-   this._positionType = 2; 
-   this._popupType    = 0; 
-   this.move(x, y, 0, height); 
-   this.openness = 0; 
-   this.setupPopupSplite(); 
- }; 
- //============================================================================= 
- // ○ Window_PopupMessage 吹き出しのヒレをセットアップ 
- //============================================================================= 
- Window_PopupMessage.prototype.setupPopupSplite = function() { 
-   var key = [this._positionType === 0 ? 0 : 1, 0]; 
-   this._popupSplite = new Sprite(this._popupBitmap[key]); 
-   this.addChild(this._popupSplite); 
- }; 
- //============================================================================= 
- // ○ Window_PopupMessage 吹き出しのヒレを作成 
- //============================================================================= 
- Window_PopupMessage.prototype.createPopupSplite = function() { 
-   this._popupSplite = null; 
-   this._popupBitmap = {}; 
-   this.createBltBitmap(0 , 0); 
-   this.createBltBitmap(1 , 0); 
-   this.createBltBitmap(0 , 1); 
-   this.createBltBitmap(1 , 1); 
- }; 
- //============================================================================= 
- // ○ Window_PopupMessage 吹き出しのヒレ用Bitmapを作成 
- //============================================================================= 
- Window_PopupMessage.prototype.createBltBitmap = function(positionType, popupType) { 
-   var key = [positionType, popupType]; 
-   var tempBitmap         = ImageManager.loadSystem('Window_Popup'); 
-   var bitmapWidth        = tempBitmap.width  / 2; 
-   var bitmapHeight       = tempBitmap.height / 2; 
-   this._popupBitmap[key] = new Bitmap(bitmapWidth, bitmapHeight); 
-   var x = positionType === 0 ? 0 : bitmapWidth; 
-   var y = popupType    === 0 ? 0 : bitmapHeight; 
-   this._popupBitmap[key].blt(tempBitmap, x, y, bitmapWidth, bitmapHeight, 0, 0); 
- }; 
- //============================================================================= 
- // ○ Window_PopupMessage ウィンドウの幅 
- //============================================================================= 
- Window_PopupMessage.prototype.windowWidth = function() { 
-   return this._windowWidth; 
- }; 
- //============================================================================= 
- // ○ Window_PopupMessage ウィンドウの幅を設定 
- //============================================================================= 
- Window_PopupMessage.prototype.setWindowWidth = function(value) { 
-   this._windowWidth = value + 144 + this.standardPadding() * 4; 
- }; 
- //============================================================================= 
- // ○ Window_PopupMessage ウィンドウの高さ 
- //============================================================================= 
- Window_PopupMessage.prototype.windowHeight = function() { 
-   return this.fittingHeight(4); 
- }; 
- //============================================================================= 
- // ○ Window_PopupMessage ポップアップタイプの設定 
- //============================================================================= 
- Window_PopupMessage.prototype.setPopupType = function(value) { 
-   this._popupType = value; 
- }; 
- //============================================================================= 
- // ○ Window_PopupMessage フレーム更新 
- //============================================================================= 
- Window_PopupMessage.prototype.update = function() { 
-   Window_Base.prototype.update.call(this); 
-   var x = this.windowX(); 
-   var y = this.windowY(); 
-   this.opacity = this._linkEvent.opacity(); 
-   this.contentsOpacity = this.opacity; 
-   this.move(x, y, this.windowWidth(), this.windowHeight()); 
-   this.movePopupSplite(); 
- }; 
- //============================================================================= 
- // ○ Window_PopupMessage ウィンドウのx座標 
- //============================================================================= 
- Window_PopupMessage.prototype.windowX = function() { 
-   var x = this._linkEvent.screenX() - 96 + A1PlugInParams.PopupWindow.RevisionPosX; 
-   var moveX = 0; 
-   if(x + this.width > Graphics.boxWidth){ 
-     moveX = x - (Graphics.boxWidth - this.width); 
-     x -= moveX; 
-   } 
-   if(x < 0){ 
-     moveX = x; 
-     x = 0; 
-   } 
-   if(this._popupSplite) { this._popupSplite.x = 96 + moveX + A1PlugInParams.PopupWindow.RevisionPopPosX } 
-   return x; 
- }; 
- //============================================================================= 
- // ○ Window_PopupMessage ウィンドウのy座標 
- //============================================================================= 
- Window_PopupMessage.prototype.windowY = function() { 
-   var y; 
-   if(this._positionType === 0) { y = this._linkEvent.screenY() - this.height - 80 + A1PlugInParams.PopupWindow.RevisionUpPosY} 
-   if(this._positionType > 0)   { y = this._linkEvent.screenY() + 32  + A1PlugInParams.PopupWindow.RevisionBottomPosY} 
-   return y; 
- }; 
- //============================================================================= 
- // ○ Window_PopupMessage ウィンドウの位置タイプ設定 
- //============================================================================= 
- Window_PopupMessage.prototype.setPositionType = function(value) { 
-   var key = [value === 0 ? 0 : 1, this._popupType]; 
-   this._popupSplite.bitmap = this._popupBitmap[key]; 
-   this._positionType = value; 
- }; 
- //============================================================================= 
- // ○ Window_PopupMessage ヒレの移動 
- //============================================================================= 
- Window_PopupMessage.prototype.movePopupSplite = function() { 
-   if(this._positionType === 0) { this._popupSplite.y = this.height - 4 + A1PlugInParams.PopupWindow.RevisionPopUpPosY} 
-   if(this._positionType > 0)   { this._popupSplite.y = 0 - this._popupSplite.height + 4 + A1PlugInParams.PopupWindow.RevisionPopBottomPosY} 
-   this._popupSplite.opacity = Math.min(this.opacity, this.openness); 
- }; 
- //============================================================================= 
- // ○ Window_PopupMessage 顔グラフィックの描画 
- //============================================================================= 
- Window_PopupMessage.prototype.drawMessageFace = function() { 
-   this.drawFace($gameMessage.faceName(), $gameMessage.faceIndex(), 0, 0); 
-   ImageManager.releaseReservation(this._imageReservationId); 
- }; 
- //============================================================================= 
- // ○ Window_PopupMessage 内容のクリア 
- //============================================================================= 
- Window_PopupMessage.prototype.clear = function() { 
-   this.contents.clear(); 
- }; 
- //============================================================================= 
- // ○ Window_PopupMessage エスケープ文字の処理 
- //============================================================================= 
- Window_PopupMessage.prototype.processEscapeCharacter = function(code, textState) { 
-   this._messageWindow.processEscapeCharacter(code, textState); 
- }; 
- //============================================================================= 
- // ■ function(_global) 
- //============================================================================= 
- (function(_global) { 
- //============================================================================= 
- // ☆ DataManager ゲームオブジェクトの作成 
- //============================================================================= 
- var A1PopupMessageDM_createGameObjects = DataManager.createGameObjects; 
- DataManager.createGameObjects = function() { 
-   var ret = A1PopupMessageDM_createGameObjects.apply(this); 
-   if($dataCharLink === null){ $dataCharLink = new DataCharLink() } 
-   return ret; 
- }; 
- //============================================================================= 
- // ○ Window_Message エスケープ文字の変換 
- //============================================================================= 
- Window_Message.prototype.convertEscapeCharacters = function(text) { 
-   text = Window_Base.prototype.convertEscapeCharacters.call(this, text); 
-   var kp_exp = /\x1bKP/gi; 
-   var popupType = (text.match(kp_exp) || []).length > 0 ? 1 : 0 
-   text = text.replace(kp_exp, this.setPopupType(popupType)); 
-   return text; 
- }; 
- //============================================================================= 
- // ○ Window_Base ポップアップタイプの設定 
- //============================================================================= 
- Window_Message.prototype.setPopupType = function(value) { 
-   this._popupType = value; 
-   return ""; 
- }; 
- //============================================================================= 
- // ☆ Window_Message メンバ変数の初期化 
- //============================================================================= 
- var A1PopupMessageWM_initMembers = Window_Message.prototype.initMembers; 
- Window_Message.prototype.initMembers = function() { 
-   this._popupWindows = {}; 
-   this._linkEvent    = {}; 
-   this._linkFaceName = {}; 
-   this._linkEventID = null; 
-   var ret = A1PopupMessageWM_initMembers.apply(this); 
-   return ret; 
- }; 
- //============================================================================= 
- // ☆ Window_Message メッセージの開始 
- //============================================================================= 
- var A1PopupMessageWM_startMessage = Window_Message.prototype.startMessage; 
- Window_Message.prototype.startMessage = function() { 
-   this._linkEventID = null; 
-   this._popupType   = 0; 
-   this.SearchLinkEvent(); 
-   var ret = A1PopupMessageWM_startMessage.apply(this); 
-   return ret; 
- }; 
- //============================================================================= 
- // ☆ Window_Message 新しいメッセージの作成 
- //============================================================================= 
- var A1PopupMessageWM_newPage = Window_Message.prototype.newPage; 
- Window_Message.prototype.newPage = function(textState) { 
-   if(this._linkEventID && $gameSystem.usePopupMessage() === true){ 
-     this._popupWindows[this._linkEventID].clear(); 
-     this.setPopupWidth(this._linkEventID); 
-   } 
-   var ret = A1PopupMessageWM_newPage.apply(this, arguments); 
-   return ret; 
- }; 
- //============================================================================= 
- // ○ Window_Message 吹き出しメッセージウィンドウ幅の設定 
- //============================================================================= 
- Window_Message.prototype.setPopupWidth = function(LinkEventID) { 
-   var fontFace  = this.contents.fontFace 
-   var fontSize  = this.contents.fontSize 
-   var textWidth = A1Common.CalcTextWidthInEscape(this._textState.text, fontFace, fontSize); 
-   this._popupWindows[LinkEventID].setWindowWidth(textWidth); 
-   this._popupWindows[LinkEventID].setPopupType(this._popupType); 
- }; 
- //============================================================================= 
- // ☆ Window_Message 表示位置の更新 
- //============================================================================= 
- var A1PopupMessageWM_updatePlacement = Window_Message.prototype.updatePlacement; 
- Window_Message.prototype.updatePlacement = function() { 
-   var ret = A1PopupMessageWM_updatePlacement.apply(this); 
-   if(this._linkEventID && $gameSystem.usePopupMessage() === true){ 
-     this.setPopupWindow(this._linkEventID) 
-   } 
- }; 
- //============================================================================= 
- // ○ Window_Message 吹き出しメッセージウィンドウの設定 
- //============================================================================= 
- Window_Message.prototype.setPopupWindow = function(LinkEventID) { 
-   this._popupWindows[LinkEventID].setPositionType(this._positionType); 
-   this._popupWindows[LinkEventID].open(); 
- }; 
- //============================================================================= 
- // ☆ Window_Message 顔グラフィックの描画 
- //============================================================================= 
- var A1PopupMessageWM_drawMessageFace = Window_Message.prototype.drawMessageFace; 
- Window_Message.prototype.drawMessageFace = function() { 
-   var ret = A1PopupMessageWM_drawMessageFace.apply(this); 
-   if(this._linkEventID && $gameSystem.usePopupMessage() === true){ 
-     this._popupWindows[this._linkEventID].drawMessageFace(); 
-   } 
-   return ret; 
- }; 
- //============================================================================= 
- // ○ Window_Message リンクするイベントの検索 
- //============================================================================= 
- Window_Message.prototype.SearchLinkEvent = function() { 
-   var ret; 
-   var LinkEvent = this.FaceLinkEvent(); 
-   if(LinkEvent && $gameSystem.usePopupMessage() === true){ 
-     this.openness = 0; 
-     this.ShowPopupMessage(LinkEvent); 
-     return true; 
-   } 
-   return false; 
- }; 
- //============================================================================= 
- // ○ Window_Message 吹き出しメッセージの表示 
- //============================================================================= 
- Window_Message.prototype.ShowPopupMessage = function(LinkEvent) { 
-   this.CreatePopupMessage(LinkEvent) 
- }; 
- //============================================================================= 
- // ○ Window_Message 吹き出しメッセージの作成 
- //============================================================================= 
- Window_Message.prototype.CreatePopupMessage = function(LinkEvent) { 
-   var LinkEventID = LinkEvent === $gamePlayer ? -1 : LinkEvent.eventId(); 
-   this._linkEventID = LinkEventID; 
-   if((LinkEventID in this._popupWindows) === false){ 
-     this._popupWindows[LinkEventID] = new Window_PopupMessage(LinkEvent, this); 
-     SceneManager.sceneAddWindow(this._popupWindows[LinkEventID]); 
-   } 
- }; 
- //============================================================================= 
- // ○ Window_Message 文字の処理 
- //============================================================================= 
- Window_Message.prototype.processCharacter = function(textState) { 
-   if(this._linkEventID  && $gameSystem.usePopupMessage() === true){ 
-     this._popupWindows[this._linkEventID].processCharacter(textState) 
-   } 
-   else { 
-     Window_Base.prototype.processCharacter.call(this, textState) 
-   } 
- }; 
- //============================================================================= 
- // ○ Window_Message 顔グラフィックとリンクしている歩行イベントの取得 
- //============================================================================= 
- Window_Message.prototype.FaceLinkEvent = function() { 
-   var ret; 
-   var TempEventID = $gameTemp.tempPopupID(); 
-   if(TempEventID){ 
-     ret = $gameMap.event(TempEventID); 
-     $gameTemp.setTempPopupID(null); 
-   } 
-   else { 
-     var events = $gameMap.events(); 
-     var key  = [$gameMessage.faceName()]; 
-     var char = $dataCharLink.LinkChar(key); 
-     if(char === void 0){ 
-       var key = [$gameMessage.faceName(), $gameMessage.faceIndex()]; 
-       char = $dataCharLink.LinkChar(key); 
-         } 
-     if(char === void 0){ return false }; 
-     ret = this.LinkEventSearch($gamePlayer, char, key); 
-     if(ret){ return ret } 
-     for(var i = 0; i < events.length; i++){ 
-       ret = this.LinkEventSearch(events[i], char, key); 
-       if(ret){ break } 
-         } 
-   } 
-   return ret; 
- }; 
- //============================================================================= 
- // ○ Window_Message 顔グラフィックとリンクしている歩行イベントの検索 
- //============================================================================= 
- Window_Message.prototype.LinkEventSearch = function(event, char, key) { 
-   var ret; 
-   var event_key = [event.characterName(), event.characterIndex()]; 
-   var result = char.find(item => JSON.stringify(item) === JSON.stringify(event_key)); 
-   if(result !== void 0){ 
-     ret = event; 
-     var eventID = event === $gamePlayer ? -1 : ret.eventId(); 
-     this._linkEvent[eventID] = key; 
-   } 
-   return ret; 
- }; 
- //============================================================================= 
- // ☆ Window_Message ウィンドウのオープン 
- //============================================================================= 
- var A1PopupMessageWM_open = Window_Message.prototype.open; 
- Window_Message.prototype.open = function() { 
-   if(this._linkEventID){ return false } 
-   var ret = A1PopupMessageWM_open.apply(this, arguments); 
-   return ret; 
- }; 
- //============================================================================= 
- // ☆ Window_Message メッセージの終端 
- //============================================================================= 
- var A1PopupMessageWM_terminateMessage = Window_Message.prototype.terminateMessage; 
- Window_Message.prototype.terminateMessage = function() { 
-   for(key in this._popupWindows){ this._popupWindows[key].pause = false } 
-   var ret = A1PopupMessageWM_terminateMessage.apply(this); 
-   return ret; 
- }; 
- //============================================================================= 
- // ☆ Window_Message 一時停止 
- //============================================================================= 
- var A1PopupMessageWM_startPause = Window_Message.prototype.startPause; 
- Window_Message.prototype.startPause = function() { 
-   var ret = A1PopupMessageWM_startPause.apply(this, arguments); 
-   if(this._linkEventID){ this._popupWindows[this._linkEventID].pause = true } 
-   return ret; 
- }; 
- //============================================================================= 
- // ○ Window_Message 吹き出しメッセージの強制クローズ 
- //============================================================================= 
- Window_Message.prototype.forceClosePopup = function() { 
-   for(key in this._popupWindows){ this._popupWindows[key].close() } 
-   $gameSystem.setUsePopupMessage(null); 
- }; 
- //============================================================================= 
- // ○ Window_Message 吹き出しメッセージのクローズ 
- //============================================================================= 
- Window_Message.prototype.closePopup = function(id, remove = false) { 
-   if(id in this._popupWindows){ this._popupWindows[id].close() } 
- }; 
- //============================================================================= 
- // ○ Window_Message 吹き出しメッセージのクローズ [ID指定] 
- //============================================================================= 
- Window_Message.prototype.closePopupID = function() { 
-   var list = $gameTemp.closePopupID(); 
-   for(var i = 0; i < list.length; i++){ this.closePopup(list[i]) } 
-   $gameTemp.setClosePopupID(null); 
- }; 
- //============================================================================= 
- // ○ Window_Message 吹き出しメッセージのクローズ [ALL] 
- //============================================================================= 
- Window_Message.prototype.closePopupAll = function() { 
-   for(var id in this._popupWindows){ this._popupWindows[id].close() } 
-   $gameTemp.setClosePopupAll(null); 
- }; 
- //============================================================================= 
- // ○ Window_Message 吹き出しメッセージのクローズ [歩行グラフィック指定] 
- //============================================================================= 
- Window_Message.prototype.closePopupChar = function() { 
-   var list = A1Common.makeFaceCharKeys($gameTemp.closePopupChar()) 
-   var events = $gameMap.events(); 
-   for(var i = 0; i < list.length; i++){ 
-     var info = list[i]; 
-     var key = info.length === 1 ? [info[0]] : [info[0], info[1]]; 
-     for(var j = -1; j < events.length; j++){ 
-       var event   = j === -1 ? $gamePlayer : events[j]; 
-       var eventID = j === -1 ? -1 : events[j].eventId();  
-       if(event.characterName() !== key[0]){ continue } 
-       if(key.length === 1 || key[1] === event.characterIndex()){ this.closePopup(eventID) } 
-         } 
-   } 
-   $gameTemp.setClosePopupChar(null); 
- }; 
- //============================================================================= 
- // ○ Window_Message 吹き出しメッセージのクローズ [顔グラフィック指定] 
- //============================================================================= 
- Window_Message.prototype.closePopupFace = function() { 
-   this.closePopupForFace(A1Common.makeFaceCharKeys($gameTemp.closePopupFace())); 
-   $gameTemp.setClosePopupFace(null); 
- }; 
- //============================================================================= 
- // ○ Window_Message 吹き出しメッセージのクローズ [歩行リンク解除] 
- //============================================================================= 
- Window_Message.prototype.closePopupRemoveFace = function() { 
-   this.closePopupForFace(A1Common.makeFaceCharKeys($dataCharLink.RemoveChar()), true); 
-   $dataCharLink.clearRemoveChar(); 
- }; 
- //============================================================================= 
- // ○ Window_Message 吹き出しメッセージのクローズ [顔グラフィック指定] 
- //============================================================================= 
- Window_Message.prototype.closePopupForFace = function(list, remove = false) { 
-   for(var i = 0; i < list.length; i++){ 
-     var info = list[i]; 
-     var key = info.length === 1 ? [info[0]] : [info[0], info[1]]; 
-     for(eventID in this._linkEvent){ 
-       if(JSON.stringify(this._linkEvent[eventID]) === JSON.stringify(key)){ this.closePopup(eventID, remove) } 
-     } 
-   } 
- }; 
- //============================================================================= 
- // ☆ Window_Message フレーム更新 
- //============================================================================= 
- var A1PopupMessageWM_update = Window_Message.prototype.update; 
- Window_Message.prototype.update = function() { 
-   if($gameSystem.usePopupMessage() === false){ this.forceClosePopup() } 
-   if($gameTemp.closePopupID().length > 0)  { this.closePopupID() } 
-   if($gameTemp.closePopupChar().length > 0){ this.closePopupChar() } 
-   if($gameTemp.closePopupFace().length > 0){ this.closePopupFace() } 
-   if($dataCharLink.RemoveChar().length > 0){ this.closePopupRemoveFace() } 
-   if($gameTemp.closePopupAll() === true)   { this.closePopupAll() } 
-   var ret = A1PopupMessageWM_update.apply(this); 
-   return ret; 
- }; 
- //============================================================================= 
- // ☆ Scene_Boot システムイメージのロード 
- //============================================================================= 
- var A1PopupMessageSB_loadSystemImages = Scene_Boot.loadSystemImages; 
- Scene_Boot.loadSystemImages = function() { 
-   var ret = A1PopupMessageSB_loadSystemImages.apply(this); 
-   ImageManager.reserveSystem('Window_Popup'); 
-   return ret; 
- }; 
- //============================================================================= 
- // ☆ Game_Temp オブジェクト初期化 
- //============================================================================= 
- var A1_PopupMessageGT_initialize = Game_Temp.prototype.initialize; 
- Game_Temp.prototype.initialize = function() { 
-   var ret = A1_PopupMessageGT_initialize.apply(this); 
-   this._tempPopupID    = null; 
-   this._closePopupID   = []; 
-   this._closePopupChar = []; 
-   this._closePopupFace = []; 
-   this._closePopupName = []; 
-   this._closePopupAll  = null; 
-   return ret; 
- }; 
- //============================================================================= 
- // ○ Game_Temp 吹き出しメッセージ全クローズの取得 
- //============================================================================= 
- Game_Temp.prototype.closePopupAll = function(value) { 
-   return this._closePopupAll; 
- }; 
- //============================================================================= 
- // ○ Game_Temp 吹き出しメッセージ全クローズの設定 
- //============================================================================= 
- Game_Temp.prototype.setClosePopupAll = function(value) { 
-   this._closePopupAll = value; 
- }; 
- //============================================================================= 
- // ○ Game_Temp 吹き出しメッセージクローズイベントの取得 
- //============================================================================= 
- Game_Temp.prototype.closePopupID = function() { 
-   return this._closePopupID; 
- }; 
- //============================================================================= 
- // ○ Game_Temp 吹き出しメッセージクローズイベントの設定 
- //============================================================================= 
- Game_Temp.prototype.setClosePopupID = function(value) { 
-   this.addClosePopup(value, this._closePopupID); 
- }; 
- //============================================================================= 
- // ○ Game_Temp 吹き出しメッセージクローズ歩行グラフィックの取得 
- //============================================================================= 
- Game_Temp.prototype.closePopupChar = function() { 
-   return this._closePopupChar; 
- }; 
- //============================================================================= 
- // ○ Game_Temp 吹き出しメッセージクローズ歩行グラフィックの設定 
- //============================================================================= 
- Game_Temp.prototype.setClosePopupChar = function(value) { 
-   this.addClosePopup(value, this._closePopupChar); 
- }; 
- //============================================================================= 
- // ○ Game_Temp 吹き出しメッセージクローズ顔グラフィックの取得 
- //============================================================================= 
- Game_Temp.prototype.closePopupFace = function() { 
-   return this._closePopupFace; 
- }; 
- //============================================================================= 
- // ○ Game_Temp 吹き出しメッセージクローズ顔グラフィックの設定 
- //============================================================================= 
- Game_Temp.prototype.setClosePopupFace = function(value) { 
-   this.addClosePopup(value, this._closePopupFace); 
- }; 
- //============================================================================= 
- // ○ Game_Temp 吹き出しメッセージクローズの追加 
- //============================================================================= 
- Game_Temp.prototype.addClosePopup = function(value, target) { 
-   if(value === null){ 
-     target.splice(0); 
-   } 
-   else if(Array.isArray(value) === true){ 
-     for(var i = 0; i < value.length; i++){ target.push(value[i]) } 
-   } 
-   else{ 
-     target.push(value); 
-   } 
- }; 
- //============================================================================= 
- // ○ Game_Temp 吹き出しメッセージ一時表示イベントの取得 
- //============================================================================= 
- Game_Temp.prototype.tempPopupID = function() { 
-   return this._tempPopupID; 
- }; 
- //============================================================================= 
- // ○ Game_Temp 吹き出しメッセージ一時表示イベントの設定 
- //============================================================================= 
- Game_Temp.prototype.setTempPopupID = function(value) { 
-   this._tempPopupID = value; 
- }; 
- //============================================================================= 
- // ☆ Game_System オブジェクト初期化 
- //============================================================================= 
- var A1_PopupMessageGS_initialize = Game_System.prototype.initialize; 
- Game_System.prototype.initialize = function() { 
-   var ret = A1_PopupMessageGS_initialize.apply(this); 
-   this._usePopupMessage   = null; 
-   return ret; 
- }; 
- //============================================================================= 
- // ○ Game_System 吹き出しメッセージ使用状態の取得 
- //============================================================================= 
- Game_System.prototype.usePopupMessage = function() { 
-   return this._usePopupMessage; 
- }; 
- //============================================================================= 
- // ○ Game_System 吹き出しメッセージ使用状態の設定 
- //============================================================================= 
- Game_System.prototype.setUsePopupMessage = function(value) { 
-   this._usePopupMessage = value; 
- }; 
- //============================================================================= 
- // ☆ A1Common プラグインコマンドの定義 
- //============================================================================= 
- var A1_PopupMessage_define_command = A1Common.prototype.define_command; 
- A1Common.prototype.define_command = function() { 
-   var command = A1_PopupMessage_define_command.apply(this); 
-   command["吹き出しメッセージ"] = Game_Interpreter.A1_PopupMessage.bind(this); 
-   command["吹き出しクローズ"]   = Game_Interpreter.A1_ClosePopupMessage.bind(this); 
-   command["歩行グラフィック登録"]   = Game_Interpreter.A1_RegisterCharLink.bind(this); 
-   command["歩行グラフィック解除"]   = Game_Interpreter.A1_RemoveCharLink.bind(this); 
-   return command; 
- }; 
- //============================================================================= 
- // ○ Game_Interpreter プラグインコマンド [吹き出しメッセージ] 
- //============================================================================= 
- Game_Interpreter.A1_PopupMessage = function(args) { 
-   if     (args[0] === "on" )    { $gameSystem.setUsePopupMessage(true)  } 
-   else if(args[0] === "off")    { $gameSystem.setUsePopupMessage(false) } 
-   else{ $gameTemp.setTempPopupID(parseInt(args[0])) } 
-   return true; 
- }; 
- //============================================================================= 
- // ○ Game_Interpreter プラグインコマンド [吹き出しクローズ] 
- //============================================================================= 
- Game_Interpreter.A1_ClosePopupMessage = function(args) { 
-   if     (args[0] === "ID" )  { $gameTemp.setClosePopupID(parseInt(args[1]))  } 
-   else if(args[0] === "歩行") { $gameTemp.setClosePopupChar(args[1]) } 
-   else if(args[0] === "顔")   { $gameTemp.setClosePopupFace(args[1]) } 
-   else { $gameTemp.setClosePopupAll(true) } 
-   return true; 
- }; 
- //============================================================================= 
- // ○ Game_Interpreter プラグインコマンド [歩行グラフィック登録] 
- //============================================================================= 
- Game_Interpreter.A1_RegisterCharLink = function(args) { 
-   $dataCharLink.AddLinkFromEvent(args[0], args[1]); 
-   return true; 
- }; 
- //============================================================================= 
- // ○ Game_Interpreter プラグインコマンド [歩行グラフィック解除] 
- //============================================================================= 
- Game_Interpreter.A1_RemoveCharLink = function(args) { 
-   $dataCharLink.RemoveLinkFromEvent(args[0]); 
-   return true; 
- }; 
- //============================================================================= 
- // ■ ネームウィンドウ使用時の処理 
- //============================================================================= 
- var nameWindow = null; 
- if($A1PlugInImpoted["ネームウィンドウ"]){ 
-   nameWindow = A1Common.VersionCheck("吹き出しメッセージ", 1.10, "ネームウィンドウ"); 
- } 
- if(nameWindow){ 
- //============================================================================= 
- // ☆ Window_FaceName オブジェクト初期化 
- //============================================================================= 
- var A1PopupMessageWithNameWindowWFN_initialize = Window_FaceName.prototype.initialize; 
- Window_FaceName.prototype.initialize = function(FaceName, x, y) { 
-   var ret = A1PopupMessageWithNameWindowWFN_initialize.apply(this, arguments); 
-   this._parentWindow = null; 
-   return ret; 
- }; 
- //============================================================================= 
- // ○ Window_FaceName フレーム更新 
- //============================================================================= 
- var A1PopupMessageWithNameWindowWFN_update = Window_FaceName.prototype.update; 
- Window_FaceName.prototype.update = function() { 
-   var ret = A1PopupMessageWithNameWindowWFN_update.apply(this); 
-   this._splite.opacity = Math.min(this.openness, this.opacity); 
-   return ret; 
- }; 
- //============================================================================= 
- // ○ Window_FaceName 親ウインドウの設定 
- //============================================================================= 
- Window_FaceName.prototype.setParentWindow = function(window) { 
-   this._parentWindow = window; 
- }; 
- //============================================================================= 
- // ○ Window_FaceName 親ウインドウの取得 
- //============================================================================= 
- Window_FaceName.prototype.parentWindow = function() { 
-   return this._parentWindow; 
- }; 
- //============================================================================= 
- // ☆ Window_PopupMessage オブジェクト初期化 
- //============================================================================= 
- var A1PopupMessageWithNameWindowWPM_initialize = Window_PopupMessage.prototype.initialize; 
- Window_PopupMessage.prototype.initialize = function(LinkEvent) { 
-   var ret = A1PopupMessageWithNameWindowWPM_initialize.apply(this, arguments); 
-   this._linkNameWindow = null; 
-   return ret; 
- }; 
- //============================================================================= 
- // ○ Window_PopupMessage リンクするネームウィンドウの取得 
- //============================================================================= 
- Window_PopupMessage.prototype.linkNameWindow = function() { 
-   return this._linkNameWindow; 
- }; 
- //============================================================================= 
- // ○ Window_PopupMessage リンクするネームウィンドウの設定 
- //============================================================================= 
- Window_PopupMessage.prototype.setLinkNameWindow = function(window) { 
-   this._linkNameWindow = window; 
-   if(window){ 
-     window.setParentWindow(this); 
-     SceneManager.sceneForwardWindow(this, window); 
-   } 
- }; 
- //============================================================================= 
- // ☆ Window_PopupMessage フレーム更新 
- //============================================================================= 
- var A1PopupMessageWithNameWindowWPM_update = Window_PopupMessage.prototype.update; 
- Window_PopupMessage.prototype.update = function() { 
-   var ret = A1PopupMessageWithNameWindowWPM_update.apply(this); 
-   this.moveNameWindow(); 
-   return ret; 
- }; 
- //============================================================================= 
- // ○ Window_PopupMessage ウィンドウのオープン 
- //============================================================================= 
- Window_PopupMessage.prototype.open = function() { 
-   Window_Base.prototype.open.call(this); 
-   if($gameSystem.usePopupMessage() !== true){ return false } 
-   var window = this._linkNameWindow; 
-   if(window && $gameSystem.ShowNameWindow() === true){ window.open() }; 
- }; 
- //============================================================================= 
- // ○ Window_PopupMessage ウィンドウのクローズ 
- //============================================================================= 
- Window_PopupMessage.prototype.close = function() { 
-   Window_Base.prototype.close.call(this); 
-   if($gameSystem.usePopupMessage() !== true){ return false } 
-   var window = this._linkNameWindow; 
-   if(window && $gameSystem.ShowNameWindow() === true){ window.close() }; 
- }; 
- //============================================================================= 
- // ○ Window_PopupMessage ネームウィンドウの移動 
- //============================================================================= 
- Window_PopupMessage.prototype.moveNameWindow = function() { 
-   if($gameSystem.usePopupMessage() !== true){ return false } 
-   var x = this.nameWindowX(); 
-   var y = this.nameWindowY(); 
-   var window = this._linkNameWindow; 
-   if(window){ 
-     window.move(x, y, window.windowWidth(), window.windowHeight()) 
-     window.opacity = this.opacity; 
-   } 
- }; 
- //============================================================================= 
- // ○ Window_PopupMessage ネームウィンドウのx座標 
- //============================================================================= 
- Window_PopupMessage.prototype.nameWindowX = function() { 
-   return this.x + 72; 
- }; 
- //============================================================================= 
- // ○ Window_PopupMessage ネームウィンドウのy座標 
- //============================================================================= 
- Window_PopupMessage.prototype.nameWindowY = function() { 
-   var y; 
-   if(this._positionType > 0)  { y = this.y + this.height - this.lineHeight() / 2} 
-   if(this._positionType === 0){ y = this.y - this.lineHeight() / 2} 
-   return y; 
- }; 
- //============================================================================= 
- // ☆ Window_Message 吹き出しメッセージの作成 
- //============================================================================= 
- var A1PopupMessageWithNameWindowWM_CreatePopupMessage = Window_Message.prototype.CreatePopupMessage; 
- Window_Message.prototype.CreatePopupMessage = function(LinkEvent) { 
-   var ret = A1PopupMessageWithNameWindowWM_CreatePopupMessage.apply(this, arguments); 
-   return ret; 
- }; 
- //============================================================================= 
- // ☆ Window_Message 顔グラフィックとリンクしている名前の検索 
- //============================================================================= 
- var A1PopupMessageWithNameWindowWM_FindLinkName = Window_Message.prototype.FindLinkName; 
- Window_Message.prototype.FindLinkName = function(key) { 
-   var ret = A1PopupMessageWithNameWindowWM_FindLinkName.apply(this, arguments); 
-   if(ret !== void 0){ this._linkFaceName[key] = ret } 
-   return ret; 
- }; 
- //============================================================================= 
- // ☆ Window_Message 吹き出しメッセージウィンドウの設定 
- //============================================================================= 
- var A1PopupMessageWithNameWindowWPM_setPopupWindow = Window_Message.prototype.setPopupWindow; 
- Window_Message.prototype.setPopupWindow = function(LinkEventID) { 
-   if($gameSystem.usePopupMessage() === true){ 
-     var eventKey = this._linkEvent[LinkEventID]; 
-     var LinkName = this._linkFaceName[eventKey]; 
-     this._popupWindows[LinkEventID].setLinkNameWindow(this._nameWindow[LinkName]); 
-   } 
-   var ret = A1PopupMessageWithNameWindowWPM_setPopupWindow.apply(this, arguments); 
-   return ret; 
- }; 
- //============================================================================= 
- // ☆ Window_Message ネームウィンドウの移動 
- //============================================================================= 
- var A1PopupMessageWithNameWindowWPM_moveNameWindow = Window_Message.prototype.moveNameWindow; 
- Window_Message.prototype.moveNameWindow = function(window, key) { 
-   if(window.parentWindow()){ return false } 
-   var ret = A1PopupMessageWithNameWindowWPM_moveNameWindow.apply(this, arguments); 
-   return ret; 
- }; 
- //============================================================================= 
- // ☆ Window_Message ネームウィンドウのオープン 
- //============================================================================= 
- var A1PopupMessageWithNameWindowWM_OpenNameWindow = Window_Message.prototype.OpenNameWindow; 
- Window_Message.prototype.OpenNameWindow = function() { 
-   if($gameSystem.usePopupMessage() !== true){ 
-     return A1PopupMessageWithNameWindowWM_OpenNameWindow.apply(this); 
-   } 
-   if($gameSystem.ShowNameWindow() === false){ return false } 
-   for(var key in this._nameWindow){ 
-     if(this._nameWindow[key].parentWindow()) { continue } 
-     this._nameWindow[key].open(); 
-   }; 
- }; 
- //============================================================================= 
- // ☆ Window_Message ネームウィンドウのクローズ 
- //============================================================================= 
- var A1PopupMessageWithNameWindowWM_CloseNameWindow = Window_Message.prototype.CloseNameWindow; 
- Window_Message.prototype.CloseNameWindow = function() { 
-   if($gameSystem.usePopupMessage() !== true){ 
-     return A1PopupMessageWithNameWindowWM_CloseNameWindow.apply(this); 
-   } 
-   for(var key in this._nameWindow){ 
-     if(this._nameWindow[key].parentWindow()){ continue } 
-     this._nameWindow[key].close(); 
-   } 
- }; 
- //============================================================================= 
- // ☆ Window_Message ネームウィンドウの表示 
- //============================================================================= 
- var A1PopupMessageWithNameWindowWM_ShowNameWindow = Window_Message.prototype.ShowNameWindow; 
- Window_Message.prototype.ShowNameWindow = function(LinkName) { 
-   if($gameSystem.usePopupMessage() !== true){ 
-     return A1PopupMessageWithNameWindowWM_ShowNameWindow.apply(this, arguments); 
-   } 
-   for(var key in this._nameWindow){ 
-     if(this._nameWindow[key].parentWindow()){ continue } 
-     this._nameWindow[key].visible = false; 
-   } 
-   if(LinkName in this._nameWindow){ this._nameWindow[LinkName].visible = true  } 
-   else{ this.CreateNameWindow(LinkName) } 
- }; 
- //============================================================================= 
- // ☆ Window_Message 吹き出しメッセージの強制クローズ 
- //============================================================================= 
- var A1PopupMessageWithNameWindowWM_forceClosePopup = Window_Message.prototype.forceClosePopup; 
- Window_Message.prototype.forceClosePopup = function() { 
-   for(var key in this._popupWindows){ this._popupWindows[key].setLinkNameWindow(null) } 
-   for(var key in this._nameWindow)  { 
-     this._nameWindow[key].setParentWindow(null); 
-     this._nameWindow[key].openness = 0; 
-   } 
-   var ret = A1PopupMessageWithNameWindowWM_forceClosePopup.apply(this); 
-   return ret; 
- }; 
- //============================================================================= 
- // ☆ Window_Message フレーム更新 
- //============================================================================= 
- var A1PopupMessageWithNameWindowWM_update = Window_Message.prototype.update; 
- Window_Message.prototype.update = function() { 
-   var ret = A1PopupMessageWithNameWindowWM_update.apply(this); 
-   if($gameTemp.closePopupName().length > 0){ this.closePopupName() } 
-   return ret; 
- }; 
- //============================================================================= 
- // ○ Window_Message 吹き出しメッセージのクローズ [名前指定] 
- //============================================================================= 
- Window_Message.prototype.closePopupName = function() { 
-   var list = $gameTemp.closePopupName(); 
-   for(var i = 0; i < list.length; i++){ 
-     var linkFace = this._linkFaceName; 
-     for(var key in linkFace){ 
-       if(linkFace[key] !== list[i]){ continue } 
-       var linkEvent = this._linkEvent; 
-       for(eventID in linkEvent){ 
-         var result = A1Common.SplitArgs(key, [], TO_INT); 
-         if(JSON.stringify(linkEvent[eventID]) === JSON.stringify(result[0])){ this.closePopup(eventID) } 
-       } 
-         } 
-   } 
-   $gameTemp.setClosePopupName(null); 
- }; 
- //============================================================================= 
- // ☆ Window_Message 吹き出しメッセージのクローズ 
- //============================================================================= 
- var A1PopupMessageWithNameWindowWM_closePopup = Window_Message.prototype.closePopup; 
- Window_Message.prototype.closePopup = function(id, remove = false) { 
-   if(remove === true){ 
-     var popupWindow = this._popupWindows[id]; 
-     if(popupWindow){ 
-       var nameWindow = popupWindow.linkNameWindow(); 
-       if(nameWindow){ 
-         nameWindow.setParentWindow(null); 
-           nameWindow.openness = 0; 
-       } 
-       popupWindow.setLinkNameWindow(null); 
-     } 
-   } 
-   var ret = A1PopupMessageWithNameWindowWM_closePopup.apply(this, arguments); 
-   return ret; 
- }; 
- //============================================================================= 
- // ○ Game_Temp 吹き出しメッセージクローズ名称の取得 
- //============================================================================= 
- Game_Temp.prototype.closePopupName = function() { 
-   return this._closePopupName; 
- }; 
- //============================================================================= 
- // ○ Game_Temp 吹き出しメッセージクローズ名称の設定 
- //============================================================================= 
- Game_Temp.prototype.setClosePopupName = function(value) { 
-   this.addClosePopup(value, this._closePopupName); 
- }; 
- //============================================================================= 
- // ☆ Game_Interpreter プラグインコマンド [吹き出しクローズ] 
- //============================================================================= 
- var A1PopupMessageWithNameWindowGI_A1_ClosePopupMessage = Game_Interpreter.A1_ClosePopupMessage; 
- Game_Interpreter.A1_ClosePopupMessage = function(args) { 
-   var ret = A1PopupMessageWithNameWindowGI_A1_ClosePopupMessage.apply(this, arguments); 
-   if(args[0] === "名前") { $gameTemp.setClosePopupName(args[1]) } 
-   return ret; 
- }; 
- //============================================================================= 
- // ■ ネームウィンドウ使用時の処理 ここまで 
- //============================================================================= 
- } 
- })(this); 
- }