查看: 4882|回复: 9

[已经解决] 用了fuki对话框,求大神告知姓名框怎么调整成和对话框字...

[复制链接]
梦石
0
星屑
50
在线时间
18 小时
注册时间
2016-3-31
回帖
17
发表于 2016-7-21 10:53:23 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×

求教姓名框如何变成和对话框和谐

点评

和谐是什麼?  发表于 2016-7-21 12:31
梦石
0
星屑
50
在线时间
18 小时
注册时间
2016-3-31
回帖
17
 楼主| 发表于 2016-7-21 17:00:59 | 显示全部楼层
就是一样的大小不这么奇怪
回复

使用道具 举报

梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2016-7-21 18:03:11 | 显示全部楼层
誰知你用了什麼fuki对话框脚本
又誰知你所謂什麼和谐是怎様
Image001.png
Image002.png
Image003.png
Image004.png
Image005.png

点评

夭寿啦~大哥能不能发我!  发表于 2016-7-22 14:38
這是トリアコンタン的MessageWindowPopup.js可指定頭象大小,  发表于 2016-7-21 22:51
啊啊啊,这个小头像是怎么做出了的啊我的都超级大  发表于 2016-7-21 22:44
哎,放弃了,直接输入在对话框里了,咔咔咔,谢谢你  发表于 2016-7-21 22:30
回复

使用道具 举报

梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2016-7-22 16:30:32 | 显示全部楼层
/*:
* @plugindesc Popup window plugin
* @author triacontane
*
* @param FontSize文字大小
* @desc Font size of popup window
* @default 22
*
* @param Padding
* @desc Padding of popup window
* @default 10
*
* @param AutoPopup
* @desc Popup set when event starting(ON/OFF)
* @default ON
*
* @param FaceScale
* @desc Scale of face graphic of popup window(1-100%)
* @default 75(頭象大小)
*
* @param WindowLinkage
* @desc Select window and Number input window is linkage with popup window(ON/OFF)
* @default ON
*
* @param BetweenLines
* @desc Between the Lines
* @default 4
*
* @param ThroughWindow
* @desc Window through if overlap windows(ON/OFF)
* @default OFF
*
* @help Change the message window from fixed to popup
*
* Plugin Command指令
*
* MWP_VALID [Character ID]
*  Popup window valid
*  Player:-1 Current event:0 Event:1...
* ex:MWP_VALID 0
*
* MWP_INVALID
*  Popup window invalid
* ex:MWP_INVALID
*
* MWP_SETTING [parameter]
*  Popup window setting. parameter are...
*   POS_UPPER
*     Window position fixed upper.
*
*  POS_LOWER
*     Window position fixed upper.
*
*  POS_AUTO
*     Window position auto.
*
*   SKIN [File name(/img/system/...)]
*     Setting window skin for popup message.
*
*   SUB_POS_PLAYER
*     Choice window or NumberInput displays player.
*
*   SUB_POS_INNER
*     Choice window or NumberInput displays internal message window.
*
*   SUB_POS_NORMAL
*     Choice window or NumberInput displays normal position.
*
* MWP_ADJUST [parameter]
*   Popup window adjust. parameter are...
*
*   POS [X] [Y]
*     Popup window adjust relative position.
*
*  SIZE [Width] [Height]
*   Popup window adjust relative size.


点击展开/收起
  1. //=============================================================================
  2. // MessageWindowPopup.js
  3. // ----------------------------------------------------------------------------
  4. // Copyright (c) 2015 Triacontane
  5. // This software is released under the MIT License.
  6. // [url]http://opensource.org/licenses/mit-license.php[/url]
  7. // ----------------------------------------------------------------------------
  8. // Version
  9. // 1.3.3 2016/07/02 ポップアップ有効時は選択肢の最大表示数が8になるよう修正
  10. // 1.3.2 2016/06/02 YEP_MessageCore.jsとのウィンドウ位置に関する競合を解消
  11. // 1.3.1 2016/05/25 フォロワーにフキダシを表示できる機能を追加
  12. // 1.3.0 2016/03/21 ウィンドウの表示位置をキャラクターの高さに合わせて自動調整するよう修正
  13. //                  ポップアップウィンドウ専用のウィンドウスキンを使用する機能を追加
  14. //                  位置とサイズを微調整する機能を追加
  15. //                  選択肢と数値入力ウィンドウの表示方法を2種類追加
  16. // 1.2.3 2016/02/23 YEP_MessageCore.jsより上に配置した場合に発生するエラーを修正
  17. //                  (正常に動作しない点はそのままです)
  18. // 1.2.2 2016/02/20 YEP_MessageCore.js最新版に対応
  19. // 1.2.1 2016/02/20 YEP_MessageCore.jsのネームポップをポップアップウィンドウと連動するよう対応
  20. // 1.2.0 2016/02/13 並列処理のイベントが存在するときにポップアップ設定がクリアされてしまう
  21. //                  問題の修正
  22. //                  ウィンドウの表示位置を下に表示できる設定を追加
  23. // 1.1.3 2016/02/04 イベント終了時にポップアップ設定をクリアするよう修正
  24. // 1.1.2 2016/01/31 行間を調整できる機能を追加
  25. // 1.1.1 2016/01/30 選択肢と数値入力ウィンドウをポップアップと連携するよう修正
  26. //                  その他微調整と軽微な表示不良修正
  27. // 1.1.0 2016/01/29 高確率で競合するバグを修正
  28. //                  ポップアップウィンドウがキャラクターの移動に追従するよう修正
  29. //                  顔グラフィックが見切れないよう修正
  30. //                  実行中のイベントをポップアップ対象にできる機能を追加(0を指定)
  31. //                  英語対応
  32. // 1.0.0 2016/01/28 初版
  33. // ----------------------------------------------------------------------------
  34. // [Blog]   : [url]http://triacontane.blogspot.jp/[/url]
  35. // [Twitter]: [url]https://twitter.com/triacontane/[/url]
  36. // [GitHub] : [url]https://github.com/triacontane/[/url]
  37. //=============================================================================

  38. /*:
  39. * @plugindesc Popup window plugin
  40. * @author triacontane
  41. *
  42. * @param FontSize
  43. * @desc Font size of popup window
  44. * @default 22
  45. *
  46. * @param Padding
  47. * @desc Padding of popup window
  48. * @default 10
  49. *
  50. * @param AutoPopup
  51. * @desc Popup set when event starting(ON/OFF)
  52. * @default ON
  53. *
  54. * @param FaceScale
  55. * @desc Scale of face graphic of popup window(1-100%)
  56. * @default 75
  57. *
  58. * @param WindowLinkage
  59. * @desc Select window and Number input window is linkage with popup window(ON/OFF)
  60. * @default ON
  61. *
  62. * @param BetweenLines
  63. * @desc Between the Lines
  64. * @default 4
  65. *
  66. * @param ThroughWindow
  67. * @desc Window through if overlap windows(ON/OFF)
  68. * @default OFF
  69. *
  70. * @help Change the message window from fixed to popup
  71. *
  72. * Plugin Command
  73. *
  74. * MWP_VALID [Character ID]
  75. *  Popup window valid
  76. *  Player:-1 Current event:0 Event:1...
  77. * ex:MWP_VALID 0
  78. *
  79. * MWP_INVALID
  80. *  Popup window invalid
  81. * ex:MWP_INVALID
  82. *
  83. * MWP_SETTING [parameter]
  84. *  Popup window setting. parameter are...
  85. *   POS_UPPER
  86. *     Window position fixed upper.
  87. *
  88. *  POS_LOWER
  89. *     Window position fixed upper.
  90. *
  91. *  POS_AUTO
  92. *     Window position auto.
  93. *
  94. *   SKIN [File name(/img/system/...)]
  95. *     Setting window skin for popup message.
  96. *
  97. *   SUB_POS_PLAYER
  98. *     Choice window or NumberInput displays player.
  99. *
  100. *   SUB_POS_INNER
  101. *     Choice window or NumberInput displays internal message window.
  102. *
  103. *   SUB_POS_NORMAL
  104. *     Choice window or NumberInput displays normal position.
  105. *
  106. * MWP_ADJUST [parameter]
  107. *   Popup window adjust. parameter are...
  108. *
  109. *   POS [X] [Y]
  110. *     Popup window adjust relative position.
  111. *
  112. *  SIZE [Width] [Height]
  113. *   Popup window adjust relative size.
  114. *
  115. * This plugin is released under the MIT License.
  116. */
  117. /*:ja
  118. * @plugindesc フキダシウィンドウプラグイン
  119. * @author トリアコンタン
  120. *
  121. * @param フォントサイズ
  122. * @desc フキダシウィンドウのデフォルトフォントサイズ
  123. * 通常ウィンドウのフォントサイズ:28
  124. * @default 22
  125. *
  126. * @param 余白
  127. * @desc フキダシウィンドウの余白サイズ
  128. * 通常ウィンドウの余白:18
  129. * @default 10
  130. *
  131. * @param 自動設定
  132. * @desc イベント起動時にフキダシの対象が、起動したイベントに自動設定されます。(ON/OFF)
  133. * OFFの場合は通常のメッセージウィンドウに設定されます。
  134. * @default ON
  135. *
  136. * @param フェイス倍率
  137. * @desc フキダシウィンドウの顔グラフィック表示倍率(1-100%)
  138. * @default 75
  139. *
  140. * @param ウィンドウ連携
  141. * @desc 選択肢ウィンドウと数値入力ウィンドウを
  142. * ポップアップウィンドウに連動させます。(ON/OFF)
  143. * @default ON
  144. *
  145. * @param 行間
  146. * @desc 行と行の間のスペースをピクセル単位で設定します。
  147. * @default 4
  148. *
  149. * @param ウィンドウ透過
  150. * @desc ウィンドウが重なったときに透過表示します。(ON/OFF)
  151. * 選択肢をフキダシ内に表示する場合はONにしてください。
  152. * @default OFF
  153. *
  154. * @help メッセージウィンドウを指定したキャラクターの頭上にフキダシで
  155. * 表示するよう変更します。
  156. *
  157. * YEP_MessageCore.jsのネームポップと併せて使用する場合は、
  158. * プラグイン管理画面で当プラグインをYEP_MessageCore.jsより
  159. * 下に配置してください。
  160. *
  161. * プラグインコマンド詳細
  162. *  イベントコマンド「プラグインコマンド」から実行。
  163. *  (パラメータの間は半角スペースで区切る)
  164. *
  165. * MWP_VALID [キャラクターID] or
  166. * フキダシウィンドウ有効化 [キャラクターID]
  167. *  メッセージウィンドウを指定したキャラクターIDの頭上に表示するようにします。
  168. *  プレイヤー : -1 このイベント : 0 指定したIDのイベント : 1 ~
  169. *   フォロワー : -2, -3, -4
  170. *
  171. * 例:MWP_VALID 0
  172. *   フキダシウィンドウ有効化 3
  173. *
  174. * MWP_INVALID or
  175. * フキダシウィンドウ無効化
  176. *  ウィンドウの表示方法を通常に戻します。
  177. *
  178. * 例:MWP_INVALID
  179. *   フキダシウィンドウ無効化
  180. *
  181. * MWP_SETTING [設定内容] or
  182. * フキダシウィンドウ設定 [設定内容]
  183. *  フキダシウィンドウの設定を行います。設定内容に以下を入力。
  184. *
  185. *  POS_UPPER or 位置_上固定
  186. *   ウィンドウの位置をキャラクターの上で固定します。
  187. *
  188. *  POS_LOWER or 位置_下固定
  189. *   ウィンドウの位置をキャラクターの下で固定します。
  190. *
  191. *  POS_AUTO or 位置_自動
  192. *   通常はキャラクターの上に表示し、ウィンドウが上に見切れる場合のみ
  193. *   下に表示します。
  194. *
  195. *   SKIN or スキン [/img/system/以下に配置するスキンのファイル名]
  196. *     フキダシウィンドウ時専用のウィンドウスキンを設定します。
  197. *
  198. *   SUB_POS_PLAYER or サブ位置_プレイヤーの頭上
  199. *    選択肢および数値入力のウィンドウをプレイヤーの頭上に表示します。
  200. *    位置関係次第でウィンドウが被る場合があるので、必要に応じて
  201. *    ウィンドウ透過のパラメータを有効にしてください。
  202. *
  203. *   SUB_POS_INNER or サブ位置_メッセージウィンドウ内部
  204. *     選択肢および数値入力のウィンドウをメッセージウィンドウに含めます。
  205. *     この設定を使用する場合は必ずウィンドウ透過のパラメータを
  206. *     有効にしてください。
  207. *
  208. *   SUB_POS_NORMAL or サブ位置_通常
  209. *    選択肢および数値入力のウィンドウをフキダシウィンドウの下に表示します。
  210. *    特に設定を変更しない場合はこの設定になります。
  211. *
  212. * 例:MWP_SETTING POS_UPPER
  213. *   フキダシウィンドウ設定 位置_自動
  214. *   MWP_SETTING SKIN window2
  215. *   フキダシウィンドウ設定 サブ位置_プレイヤーの頭上
  216. *
  217. * MWP_ADJUST [設定内容] or
  218. * フキダシウィンドウ調整 [設定内容]
  219. *  フキダシウィンドウの表示位置やサイズを微調整します。設定内容に以下を入力。
  220. *
  221. *  POS or 位置 [X座標] [Y座標]
  222. *   ウィンドウのX座標とY座標を調整します。指定するのは元の座標からの相対です。
  223. *
  224. *  SIZE or サイズ [横幅] [高さ]
  225. *   ウィンドウの横幅と高さを調整します。指定するのは元のサイズからの相対です。
  226. *
  227. * 例:MWP_ADJUST POS 5 -3
  228. *   フキダシウィンドウ調整 サイズ 20 -40
  229. *
  230. * 利用規約:
  231. *  作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等)
  232. *  についても制限はありません。
  233. *  このプラグインはもうあなたのものです。
  234. */
  235. (function () {
  236.     'use strict';
  237.     var pluginName = 'MessageWindowPopup';

  238.     var checkTypeFunction = function(value) {
  239.         return checkType(value, 'Function');
  240.     };

  241.     var checkType = function(value, typeName) {
  242.         return Object.prototype.toString.call(value).slice(8, -1) === typeName;
  243.     };

  244.     var getParamNumber = function(paramNames, min, max) {
  245.         var value = getParamOther(paramNames);
  246.         if (arguments.length < 2) min = -Infinity;
  247.         if (arguments.length < 3) max = Infinity;
  248.         return (parseInt(value, 10) || 0).clamp(min, max);
  249.     };

  250.     var getParamBoolean = function(paramNames) {
  251.         var value = getParamOther(paramNames);
  252.         return (value || '').toUpperCase() === 'ON';
  253.     };

  254.     var getParamOther = function(paramNames) {
  255.         if (!Array.isArray(paramNames)) paramNames = [paramNames];
  256.         for (var i = 0; i < paramNames.length; i++) {
  257.             var name = PluginManager.parameters(pluginName)[paramNames[i]];
  258.             if (name) return name;
  259.         }
  260.         return null;
  261.     };

  262.     var getArgNumber = function (arg, min, max) {
  263.         if (arguments.length <= 2) min = -Infinity;
  264.         if (arguments.length <= 3) max = Infinity;
  265.         return (parseInt(convertEscapeCharacters(arg), 10) || 0).clamp(min, max);
  266.     };

  267.     var getArgString = function (arg, upperFlg) {
  268.         arg = convertEscapeCharacters(arg);
  269.         return upperFlg ? arg.toUpperCase() : arg;
  270.     };

  271.     var getCommandName = function (command) {
  272.         return (command || '').toUpperCase();
  273.     };

  274.     var convertEscapeCharacters = function(text) {
  275.         if (text == null) text = '';
  276.         var window = SceneManager._scene._windowLayer.children[0];
  277.         return window ? window.convertEscapeCharacters(text) : text;
  278.     };

  279.     //=============================================================================
  280.     // パラメータのバリデーション
  281.     //=============================================================================
  282.     var paramThroughWindow = getParamBoolean(['ThroughWindow', 'ウィンドウ透過']);
  283.     var paramFaceScale     = getParamNumber(['FaceScale', 'フェイス倍率'], 1, 100);
  284.     var paramFontSize      = getParamNumber(['FontSize', 'フォントサイズ'], 1);
  285.     var paramPadding       = getParamNumber(['Padding', '余白'], 1);
  286.     var paramLinkage       = getParamBoolean(['WindowLinkage', 'ウィンドウ連携']);
  287.     var paramBetweenLines  = getParamNumber(['BetweenLines', '行間'], 0);
  288.     var paramAutoPopup     = getParamBoolean(['AutoPopup', '自動設定']);

  289.     //=============================================================================
  290.     // Game_Interpreter
  291.     //  プラグインコマンドを追加定義します。
  292.     //=============================================================================
  293.     var _Game_Interpreter_pluginCommand      = Game_Interpreter.prototype.pluginCommand;
  294.     Game_Interpreter.prototype.pluginCommand = function (command, args) {
  295.         _Game_Interpreter_pluginCommand.apply(this, arguments);
  296.         try {
  297.             this.pluginCommandMessageWindowPopup(command, args);
  298.         } catch (e) {
  299.             if ($gameTemp.isPlaytest() && Utils.isNwjs()) {
  300.                 var window  = require('nw.gui').Window.get();
  301.                 var devTool = window.showDevTools();
  302.                 devTool.moveTo(0, 0);
  303.                 devTool.resizeTo(Graphics.width, Graphics.height);
  304.                 window.focus();
  305.             }
  306.             console.log('プラグインコマンドの実行中にエラーが発生しました。');
  307.             console.log('- コマンド名  : ' + command);
  308.             console.log('- コマンド引数 : ' + args);
  309.             console.log('- エラー原因   : ' + e.toString());
  310.         }
  311.     };

  312.     Game_Interpreter.prototype.pluginCommandMessageWindowPopup = function (command, args) {
  313.         switch (getCommandName(command)) {
  314.             case 'MWP_VALID' :
  315.             case 'フキダシウィンドウ有効化':
  316.                 var eventId = getArgNumber(args[0]);
  317.                 if (eventId === 0) eventId = this.eventId();
  318.                 $gameSystem.setMessagePopup(eventId);
  319.                 break;
  320.             case 'MWP_INVALID':
  321.             case 'フキダシウィンドウ無効化':
  322.                 $gameSystem.clearMessagePopup();
  323.                 break;
  324.             case 'MWP_SETTING' :
  325.             case 'フキダシウィンドウ設定':
  326.                 switch (getCommandName(args[0])) {
  327.                     case 'POS_UPPER' :
  328.                     case '位置_上固定':
  329.                         $gameSystem.setPopupFixUpper();
  330.                         break;
  331.                     case 'POS_LOWER' :
  332.                     case '位置_下固定':
  333.                         $gameSystem.setPopupFixLower();
  334.                         break;
  335.                     case 'POS_AUTO' :
  336.                     case '位置_自動':
  337.                         $gameSystem.setPopupAuto();
  338.                         break;
  339.                     case 'SKIN' :
  340.                     case 'スキン' :
  341.                         $gameSystem.setPopupWindowSkin(getArgString(args[1]));
  342.                         this.setWaitMode('image');
  343.                         break;
  344.                     case 'SUB_POS_NORMAL' :
  345.                     case 'サブ位置_通常':
  346.                         $gameSystem.setPopupSubWindowPosition(0);
  347.                         break;
  348.                     case 'SUB_POS_PLAYER' :
  349.                     case 'サブ位置_プレイヤーの頭上':
  350.                         $gameSystem.setPopupSubWindowPosition(1);
  351.                         break;
  352.                     case 'SUB_POS_INNER' :
  353.                     case 'サブ位置_メッセージウィンドウ内部':
  354.                         $gameSystem.setPopupSubWindowPosition(2);
  355.                         break;
  356.                 }
  357.                 break;
  358.             case 'MWP_ADJUST':
  359.             case 'フキダシウィンドウ調整':
  360.                 switch (getCommandName(args[0])) {
  361.                     case 'SIZE' :
  362.                     case 'サイズ':
  363.                         $gameSystem.setPopupAdjustSize(getArgNumber(args[1]), getArgNumber(args[2]));
  364.                         break;
  365.                     case 'POS' :
  366.                     case '位置':
  367.                         $gameSystem.setPopupAdjustPosition(getArgNumber(args[1]), getArgNumber(args[2]));
  368.                         break;
  369.                 }
  370.                 break;
  371.         }
  372.     };

  373.     var _Game_Interpreter_terminate = Game_Interpreter.prototype.terminate;
  374.     Game_Interpreter.prototype.terminate = function() {
  375.         _Game_Interpreter_terminate.apply(this, arguments);
  376.         if (this._depth === 0 && this.isGameMapInterpreter()) $gameSystem.clearMessagePopup();
  377.     };

  378.     Game_Interpreter.prototype.setGameMapInterpreter = function() {
  379.         this._gameMapInterpreter = true;
  380.     };

  381.     Game_Interpreter.prototype.isGameMapInterpreter = function() {
  382.         return this._gameMapInterpreter;
  383.     };

  384.     //=============================================================================
  385.     // Game_System
  386.     //  ポップアップフラグを保持します。
  387.     //=============================================================================
  388.     var _Game_System_initialize = Game_System.prototype.initialize;
  389.     Game_System.prototype.initialize = function() {
  390.         _Game_System_initialize.apply(this, arguments);
  391.         this._messagePopupCharacterId       = 0;
  392.         this._messagePopupPosition          = null;
  393.         this._messagePopupAdjustSize        = null;
  394.         this._messagePopupAdjustPosition    = null;
  395.         this._messagePopupWindowSkin        = null;
  396.         this._messagePopupSubWindowPosition = 0;
  397.     };

  398.     Game_System.prototype.setPopupSubWindowPosition = function(position) {
  399.         this._messagePopupSubWindowPosition = position.clamp(0, 2);
  400.     };

  401.     Game_System.prototype.getPopupSubWindowPosition = function() {
  402.         return this._messagePopupSubWindowPosition;
  403.     };

  404.     Game_System.prototype.setPopupWindowSkin = function(fileName) {
  405.         this._messagePopupWindowSkin = fileName;
  406.         ImageManager.loadSystem(fileName);
  407.     };

  408.     Game_System.prototype.getPopupWindowSkin = function() {
  409.         return this._messagePopupWindowSkin;
  410.     };

  411.     Game_System.prototype.setMessagePopup = function(id) {
  412.         this._messagePopupCharacterId = id;
  413.     };

  414.     Game_System.prototype.clearMessagePopup = function() {
  415.         this._messagePopupCharacterId = 0;
  416.     };

  417.     Game_System.prototype.getMessagePopupId = function() {
  418.         return this._messagePopupCharacterId !== 0 ? this._messagePopupCharacterId : null;
  419.     };

  420.     Game_System.prototype.setPopupFixUpper = function() {
  421.         this._messagePopupPosition = 1;
  422.     };

  423.     Game_System.prototype.setPopupFixLower = function() {
  424.         this._messagePopupPosition = 2;
  425.     };

  426.     Game_System.prototype.setPopupAuto = function() {
  427.         this._messagePopupPosition = 0;
  428.     };

  429.     Game_System.prototype.setPopupAdjustSize = function(w, h) {
  430.         this._messagePopupAdjustSize = [w, h];
  431.     };

  432.     Game_System.prototype.getPopupAdjustSize = function() {
  433.         return this._messagePopupAdjustSize;
  434.     };

  435.     Game_System.prototype.setPopupAdjustPosition = function(x, y) {
  436.         this._messagePopupAdjustPosition = [x, y];
  437.     };

  438.     Game_System.prototype.getPopupAdjustPosition = function() {
  439.         return this._messagePopupAdjustPosition;
  440.     };

  441.     Game_System.prototype.isPopupFixUpper = function() {
  442.         return this._messagePopupPosition === 1;
  443.     };

  444.     Game_System.prototype.isPopupFixLower = function() {
  445.         return this._messagePopupPosition === 2;
  446.     };

  447.     //=============================================================================
  448.     // Game_Map
  449.     //  イベント起動時に自動設定を適用します。
  450.     //=============================================================================
  451.     var _Game_Map_setupStartingMapEvent = Game_Map.prototype.setupStartingMapEvent;
  452.     Game_Map.prototype.setupStartingMapEvent = function() {
  453.         var result = _Game_Map_setupStartingMapEvent.apply(this, arguments);
  454.         if (result) {
  455.             if (paramAutoPopup) {
  456.                 $gameSystem.setMessagePopup(this._interpreter.eventId());
  457.             } else {
  458.                 $gameSystem.clearMessagePopup();
  459.             }
  460.         }
  461.         return result;
  462.     };

  463.     var _Game_Map_setup = Game_Map.prototype.setup;
  464.     Game_Map.prototype.setup = function(mapId) {
  465.         _Game_Map_setup.apply(this, arguments);
  466.         this._interpreter.setGameMapInterpreter();
  467.     };

  468.     //=============================================================================
  469.     // Game_Troop
  470.     //  戦闘開始時にポップアップフラグを解除します。
  471.     //=============================================================================
  472.     var _Game_Troop_setup = Game_Troop.prototype.setup;
  473.     Game_Troop.prototype.setup = function(troopId) {
  474.         _Game_Troop_setup.apply(this, arguments);
  475.         $gameSystem.clearMessagePopup();
  476.     };

  477.     //=============================================================================
  478.     // Game_CharacterBase
  479.     //  キャラクターの高さを設定します。
  480.     //=============================================================================
  481.     var _Game_CharacterBase_initMembers = Game_CharacterBase.prototype.initMembers;
  482.     Game_CharacterBase.prototype.initMembers = function() {
  483.         _Game_CharacterBase_initMembers.apply(this, arguments);
  484.         this.setSizeForMessagePopup(0, 0);
  485.     };

  486.     Game_CharacterBase.prototype.setSizeForMessagePopup = function(width, height) {
  487.         this._size = [width, height];
  488.     };

  489.     Game_CharacterBase.prototype.getHeightForPopup = function() {
  490.         return this._size[1];
  491.     };

  492.     //=============================================================================
  493.     // Sprite_Character
  494.     //  キャラクターの高さを逆設定します。
  495.     //=============================================================================
  496.     var _Sprite_Character_updateBitmap = Sprite_Character.prototype.updateBitmap;
  497.     Sprite_Character.prototype.updateBitmap = function() {
  498.         if (this.isImageChanged()) this._imageChange = true;
  499.         _Sprite_Character_updateBitmap.apply(this, arguments);
  500.         if (this._imageChange) {
  501.             this.bitmap.addLoadListener(function() {
  502.                 var width = this.bitmap.width === 1 ? $gameMap.tileWidth() : this.patternWidth();
  503.                 var height = this.bitmap.height === 1 ? $gameMap.tileHeight() : this.patternHeight();
  504.                 this._character.setSizeForMessagePopup(width, height);
  505.             }.bind(this));
  506.             this._imageChange = false;
  507.         }
  508.     };

  509.     //=============================================================================
  510.     // Window_Base
  511.     //  共通処理を定義します。
  512.     //=============================================================================
  513.     var _Window_Base_loadWindowskin = Window_Base.prototype.loadWindowskin;
  514.     Window_Base.prototype.loadWindowskin = function() {
  515.         var popupSkin = $gameSystem.getPopupWindowSkin();
  516.         if (this.isPopup() && popupSkin) {
  517.             this.windowskin = ImageManager.loadSystem(popupSkin);
  518.         } else {
  519.             _Window_Base_loadWindowskin.apply(this, arguments);
  520.         }
  521.     };

  522.     Window_Base.prototype.setPauseSignToTail = function(lowerFlg) {
  523.         if (lowerFlg) {
  524.             this._windowPauseSignSprite.rotation = 180 * Math.PI / 180;
  525.             this._windowPauseSignSprite.y        = 12;
  526.             this._windowPauseSignSprite.anchor.y = 0;
  527.         } else {
  528.             this._windowPauseSignSprite.rotation = 0;
  529.             this._windowPauseSignSprite.y        = this.height + 12;
  530.             this._windowPauseSignSprite.anchor.y = 1;
  531.         }
  532.         this._pauseSingToTail = true;
  533.     };

  534.     Window_Base.prototype.setPauseSignToNormal = function() {
  535.         this._windowPauseSignSprite.rotation = 0;
  536.         this._windowPauseSignSprite.anchor.y = 1.0;
  537.         this._windowPauseSignSprite.move(this._width / 2, this._height);
  538.         this._pauseSingToTail = false;
  539.     };

  540.     var _Window_Base_updatePauseSign = Window_Base.prototype._updatePauseSign;
  541.     Window_Base.prototype._updatePauseSign = function() {
  542.         _Window_Base_updatePauseSign.apply(this, arguments);
  543.         if (this._pauseSingToTail) this._windowPauseSignSprite.alpha = 1.0;
  544.     };

  545.     Window_Base.prototype.isPopupLower = function() {
  546.         return $gameSystem.isPopupFixLower() || (!$gameSystem.isPopupFixUpper() && this.y < 0);
  547.     };

  548.     Window_Base.prototype.setPopupPosition = function(character) {
  549.         var pos = $gameSystem.getPopupAdjustPosition();
  550.         this.x = character.screenX() - this.width / 2 + (pos ? pos[0] : 0);
  551.         this.y = character.screenY() - this.height - (character.getHeightForPopup() + 8) + (pos ? pos[1] : 0);
  552.         var lowerFlg = this.isPopupLower();
  553.         if (lowerFlg) this.y = character.screenY() + 8;
  554.         this.setPauseSignToTail(lowerFlg);
  555.         var deltaX = 0;
  556.         if (this.x < 0) {
  557.             deltaX = this.x;
  558.             this.x = 0;
  559.         }
  560.         if (this.x + this.width > Graphics.boxWidth) {
  561.             deltaX = this.x + this.width - Graphics.boxWidth;
  562.             this.x = Graphics.boxWidth - this.width;
  563.         }
  564.         this._windowPauseSignSprite.x = this._width / 2 + deltaX;
  565.     };

  566.     Window_Base.prototype.updatePlacementPopup = function() {
  567.         if (!this._messageWindow) return;
  568.         if (paramLinkage) {
  569.             switch ($gameSystem.getPopupSubWindowPosition()) {
  570.                 case 0:
  571.                     this.x = this._messageWindow.x;
  572.                     this.y = this._messageWindow.y + this._messageWindow.height;
  573.                     this.setPauseSignToNormal();
  574.                     break;
  575.                 case 1:
  576.                     this.setPopupPosition($gamePlayer);
  577.                     break;
  578.                 case 2:
  579.                     var pos = this._messageWindow.getSubWindowPosition();
  580.                     this.x = pos.x;
  581.                     this.y = pos.y;
  582.                     this.setPauseSignToNormal();
  583.                     this.opacity = 0;
  584.                     break;
  585.             }
  586.         } else {
  587.             this.y = Graphics.boxHeight - this.height - this._messageWindow.windowHeight() / 2;
  588.         }
  589.     };

  590.     Window_Base.prototype.isPopup = function() {
  591.         return false;
  592.     };

  593.     Window_Base.prototype.isPopupLinkage = function() {
  594.         return this.isPopup() && paramLinkage;
  595.     };

  596.     Window_Base.prototype.resetLayout = function() {
  597.         this.padding = this.standardPadding();
  598.         this.width   = this.windowWidth();
  599.         this.height  = this.windowHeight();
  600.         this.loadWindowskin();
  601.         this.setPauseSignToNormal();
  602.     };

  603.     //=============================================================================
  604.     // Window_Message
  605.     //  ポップアップする場合、表示内容により座標とサイズを自動設定します。
  606.     //=============================================================================
  607.     Window_Message._faceHeight = Math.floor(Window_Base._faceHeight * paramFaceScale / 100);
  608.     Window_Message._faceWidth  = Math.floor(Window_Base._faceWidth  * paramFaceScale / 100);

  609.     var _Window_Message_standardFontSize = Window_Message.prototype.standardFontSize;
  610.     Window_Message.prototype.standardFontSize = function() {
  611.         return this.isPopup() ? paramFontSize : _Window_Message_standardFontSize.apply(this, arguments);
  612.     };

  613.     var _Window_Message_standardPadding = Window_Message.prototype.standardPadding;
  614.     Window_Message.prototype.standardPadding = function() {
  615.         return this.isPopup() ? paramPadding : _Window_Message_standardPadding.apply(this, arguments);
  616.     };

  617.     var _Window_Message_calcTextHeight = Window_Message.prototype.calcTextHeight;
  618.     Window_Message.prototype.calcTextHeight = function(textState, all) {
  619.         var height = _Window_Message_calcTextHeight.apply(this, arguments);
  620.         return this.isPopup() ? height - 8 + paramBetweenLines : height;
  621.     };

  622.     var _Window_Message_startMessage = Window_Message.prototype.startMessage;
  623.     Window_Message.prototype.startMessage = function() {
  624.         this.updateTargetCharacterId();
  625.         _Window_Message_startMessage.apply(this, arguments);
  626.         this.loadWindowskin();
  627.         this.resetLayout();
  628.     };

  629.     Window_Message.prototype.updateTargetCharacterId = function() {
  630.         this._targetCharacterId = $gameSystem.getMessagePopupId();
  631.     };

  632.     var _Window_Message_resetFontSettings = Window_Message.prototype.resetFontSettings;
  633.     Window_Message.prototype.resetFontSettings = function() {
  634.         _Window_Message_resetFontSettings.apply(this, arguments);
  635.         if (this.isPopup()) this.contents.fontSize = paramFontSize;
  636.     };

  637.     Window_Message.prototype.getPopupTargetCharacter = function() {
  638.         var id = this._targetCharacterId;
  639.         if (id < -1) {
  640.             return $gamePlayer.followers().follower((id * -1) - 2);
  641.         } else if (id === -1) {
  642.             return $gamePlayer;
  643.         } else if (id > -1) {
  644.             return $gameMap.event(id);
  645.         } else {
  646.             return null;
  647.         }
  648.     };

  649.     Window_Message.prototype.isPopup = function() {
  650.        return !!this.getPopupTargetCharacter();
  651.     };

  652.     var _Window_Message_update = Window_Message.prototype.update;
  653.     Window_Message.prototype.update = function() {
  654.         _Window_Message_update.apply(this, arguments);
  655.         if (this.openness > 0 && this.isPopup()) this.updatePlacementPopup();
  656.     };

  657.     var _Window_Message_updatePlacement = Window_Message.prototype.updatePlacement;
  658.     Window_Message.prototype.updatePlacement = function() {
  659.         if (typeof Yanfly === 'undefined' || !Yanfly.Message) {
  660.             this.x = 0;
  661.         }
  662.         _Window_Message_updatePlacement.apply(this, arguments);
  663.         if (this.isPopup()) this.updatePlacementPopup();
  664.     };

  665.     Window_Message.prototype.isPopupLower = function() {
  666.         return $gameSystem.isPopupFixLower() || (!$gameSystem.isPopupFixUpper() && this.y < 0);
  667.     };

  668.     Window_Message.prototype.updatePlacementPopup = function() {
  669.         this.setPopupPosition(this.getPopupTargetCharacter());
  670.         if (this._choiceWindow && $gameMessage.isChoice()) {
  671.             this._choiceWindow.updatePlacementPopup();
  672.         }
  673.         this._numberWindow.updatePlacementPopup();
  674.         if (this._nameWindow && checkTypeFunction(this._nameWindow.updatePlacementPopup)) {
  675.             this._nameWindow.updatePlacementPopup();
  676.         }
  677.     };

  678.     Window_Message.prototype.resetLayout = function() {
  679.         this.padding = this.standardPadding();
  680.         if (this.getPopupTargetCharacter()) {
  681.             this.processVirtual();
  682.         } else {
  683.             this.width = this.windowWidth();
  684.             this.height = this.windowHeight();
  685.             this.setPauseSignToNormal();
  686.         }
  687.         this.updatePlacement();
  688.         this.updateBackground();
  689.     };

  690.     Window_Message.prototype.processVirtual = function() {
  691.         var virtual = {};
  692.         virtual.index = 0;
  693.         virtual.text = this.convertEscapeCharacters($gameMessage.allText());
  694.         virtual.maxWidth = 0;
  695.         this.newPage(virtual);
  696.         while (!this.isEndOfText(virtual)) {
  697.             this.processVirtualCharacter(virtual);
  698.         }
  699.         virtual.y += virtual.height;
  700.         this._subWindowY = virtual.y;
  701.         var choices = $gameMessage.choices();
  702.         if (choices && $gameSystem.getPopupSubWindowPosition() === 2) {
  703.             virtual.y += choices.length * this._choiceWindow.lineHeight();
  704.             virtual.maxWidth = Math.max(virtual.maxWidth, this.newLineX() + this._choiceWindow.maxChoiceWidth());
  705.         }
  706.         var digit = $gameMessage.numInputMaxDigits();
  707.         if (digit && $gameSystem.getPopupSubWindowPosition() === 2) {
  708.             virtual.y += this._numberWindow.lineHeight();
  709.         }
  710.         var width = virtual.maxWidth + this.padding * 2;
  711.         var height = Math.max(this.getFaceHeight(), virtual.y) + this.padding * 2;
  712.         var adjust = $gameSystem.getPopupAdjustSize();
  713.         if (adjust) {
  714.             width += adjust[0];
  715.             height += adjust[1];
  716.         }
  717.         this.width  = width;
  718.         this.height = height;
  719.     };

  720.     Window_Message.prototype.getSubWindowPosition = function() {
  721.         var pos = new Point();
  722.         pos.x = this.x + this.newLineX();
  723.         pos.y = this.y + this._subWindowY;
  724.         return pos;
  725.     };

  726.     Window_Message.prototype.processVirtualCharacter = function(textState) {
  727.         switch (textState.text[textState.index]) {
  728.             case '\n':
  729.                 this.processNewLine(textState);
  730.                 break;
  731.             case '\f':
  732.                 this.processNewPage(textState);
  733.                 break;
  734.             case '\x1b':
  735.                 this.processVirtualEscapeCharacter(this.obtainEscapeCode(textState), textState);
  736.                 break;
  737.             default:
  738.                 this.processVirtualNormalCharacter(textState);
  739.                 break;
  740.         }
  741.     };

  742.     Window_Message.prototype.processVirtualEscapeCharacter = function(code, textState) {
  743.         switch (code) {
  744.             case 'C':
  745.                 this.changeTextColor(this.textColor(this.obtainEscapeParam(textState)));
  746.                 break;
  747.             case 'I':
  748.                 this.processVirtualDrawIcon(this.obtainEscapeParam(textState), textState);
  749.                 break;
  750.             case '{':
  751.                 this.makeFontBigger();
  752.                 break;
  753.             case '}':
  754.                 this.makeFontSmaller();
  755.                 break;
  756.         }
  757.     };

  758.     Window_Message.prototype.processVirtualNormalCharacter = function(textState) {
  759.         var c = textState.text[textState.index++];
  760.         textState.x += this.textWidth(c);
  761.         textState.maxWidth = Math.max(textState.maxWidth, textState.x);
  762.     };

  763.     Window_Message.prototype.processVirtualDrawIcon = function(iconIndex, textState) {
  764.         textState.x += Window_Base._iconWidth + 4;
  765.         textState.maxWidth = Math.max(textState.maxWidth, textState.x);
  766.     };

  767.     var _Window_Message_newLineX = Window_Message.prototype.newLineX;
  768.     Window_Message.prototype.newLineX = function() {
  769.         if (this.isPopup()) {
  770.             return $gameMessage.faceName() === '' ? 0 : Window_Message._faceWidth + 8;
  771.         } else {
  772.             return _Window_Message_newLineX.apply(this, arguments);
  773.         }
  774.     };

  775.     Window_Message.prototype.getFaceHeight = function() {
  776.         return $gameMessage.faceName() === '' ? 0 : Window_Message._faceHeight;
  777.     };

  778.     var _Window_Message_drawFace = Window_Message.prototype.drawFace;
  779.     Window_Message.prototype.drawFace = function(faceName, faceIndex, x, y, width, height) {
  780.         if (this.isPopup()) {
  781.             width = width || Window_Base._faceWidth;
  782.             height = height || Window_Base._faceHeight;
  783.             var bitmap = ImageManager.loadFace(faceName);
  784.             var pw = Window_Base._faceWidth;
  785.             var ph = Window_Base._faceHeight;
  786.             var sw = Math.min(width, pw);
  787.             var sh = Math.min(height, ph);
  788.             var dx = Math.floor(x + Math.max(width - pw, 0) / 2);
  789.             var dy = Math.floor(y + Math.max(height - ph, 0) / 2);
  790.             var sx = faceIndex % 4 * pw + (pw - sw) / 2;
  791.             var sy = Math.floor(faceIndex / 4) * ph + (ph - sh) / 2;
  792.             this.contents.blt(bitmap, sx, sy, sw, sh, dx, dy, Window_Message._faceWidth, Window_Message._faceHeight);
  793.         } else {
  794.             _Window_Message_drawFace.apply(this, arguments);
  795.         }
  796.     };

  797.     //=============================================================================
  798.     // Window_ChoiceList
  799.     //  ポップアップする場合、メッセージウィンドウに連動して表示位置と余白を調整します。
  800.     //=============================================================================
  801.     var _Window_ChoiceList_standardFontSize = Window_ChoiceList.prototype.standardFontSize;
  802.     Window_ChoiceList.prototype.standardFontSize = function() {
  803.         return this.isPopupLinkage() ? paramFontSize : _Window_ChoiceList_standardFontSize.apply(this, arguments);
  804.     };

  805.     var _Window_ChoiceList_standardPadding = Window_ChoiceList.prototype.standardPadding;
  806.     Window_ChoiceList.prototype.standardPadding = function() {
  807.         return this.isPopupLinkage() ? paramPadding : _Window_ChoiceList_standardPadding.apply(this, arguments);
  808.     };

  809.     var _Window_ChoiceList_lineHeight = Window_ChoiceList.prototype.lineHeight;
  810.     Window_ChoiceList.prototype.lineHeight = function() {
  811.         return this.isPopupLinkage() ? paramFontSize + 8 : _Window_ChoiceList_lineHeight.apply(this, arguments);
  812.     };

  813.     var _Window_ChoiceList_updatePlacement = Window_ChoiceList.prototype.updatePlacement;
  814.     Window_ChoiceList.prototype.updatePlacement = function() {
  815.         this.resetLayout();
  816.         _Window_ChoiceList_updatePlacement.apply(this, arguments);
  817.         if (this.isPopup()) this.updatePlacementPopup();
  818.     };

  819.     var _Window_ChoiceList_refresh = Window_ChoiceList.prototype.refresh;
  820.     Window_ChoiceList.prototype.refresh = function() {
  821.         this.resetLayout();
  822.         _Window_ChoiceList_refresh.apply(this, arguments);
  823.     };

  824.     Window_ChoiceList.prototype.isPopup = function() {
  825.         return this._messageWindow.isPopup();
  826.     };

  827.     var _Window_ChoiceList_numVisibleRows = Window_ChoiceList.prototype.numVisibleRows;
  828.     Window_ChoiceList.prototype.numVisibleRows = function() {
  829.         var result = _Window_ChoiceList_numVisibleRows.apply(this, arguments);
  830.         if (this.isPopupLinkage()) {
  831.             result = Math.min($gameMessage.choices().length, 8);
  832.         }
  833.         return result;
  834.     };

  835.     //=============================================================================
  836.     // Window_NumberInput
  837.     //  ポップアップする場合、メッセージウィンドウに連動して表示位置と余白を調整します。
  838.     //=============================================================================
  839.     var _Window_NumberInput_standardFontSize = Window_NumberInput.prototype.standardFontSize;
  840.     Window_NumberInput.prototype.standardFontSize = function() {
  841.         return this.isPopupLinkage() ? paramFontSize : _Window_NumberInput_standardFontSize.apply(this, arguments);
  842.     };

  843.     var _Window_NumberInput_standardPadding = Window_NumberInput.prototype.standardPadding;
  844.     Window_NumberInput.prototype.standardPadding = function() {
  845.         return this.isPopupLinkage() ? paramPadding : _Window_NumberInput_standardPadding.apply(this, arguments);
  846.     };

  847.     var _Window_NumberInput_lineHeight = Window_NumberInput.prototype.lineHeight;
  848.     Window_NumberInput.prototype.lineHeight = function() {
  849.         return this.isPopupLinkage() ? paramFontSize + 8 : _Window_NumberInput_lineHeight.apply(this, arguments);
  850.     };

  851.     var _Window_NumberInput_updatePlacement = Window_NumberInput.prototype.updatePlacement;
  852.     Window_NumberInput.prototype.updatePlacement = function() {
  853.         this.resetLayout();
  854.         this.opacity = 255;
  855.         _Window_NumberInput_updatePlacement.apply(this, arguments);
  856.         if (this.isPopup()) this.updatePlacementPopup();
  857.     };

  858.     Window_NumberInput.prototype.isPopup = function() {
  859.         return this._messageWindow.isPopup();
  860.     };

  861.     //=============================================================================
  862.     // Window_NameBox
  863.     //  メッセージウィンドウに連動して表示位置と余白を調整します。
  864.     //=============================================================================
  865.     if (typeof Window_NameBox !== 'undefined') {
  866.         var _Window_NameBox_standardFontSize = Window_NameBox.prototype.standardFontSize;
  867.         Window_NameBox.prototype.standardFontSize = function() {
  868.             return this.isPopupLinkage() ? paramFontSize : _Window_NameBox_standardFontSize.apply(this, arguments);
  869.         };

  870.         var _Window_NameBox_standardPadding = Window_NameBox.prototype.standardPadding;
  871.         Window_NameBox.prototype.standardPadding = function() {
  872.             return this.isPopupLinkage() ? paramPadding : _Window_NameBox_standardPadding.apply(this, arguments);
  873.         };

  874.         var _Window_NameBox_lineHeight = Window_NameBox.prototype.lineHeight;
  875.         Window_NameBox.prototype.lineHeight = function() {
  876.             return this.isPopupLinkage() ? paramFontSize + 8 : _Window_NameBox_lineHeight.apply(this, arguments);
  877.         };

  878.         var _Window_NameBox_updatePlacement = Window_NameBox.prototype.updatePlacement;
  879.         Window_NameBox.prototype.updatePlacement = function() {
  880.             this.resetLayout();
  881.             _Window_NameBox_updatePlacement.apply(this, arguments);
  882.             if (this.isPopup()) this.updatePlacementPopup();
  883.         };

  884.         var _Window_NameBox_refresh = Window_NameBox.prototype.refresh;
  885.         Window_NameBox.prototype.refresh = function() {
  886.             this.resetLayout();
  887.             return _Window_NameBox_refresh.apply(this, arguments);
  888.         };

  889.         Window_NameBox.prototype.isPopup = function() {
  890.             return this._parentWindow.isPopup();
  891.         };

  892.         Window_NameBox.prototype.updatePlacementPopup = function() {
  893.             this.x = this._parentWindow.x;
  894.             this.y = this._parentWindow.y - this.height;
  895.         };
  896.     }

  897.     //=============================================================================
  898.     // ウィンドウを透過して重なり合ったときの表示を自然にします。
  899.     //=============================================================================
  900.     if (paramThroughWindow && !WindowLayer.throughWindow) {
  901.         WindowLayer.throughWindow = true;
  902.         //=============================================================================
  903.         //  WindowLayer
  904.         //   描画前に配列を逆転させます。
  905.         //=============================================================================
  906.         var _WindowLayer__renderWebGL = WindowLayer.prototype._renderWebGL;
  907.         WindowLayer.prototype._renderWebGL = function(renderSession) {
  908.             this.children.reverse();
  909.             _WindowLayer__renderWebGL.apply(this, arguments);
  910.             this.children.reverse();
  911.         };

  912.         WindowLayer.prototype._webglMaskWindow = function(renderSession, window) {};
  913.         WindowLayer.prototype._canvasClearWindowRect = function(renderSession, window) {};
  914.     }
  915. })();

复制代码
回复

使用道具 举报

梦石
0
星屑
50
在线时间
18 小时
注册时间
2016-3-31
回帖
17
 楼主| 发表于 2016-7-23 12:52:29 | 显示全部楼层
tseyik 发表于 2016-7-22 16:30
/*:
* @plugindesc Popup window plugin
* @author triacontane

太棒!!!我是你的迷妹!{:2_249:}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部