设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 3338|回复: 13
打印 上一主题 下一主题

[有事请教] 图标按钮插件的坐标和点击触发范围的问题

[复制链接]

Lv5.捕梦者

梦石
0
星屑
20538
在线时间
123 小时
注册时间
2019-5-18
帖子
68
跳转到指定楼层
1
发表于 2021-9-9 03:12:16 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
1000星屑
本帖最后由 xuhao1996 于 2021-9-11 01:49 编辑

论坛今天图片附件都上传不了什么情况
今天汉化一个插件碰见

一个插件图标按钮插件
生成图标按钮的时候
坐标改了没有用
貌似是x坐标和y坐标 代码读取位置不对吧





更新图标的
x坐标y坐标可以改变位置了
但是它
点击图标触发范围又变大了





原版插件的问题,用原版插件,新工程都用数字没有用汉字,还是出现同样的问题




应该这段代码的问题,
x.y.坐标返回的问题


            if (!freeCoordinates) {
                let x = 0;
                let y = 0;
                switch(location) {
                case 'rightBottom':
                    x = Graphics.width  - (iconWidth  + iconMarginLeft + iconMarginRight);
                    y = Graphics.height - (iconHeight + iconMarginTop  + iconMarginBottom);
                    break;
                case 'leftBottom':
                    x = iconMarginLeft + iconMarginRight;
                    y = Graphics.height - (iconHeight + iconMarginTop  + iconMarginBottom);
                    break;
                case 'rightTop':
                    x = iconMarginLeft + iconMarginRight;
                    y = iconMarginTop  + iconMarginBottom;
                    break;
                case 'leftTop':
                    x = Graphics.width - (iconWidth  + iconMarginLeft + iconMarginRight);
                    y = iconMarginTop  + iconMarginBottom;
                    break;
                default:
                    break;
                }

                return { x: x, y: y };
            } else {
                return { x: _x, y: _y };
            }
        }

最佳答案

Lv4.逐梦者

