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

Project1

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

[有事请教] [已解决]如何对物品icon图标大小进行修改

[复制链接]

Lv2.观梦者

梦石
0
星屑
281
在线时间
35 小时
注册时间
2018-7-3
帖子
7
跳转到指定楼层
1
发表于 2019-7-23 19:29:26 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 德邦之翼 于 2019-7-25 20:54 编辑

如果使用YEP的CoreEngine插件修改图标大小和行高的话会导致其他窗口的行高发生改变,因此想要只修改物品窗口的图标大小。写了一个简单的插件但是只能显示一个图标(也就是第一个),并且物品名称文字消失,求解问题出在哪里?
这是用YEP插件修改的结果

这是用自己写的插件的结果
自己的插件代码:

  1. //=============================================================================
  2. // ItemIconChange.js
  3. //=============================================================================
  4. /*:
  5. * @plugindesc 修改物品图标图片大小
  6. * @author 德邦之翼
  7. *
  8. * @param Icon Height
  9. * @desc The value of height of icons.
  10. * @default 32
  11. *
  12. * @param Icon Width
  13. * @desc The value of width of icons.
  14. * @default 32
  15. *
  16. * @help
  17. */

  18. (function() {
  19.     var parameters = [];
  20.     parameters = PluginManager.parameters('ItemIconChange');
  21.     var iconHight = String(parameters['Icon Height']);
  22.     var iconWidth = String(parameters['Icon Width']);
  23.     Window_ItemList._iconWidth  = iconWidth;
  24.     Window_ItemList._iconHeight = iconHight;
  25.    
  26.     Window_ItemList.prototype.lineHeight = function() {
  27.         return 106;
  28.     };
  29.    
  30.     Window_ItemList.prototype.drawIcon = function(iconIndex, x, y) {
  31.         var bitmap = ImageManager.loadSystem('IconSet');
  32.         var pw = Window_ItemList._iconWidth;
  33.         var ph = Window_ItemList._iconHeight;
  34.         var sx = iconIndex % 16 * pw;
  35.         var sy = Math.floor(iconIndex / 16) * ph;
  36.         console.log('sx =',sx,'sy =',sy,'x =',x,'y =',y);
  37.         this.contents.blt(bitmap, sx, sy, pw, ph, x, y);
  38.     };

  39.     Window_ItemList.prototype.drawItemName = function(item, x, y, width) {
  40.         width = width || 312;
  41.         if (item) {
  42.             var iconBoxWidth = Window_ItemList._iconWidth + 4;
  43.             this.resetTextColor();
  44.             this.drawIcon(item.iconIndex, x + 2, y + 2);
  45.             this.drawText(item.name, x + iconBoxWidth, y, width - iconBoxWidth);
  46.         }
  47.     };

  48.     Window_ItemList.prototype.processDrawIcon = function(iconIndex, textState) {
  49.         this.drawIcon(iconIndex, textState.x + 2, textState.y + 2);
  50.         textState.x += Window_ItemList._iconWidth + 4;
  51.     };

  52. })();
复制代码


YEP的coreEngine里是直接修改了Window_Base._iconWidth来达成的效果,然而我用自己写的方法直接修改Window_Base._iconWidth一样无法达成和YEP的插件一样的效果,这一点我毫无头绪。。。

评分

参与人数 1+1 收起 理由
白嫩白嫩的 + 1 精品文章

查看全部评分

Lv4.逐梦者 (版主)

无限の剣制

梦石
0
星屑
9971
在线时间
5019 小时
注册时间
2013-2-28
帖子
5030

开拓者贵宾

2
发表于 2019-7-25 00:56:46 | 只看该作者
本帖最后由 VIPArcher 于 2019-7-25 01:00 编辑

看了一下你的脚本,第23和24行的
    var iconHight = String(parameters['Icon Height']);
    var iconWidth = String(parameters['Icon Width']);
应该改成
    var iconHight = Number(parameters['Icon Height']);
    var iconWidth = Number(parameters['Icon Width']);
否则iconHight 和 iconWidth 会被读取成字符串,在进行加减之类操作的时候会出现意料之外的情况
例如
  1. "32" + 4 = "324"
复制代码

其他问题就是你这个IconSet文件也得改成对应大小的素材文件。
  1. //=============================================================================
  2. // ItemIconChange.js
  3. //=============================================================================
  4. /*:
  5. * @plugindesc 修改物品图标图片大小
  6. * @author 德邦之翼
  7. *
  8. * @param Icon Height
  9. * @desc The value of height of icons.
  10. * @default 32
  11. * @type number
  12. *
  13. * @param Icon Width
  14. * @desc The value of width of icons.
  15. * @default 32
  16. * @type number
  17. *
  18. * @help
  19. */

  20. (function() {
  21.     var parameters = [];
  22.     parameters = PluginManager.parameters('ItemIconChange');
  23.     var iconHight = Number(parameters['Icon Height']);
  24.     var iconWidth = Number(parameters['Icon Width']);
  25.     Window_ItemList._iconWidth  = iconWidth;
  26.     Window_ItemList._iconHeight = iconHight;
  27.    
  28.     Window_ItemList.prototype.lineHeight = function() {
  29.         return 106;
  30.     };
  31.    
  32.     Window_ItemList.prototype.drawIcon = function(iconIndex, x, y) {
  33.         var bitmap = ImageManager.loadSystem('IconSet');
  34.         var pw = Window_ItemList._iconWidth;
  35.         var ph = Window_ItemList._iconHeight;
  36.         var sx = iconIndex % 16 * pw;
  37.         var sy = Math.floor(iconIndex / 16) * ph;
  38.         console.log('sx =',sx,'sy =',sy,'x =',x,'y =',y);
  39.         this.contents.blt(bitmap, sx, sy, pw, ph, x, y);
  40.     };

  41.     Window_ItemList.prototype.drawItemName = function(item, x, y, width) {
  42.         width = width || 312;
  43.         if (item) {
  44.             var iconBoxWidth = Window_ItemList._iconWidth + 4;
  45.             this.resetTextColor();
  46.             this.drawIcon(item.iconIndex, x + 2, y + 2);
  47.             this.drawText(item.name, x + iconBoxWidth, y, width - iconBoxWidth);
  48.         }
  49.     };

  50.     Window_ItemList.prototype.processDrawIcon = function(iconIndex, textState) {
  51.         this.drawIcon(iconIndex, textState.x + 2, textState.y + 2);
  52.         textState.x += Window_ItemList._iconWidth + 4;
  53.     };

  54. })();
复制代码

评分

参与人数 2+2 收起 理由
白嫩白嫩的 + 1 塞糖
wabcmcc + 1 塞糖

查看全部评分

回复 支持 1 反对 0

使用道具 举报

Lv2.观梦者

梦石
0
星屑
281
在线时间
35 小时
注册时间
2018-7-3
帖子
7
3
 楼主| 发表于 2019-7-25 20:53:04 | 只看该作者
VIPArcher 发表于 2019-7-25 00:56
看了一下你的脚本,第23和24行的
    var iconHight = String(parameters['Icon Height']);
    var iconWi ...

感谢!修改之后能够成功运行了!犯了一个很傻的错误!

评分

参与人数 1+1 收起 理由
白嫩白嫩的 + 1 塞糖

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
128
在线时间
11 小时
注册时间
2019-7-3
帖子
21
4
发表于 2019-7-26 00:38:46 | 只看该作者
这是要搞密室逃脱吗
承接游戏LOGO设计 +W信:amwdhqc
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-15 05:08

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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