梦石
0
星屑
5616
在线时间
176 小时
注册时间
2011-6-3
帖子
32
2
发表于 2021-9-9 03:12:17 | 只看该作者
本帖最后由 lqi991 于 2021-10-2 13:56 编辑
  1. 'use strict';
  2. /* global PIXI   */
  3. /* global Bitmap */
  4. /* global PluginManager  */
  5. /* global ImageManager   */
  6. /* global SceneManager   */
  7. /* global Graphics       */
  8. /* global Scene_Map      */
  9. /* global Sprite         */
  10. /* global TouchInput     */
  11. /* global $gameTemp      */
  12. /* global Window_Message */
  13. //=============================================================================
  14. // IconButton.js
  15. //=============================================================================



  16. /*:
  17. ja
  18. * @target MZ
  19. * @plugindesc 自定义图标按钮插件。
  20. * @author BananaPepperTK
  21. *
  22. * @help 使用使用自定义或者系统图标做成按钮。
  23. *
  24. * 詳細
  25. *   https://github.com/sevenspice/IconButton
  26. *
  27. * @param FreeCoordinates
  28. * @text 自由坐标
  29. * @desc 如何指定图标的位置。 如果为 true,则直接使用命令指定显示位置。 false
  30. * @default true
  31. *
  32. * @param IconSet
  33. * @text 图标集
  34. * @desc 要使用的图标集的表名称。 如果未指定任何内容,则使用默认图标集。
  35. *
  36. * @param IconSize
  37. * @text 图标大小
  38. * @desc 精灵表中图标每边的像素数。
  39. * @default 32
  40. *
  41. * @param IconCount
  42. * @text 图标计数
  43. * @desc 精灵表中图标的行数。
  44. * @default 16
  45. *
  46. * @param IconMarginLeft
  47. * @text 图标左边距
  48. * @desc 图标的左边距。
  49. * @default 10
  50. *
  51. * @param IconMarginRight
  52. * @text 图标右边距
  53. * @desc 图标的右边距
  54. * @default 10
  55. *
  56. * @param IconMarginTop
  57. * @text 图标上边距
  58. * @desc 图标的上边距
  59. * @default 10
  60. *
  61. * @param IconMarginBottom
  62. * @text 图标下边距
  63. * @desc 图标的下边距
  64. * @default 10
  65. *
  66. * @command create
  67. * @text 生成图标按钮
  68. * @desc 生成一个图标按钮。
  69. *
  70. * @arg id
  71. * @type number
  72. * @text 按钮ID
  73. * @desc 标识按钮的 ID 值。
  74. *
  75. * @arg eventId
  76. * @type 公共事件
  77. * @text 公共事件 ID
  78. * @desc 要执行公共事件的 ID。
  79. *
  80. * @arg iconId
  81. * @type number
  82. * @text 图标 ID
  83. * @desc 要显示的图标的 ID。
  84. *
  85. * @arg location
  86. * @type string
  87. * @default
  88. * @text 安置地点
  89. * @desc 将其放置在屏幕四个角的某个位置。 左上角=leftTop |左下角=leftBottom |右上角=rightTop |右下角=rightBottom
  90. *
  91. * @arg x
  92. * @type number
  93. * @default 0
  94. * @text x坐标
  95. * @desc 直接指定x坐标。
  96. *
  97. * @arg y
  98. * @type number
  99. * @default 0
  100. * @text y坐标
  101. * @desc 直接指定y坐标。
  102. *
  103. * @arg scale
  104. * @type number
  105. * @default 1.0
  106. * @text 放大/缩小率
  107. * @desc 要显示的图标的放大/缩小比例。
  108. *
  109. * @arg text
  110. * @type string
  111. * @text 文本
  112. * @desc 显示在图标底部的文本。
  113. *
  114. * @arg fontSize
  115. * @type number
  116. * @default 14
  117. * @text 字体大小
  118. * @desc 显示在图标底部的文本字体大小。
  119. *
  120. * @command show
  121. * @text 展示
  122. * @desc 显示图标。
  123. *
  124. * @arg id
  125. * @type number
  126. * @text 按钮ID
  127. * @desc 标识按钮的 ID 值。
  128. *
  129. * @command update
  130. * @text 更新
  131. * @desc 更新图标。
  132. *
  133. * @arg id
  134. * @type number
  135. * @text 按钮ID
  136. * @desc 标识按钮的 ID 值。
  137. *
  138. * @arg x
  139. * @type number
  140. * @default 0
  141. * @text x坐标
  142. * @desc 直接指定x坐标。
  143. *
  144. * @arg y
  145. * @type number
  146. * @default 0
  147. * @text y坐标
  148. * @desc 直接指定y坐标。
  149. *
  150. * @arg scale
  151. * @type number
  152. * @default 1.0
  153. * @text 放大/缩小率
  154. * @desc 要显示的图标的放大/缩小比例。
  155. *
  156. * @arg text
  157. * @type string
  158. * @text 文本
  159. * @desc 显示在图标底部的文本。
  160. *
  161. * @arg fontSize
  162. * @type number
  163. * @default 14
  164. * @text 字体大小
  165. * @desc 显示在图标底部的文本字体大小。
  166. *
  167. * @command hide
  168. * @text 隐藏
  169. * @desc 隐藏图标。
  170. *
  171. * @arg id
  172. * @type number
  173. * @text 按钮ID
  174. * @desc 标识按钮的 ID 值。
  175. *
  176. */

  177. // グローバル変数を追加する
  178. // このプラグインを有効化すると追加されるため競合に注意すること
  179. window.$gameItemSlot = null;

  180. (function () {
  181.     const pluginName = 'IconButton';
  182.     let iconSet = null;

  183.     // プラグイン初期化
  184.     // コマンドパラメーターの取得
  185.     const parameters = PluginManager.parameters(pluginName);
  186.     let freeCoordinates = parameters['FreeCoordinates'];
  187.     if (freeCoordinates == 'true') freeCoordinates = true;
  188.     else freeCoordinates = false;

  189.     const _iconSet = parameters['IconSet'];
  190.     if (_iconSet) iconSet = ImageManager.loadSystem(_iconSet);
  191.     else iconSet = ImageManager.loadSystem('IconSet');

  192.     const iconSize = parseInt(parameters['IconSize']);
  193.     const baseIconWidth = iconSize;
  194.     const baseIconHeight = iconSize;

  195.     const iconCount = parseInt(parameters['IconCount']);

  196.     const iconMarginLeft = parseInt(parameters['IconMarginLeft']);
  197.     const iconMarginRight = parseInt(parameters['IconMarginRight']);
  198.     const iconMarginTop = parseInt(parameters['IconMarginTop']);
  199.     const iconMarginBottom = parseInt(parameters['IconMarginBottom']);

  200.     let iconButtons = {};
  201.     let iconButtonEnables = {};

  202.     // プラグインで使用する関数群
  203.     /**
  204.      * アイテムのアイコン画像を取得する巻数
  205.      * @param {Bitmap}  iconset    アイコン一覧のスプライト
  206.      * @param {integer} iconIdex   アイコン番号
  207.      * @param {integer} iconWidth  アイコン幅
  208.      * @param {integer} iconHeight アイコン高さ
  209.      * @param {integer} iconCount  スプライトシート横一列の最大アイコン数
  210.      * @return {Bitmap} アイコンのビットマップを返却
  211.      */
  212.     const getIcon = (iconset, iconIdex, iconWidth, iconHeight, iconCount) => {
  213.         const iconX = (iconIdex % iconCount) * iconWidth;
  214.         const iconY = Math.floor(iconIdex / iconCount) * iconHeight;
  215.         const bitmap = new Bitmap(iconWidth, iconHeight);
  216.         bitmap.blt(iconset, iconX, iconY, iconWidth, iconHeight, 0, 0, iconWidth, iconHeight);
  217.         return bitmap;
  218.     };

  219.     /**
  220.      * アイコンボタンクラス。
  221.      */
  222.     class IconButton {
  223.         constructor(
  224.             _eventId
  225.             , _iconSet
  226.             , _iconIndex
  227.             , _x
  228.             , _y
  229.             , _baseIconWidth
  230.             , _baseIconHeight
  231.             , _iconCount
  232.             , _scale
  233.             , _text
  234.             , _fontSize
  235.             , _location
  236.             , _iconMarginLeft
  237.             , _iconMarginRight
  238.             , _iconMarginTop
  239.             , _iconMarginBottom
  240.             , _freeCoordinates
  241.         ) {
  242.             this.eventId = _eventId;
  243.             this.iconSet = _iconSet;
  244.             this.iconIndex = _iconIndex;

  245.             this.x = _x;
  246.             this.y = _y;

  247.             this.baseIconWidth = _baseIconWidth;
  248.             this.baseIconHeight = _baseIconHeight;
  249.             this.iconCount = _iconCount;

  250.             this.scale = _scale;
  251.             this.originScale = _scale;


  252.             this.width = Math.floor(this.baseIconWidth * this.scale);
  253.             this.height = Math.floor(this.baseIconHeight * this.scale);

  254.             this.iconMarginLeft = _iconMarginLeft;
  255.             this.iconMarginRight = _iconMarginRight;
  256.             this.iconMarginTop = _iconMarginTop;
  257.             this.iconMarginBottom = _iconMarginBottom;

  258.             this.location = _location;
  259.             this.freeCoordinates = _freeCoordinates;

  260.             this.text = _text;
  261.             this.fontSize = _fontSize;
  262.             this.fontStyle = null;

  263.             this.icon = null;
  264.             this.underText = null;
  265.         }

  266.         /**
  267.          * アイコンの表示位置を返却する。
  268.          * @param {integer} _x 直接指定されたx座標
  269.          * @param {integer} _y 直接指定されたy座標
  270.          * @param {string}  location   文字列での位置指定
  271.          * @param {integer} iconWidth  アイコン幅
  272.          * @param {integer} iconHeight アイコン高さ
  273.          * @param {integer} iconMarginLeft   アイコンの左マージン
  274.          * @param {integer} iconMarginRight  アイコンの右マージン
  275.          * @param {integer} iconMarginTop    アイコンの上マージン
  276.          * @param {integer} iconMarginBottom アイコンの下マージン
  277.          * @param {boolean} freeCoordinates  座標直接指定か否か
  278.          * @return {object} アイコンの表示位置を返却。
  279.          */
  280.         static coordinates(
  281.             _x
  282.             , _y
  283.             , location
  284.             , iconWidth
  285.             , iconHeight
  286.             , iconMarginLeft
  287.             , iconMarginRight
  288.             , iconMarginTop
  289.             , iconMarginBottom
  290.             , freeCoordinates
  291.         ) {
  292.             if (!freeCoordinates && location) {
  293.                 let x = 0;
  294.                 let y = 0;
  295.                 switch (location) {
  296.                     case 'rightBottom':
  297.                         x = Graphics.width - (iconWidth + iconMarginLeft + iconMarginRight);
  298.                         y = Graphics.height - (iconHeight + iconMarginTop + iconMarginBottom);
  299.                         break;
  300.                     case 'leftBottom':
  301.                         x = iconMarginLeft + iconMarginRight;
  302.                         y = Graphics.height - (iconHeight + iconMarginTop + iconMarginBottom);
  303.                         break;
  304.                     case 'rightTop':
  305.                         x = iconMarginLeft + iconMarginRight;
  306.                         y = iconMarginTop + iconMarginBottom;
  307.                         break;
  308.                     case 'leftTop':
  309.                         x = Graphics.width - (iconWidth + iconMarginLeft + iconMarginRight);
  310.                         y = iconMarginTop + iconMarginBottom;
  311.                         break;
  312.                     default:
  313.                         break;
  314.                 }

  315.                 return { x: x, y: y };
  316.             } else {
  317.                 return { x: _x, y: _y };
  318.             }
  319.         }

  320.         /**
  321.          * アイコンを描画する。
  322.          * @return {undefined}
  323.          */
  324.         show() {
  325.             if (this.icon != null) SceneManager._scene.removeChild(this.icon);
  326.             if (this.underText != null) SceneManager._scene.removeChild(this.underText);

  327.             // マップ画面でのみ描画
  328.             if (SceneManager._scene instanceof Scene_Map) {
  329.                 let icon = null;
  330.                 let text = null;

  331.                 // 表示するアイコン生成
  332.                 icon = new Sprite();
  333.                 icon.bitmap = getIcon(this.iconSet, this.iconIndex, this.baseIconWidth, this.baseIconHeight, this.iconCount);
  334.                 const iconX = this.x;
  335.                 const iconY = this.y;
  336.                 icon.x = iconX;
  337.                 icon.y = iconY;
  338.                 icon.scale = new PIXI.Point(this.scale, this.scale);

  339.                 // 下部に表示するテキストを生成
  340.                 if (this.text) {
  341.                     this.fontStyle = new PIXI.TextStyle({
  342.                         fill: 'white'
  343.                         , fontWeight: 'bold'
  344.                         , strokeThickness: 4
  345.                         , miterLimit: 15
  346.                         , align: 'center'
  347.                         , fontSize: parseInt(this.fontSize)
  348.                     });

  349.                     text = new PIXI.Text(this.text, this.fontStyle);

  350.                     // テキストの表示位置
  351.                     text.x = iconX + Math.floor(Math.abs(this.width - text.width) / 2);
  352.                     text.y = (iconY + this.height) - (this.iconMarginBottom + this.iconMarginTop);
  353.                 }

  354.                 if (icon != null) this.icon = SceneManager._scene.addChild(icon);
  355.                 if (text != null) this.underText = SceneManager._scene.addChild(text);
  356.             }
  357.         }

  358.         /**
  359.          * アイコンの描画を更新する。
  360.          * @param {double}  scale 拡大・縮小率
  361.          * @param {integer} _x 直接指定するx座標
  362.          * @param {integer} _y 直接指定するy座標
  363.          * @param {string}  text     ボタンに表示する文言
  364.          * @param {integer} fontSize 文言のフォントサイズ
  365.          * @return {undefined}
  366.          */
  367.         update(scale, _x, _y, text, fontSize) {
  368.             this.scale = scale;
  369.             this.text = text;
  370.             this.fontSize = fontSize;

  371.             this.width = Math.floor(this.baseIconWidth * this.scale);
  372.             this.height = Math.floor(this.baseIconHeight * this.scale);
  373.             // 表示位置の計算
  374.             const { x, y } = IconButton.coordinates(
  375.                 _x
  376.                 , _y
  377.                 , this.location
  378.                 , this.width
  379.                 , this.height
  380.                 , this.iconMarginLeft
  381.                 , this.iconMarginRight
  382.                 , this.iconMarginTop
  383.                 , this.iconMarginBottom
  384.                 , this.freeCoordinates
  385.             );

  386.             // 表示位置の更新
  387.             this.x = x;
  388.             this.y = y;

  389.             // 描画
  390.             this.show();
  391.         }

  392.         /**
  393.          * アイコンを消す。
  394.          * @return {undefined}
  395.          */
  396.         hide() {
  397.             if (this.icon != null) SceneManager._scene.removeChild(this.icon);
  398.             if (this.underText != null) SceneManager._scene.removeChild(this.underText);
  399.         }
  400.     }

  401.     // ------------------------------------
  402.     // 以下はプラグインコマンド実行処理群
  403.     // ------------------------------------
  404.     /**
  405.      * アイコンボタンの生成
  406.      */
  407.     PluginManager.registerCommand(pluginName, 'create', function (args) {
  408.         for (let n in args) { if (args[n] != '' && !isNaN(args[n])) { args[n] = Number(args[n]) } };
  409.         const id = args.id;
  410.         if (!iconButtons[id]) {
  411.             const eventId = args.eventId;
  412.             const iconId = args.iconId;
  413.             const location = args.location;
  414.             const text = args.text;
  415.             const fontSize = args.fontSize;
  416.             const scale = args.scale;
  417.             const iconWidth = Math.floor(baseIconWidth * scale);
  418.             const iconHeight = Math.floor(baseIconHeight * scale);

  419.             const { x, y } = IconButton.coordinates(
  420.                 args.x
  421.                 , args.y
  422.                 , location
  423.                 , iconWidth
  424.                 , iconHeight
  425.                 , iconMarginLeft
  426.                 , iconMarginRight
  427.                 , iconMarginTop
  428.                 , iconMarginBottom
  429.             );
  430.             iconButtons[id] = {
  431.                 button: new IconButton(
  432.                     eventId
  433.                     , iconSet
  434.                     , iconId
  435.                     , x
  436.                     , y
  437.                     , baseIconWidth
  438.                     , baseIconHeight
  439.                     , iconCount
  440.                     , scale
  441.                     , text
  442.                     , fontSize
  443.                     , location
  444.                     , iconMarginLeft
  445.                     , iconMarginRight
  446.                     , iconMarginTop
  447.                     , iconMarginBottom
  448.                     , freeCoordinates
  449.                 )
  450.             };
  451.             
  452.             iconButtons[id].button.show();
  453.             iconButtonEnables[id] = true;
  454.         }
  455.     });

  456.     /**
  457.      * アイコンボタン表示
  458.      */
  459.     PluginManager.registerCommand(pluginName, 'show', function (args) {
  460.         const id = args.id;
  461.         const button = iconButtons[id].button;
  462.         if (button) {
  463.             button.show();
  464.             iconButtonEnables[id] = true;
  465.         }
  466.     });

  467.     /**
  468.      * アイコンボタン更新
  469.      */
  470.     PluginManager.registerCommand(pluginName, 'update', function (args) {
  471.         for (let n in args) { if (args[n] != '' && !isNaN(args[n])) { args[n] = Number(args[n]) } };
  472.         const id = args.id;
  473.         const x = args.x;
  474.         const y = args.y;
  475.         const scale = args.scale;
  476.         const text = args.text;
  477.         const fontSize = args.fontSize;
  478.         const button = iconButtons[id].button;
  479.         if (button) {
  480.             button.update(scale, x,y, text, fontSize);
  481.             iconButtonEnables[id] = true;
  482.         }
  483.     });

  484.     /**
  485.      * アイコンボタン非表示
  486.      */
  487.     PluginManager.registerCommand(pluginName, 'hide', function (args) {
  488.         const id = args.id;
  489.         const button = iconButtons[id].button;
  490.         if (button) {
  491.             button.hide();
  492.             iconButtonEnables[id] = false;
  493.         }
  494.     });

  495.     // -------------------------------------------
  496.     // 以下はツクールMZにある機能を改造する処理群
  497.     // -------------------------------------------
  498.     /**
  499.      * シーン更新時の挙動を改造する
  500.      * 入力判定系の処理を追加する
  501.      */
  502.     const _SceneManager_updateMain = SceneManager.updateMain;
  503.     SceneManager.updateMain = function () {
  504.         _SceneManager_updateMain.apply(this, arguments);
  505.         const keys = Object.keys(iconButtons);
  506.         const clickX = TouchInput.x;
  507.         const clickY = TouchInput.y;
  508.         if (SceneManager._scene instanceof Scene_Map && TouchInput.isTriggered()) {
  509.             for (let i = 0; i < keys.length; i++) {
  510.                 const id = keys[i];
  511.                 const button = iconButtons[id].button;

  512.                 if (
  513.                     button
  514.                     && iconButtonEnables[id]
  515.                     && (clickX >= button.x && clickX <= (button.x + button.width))
  516.                     && (clickY >= button.y && clickY <= (button.y + button.height))
  517.                 ) {
  518.                     // ボタンを押された表現
  519.                     button.originScale = button.scale;
  520.                     const scale = button.scale * 0.90;
  521.                     button.update(scale, button.x, button.y, button.text, button.fontSize);

  522.                     // コモンイベント呼び出し
  523.                     $gameTemp.reserveCommonEvent(button.eventId);
  524.                 }
  525.             }
  526.         } else if (SceneManager._scene instanceof Scene_Map && TouchInput.isReleased()) {
  527.             for (let i = 0; i < keys.length; i++) {
  528.                 const id = keys[i];
  529.                 const button = iconButtons[id].button;

  530.                 if (
  531.                     button
  532.                     && iconButtonEnables[id]
  533.                     && (clickX >= button.x && clickX <= (button.x + button.width))
  534.                     && (clickY >= button.y && clickY <= (button.y + button.height))
  535.                 ) {
  536.                     // ボタンを押された表現
  537.                     const scale = button.originScale;
  538.                     button.update(scale, button.x, button.y, button.text, button.fontSize);
  539.                 }
  540.             }
  541.         }
  542.     };

  543.     /**
  544.      * マップをタッチされた際の挙動を改造する
  545.      * アイコンをクリックされた場合は移動させない
  546.      */
  547.     const _Scene_Map_prototype_onMapTouch = Scene_Map.prototype.onMapTouch;
  548.     Scene_Map.prototype.onMapTouch = function () {
  549.         const keys = Object.keys(iconButtons);
  550.         let canMove = true;
  551.         if (SceneManager._scene instanceof Scene_Map) {
  552.             const clickX = TouchInput.x;
  553.             const clickY = TouchInput.y;
  554.             for (let i = 0; i < keys.length; i++) {
  555.                 const id = keys[i];
  556.                 const button = iconButtons[id].button;

  557.                 if (
  558.                     button
  559.                     && iconButtonEnables[id]
  560.                     && (clickX >= button.x && clickX <= (button.x + button.width))
  561.                     && (clickY >= button.y && clickY <= (button.y + button.height))
  562.                 ) {
  563.                     canMove = false;
  564.                 }
  565.             }
  566.         }

  567.         if (canMove) return _Scene_Map_prototype_onMapTouch.apply(this, arguments);
  568.     };

  569.     /**
  570.      * マップシーン開始時の挙動を改造する。
  571.      * マップシーン開始時にアイテムスロットも更新する。
  572.      */
  573.     const _Scene_Map_prototype_start = Scene_Map.prototype.start;
  574.     Scene_Map.prototype.start = function () {
  575.         _Scene_Map_prototype_start.apply(this, arguments);
  576.         const keys = Object.keys(iconButtons);

  577.         if (SceneManager._scene instanceof Scene_Map) {
  578.             for (let i = 0; i < keys.length; i++) {
  579.                 const id = keys[i];
  580.                 const button = iconButtons[id].button;

  581.                 if (
  582.                     button
  583.                     && iconButtonEnables[id]
  584.                 ) {
  585.                     button.update(button.scale, button.x, button.y, button.text, button.fontSize);
  586.                 }
  587.             }
  588.         }
  589.     };

  590.     /**
  591.      * メッセージウィンドウ表示時の挙動を改造する。
  592.      * メッセージウィンドウ表示時はアイテムスロットは表示しない。
  593.      */
  594.     const _Window_Message_prototype_startMessage = Window_Message.prototype.startMessage;
  595.     Window_Message.prototype.startMessage = function () {
  596.         _Window_Message_prototype_startMessage.apply(this, arguments);
  597.         const keys = Object.keys(iconButtons);
  598.         if (SceneManager._scene instanceof Scene_Map) {
  599.             for (let i = 0; i < keys.length; i++) {
  600.                 const id = keys[i];
  601.                 const button = iconButtons[id].button;

  602.                 if (
  603.                     button
  604.                     && iconButtonEnables[id]
  605.                 ) {
  606.                     button.hide();
  607.                 }
  608.             }
  609.         }
  610.     };

  611.     /**
  612.      * メッセージウィンドウ終了時の挙動を改造する。
  613.      * メッセージウィンドウ終了時はアイテムスロットは表示する。
  614.      */
  615.     const _Window_Message_prototype_terminateMessage = Window_Message.prototype.terminateMessage;
  616.     Window_Message.prototype.terminateMessage = function () {
  617.         _Window_Message_prototype_terminateMessage.apply(this, arguments);
  618.         const keys = Object.keys(iconButtons);
  619.         if (SceneManager._scene instanceof Scene_Map) {
  620.             for (let i = 0; i < keys.length; i++) {
  621.                 const id = keys[i];
  622.                 const button = iconButtons[id].button;

  623.                 if (
  624.                     button
  625.                     && iconButtonEnables[id]
  626.                 ) {
  627.                     button.update(button.scale, button.x, button.y, button.text, button.fontSize);
  628.                 }
  629.             }
  630.         }
  631.     };
  632. })();
复制代码

点评

大佬就是大佬 NB  发表于 2021-10-2 23:43
厲害!  发表于 2021-10-1 01:12
# 基于RMMV/MZ基础编写插件,持续更新,请多多支持.
# 需求人多的优先编写!最新消息请关注下面通道.

[插件交流群][个人插件网]
回复

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
20538
在线时间
123 小时
注册时间
2019-5-18
帖子
68
3
 楼主| 发表于 2021-9-9 03:13:50 | 只看该作者
原版代码IconButton.js
回复

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
20538
在线时间
123 小时
注册时间
2019-5-18
帖子
68
4
 楼主| 发表于 2021-9-9 03:15:07 | 只看该作者
汉化IconButton.js
回复

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2585
在线时间
297 小时
注册时间
2021-5-4
帖子
101
5
发表于 2021-9-9 06:31:44 | 只看该作者

好奇为什么会有个句号不会出错吗
回复

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
5324
在线时间
406 小时
注册时间
2020-8-21
帖子
35
6
发表于 2021-9-9 13:27:53 | 只看该作者
既然原版没问题,问题出在汉化版上,那就用排除法,一句一句的汉化保存测试,看看问题出现在哪一句上面。
例如:
@text 这个类型的语句先不汉化   
@desc  只汉化这个类型语句  
看看是否出问题
我碰到过有些插件  汉化@text部分就会出问题
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
128
在线时间
10 小时
注册时间
2019-12-15
帖子
4
7
发表于 2021-9-9 15:05:56 | 只看该作者
不是代码的变量名都不允许用汉字的啊
回复

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
20538
在线时间
123 小时
注册时间
2019-5-18
帖子
68
8
 楼主| 发表于 2021-9-9 15:39:25 | 只看该作者
moranzyb 发表于 2021-9-9 13:27
既然原版没问题,问题出在汉化版上,那就用排除法,一句一句的汉化保存测试,看看问题出现在哪一句上面。
...

是原版插件的问题,我新开的工程用原版插件测试的还是同样的时候
回复

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
20538
在线时间
123 小时
注册时间
2019-5-18
帖子
68
9
 楼主| 发表于 2021-9-9 15:42:26 | 只看该作者
sgs844575 发表于 2021-9-9 15:05
不是代码的变量名都不允许用汉字的啊

原版插件的问题,用原版插件,新工程都用数字没有用汉字,还是出现同样的问题
回复

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
20538
在线时间
123 小时
注册时间
2019-5-18
帖子
68
10
 楼主| 发表于 2021-9-10 19:49:32 | 只看该作者
没有人了吗
回复

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-20 01:44

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表