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

Project1

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

[有事请教] 有什么插件来修改货币系统的显示吗?

[复制链接]

Lv5.捕梦者

梦石
0
星屑
24564
在线时间
5096 小时
注册时间
2016-3-8
帖子
1625
1
发表于 2024-2-27 12:29:26 | 显示全部楼层
本帖最后由 alexncf125 于 2024-2-27 12:44 编辑
二十八画员 发表于 2024-2-27 10:04
谢谢,最近刚接触呢,还得一点一点研究。


别听楼上乱说了,打开rmmz_windows.js查找以下代码修改,或者另写成一个插件也行
JAVASCRIPT 代码复制
  1. Window_Base.prototype.drawCurrencyValue = function (value, unit, x, y, width) {
  2.     // const unitWidth = Math.min(80, this.textWidth(unit));
  3.     // this.resetTextColor();
  4.     // this.drawText(value, x, y, width - unitWidth - 6, "right");
  5.     // this.changeTextColor(ColorManager.systemColor());
  6.     // this.drawText(unit, x + width - unitWidth, y, unitWidth, "right");
  7.     const guan = Math.floor(value / 1000);
  8.     const wen = value % 1000;
  9.     const wenWidth = Math.min(80, this.textWidth(String(wen)));
  10.     const unitWidth = Math.min(80, this.textWidth(unit));
  11.     if (guan > 0) {
  12.         this.resetTextColor();
  13.         this.drawText(guan, x, y, width - unitWidth * 2 - wenWidth - 18, "right");
  14.         this.changeTextColor(ColorManager.systemColor());
  15.         this.drawText("贯", x + width - unitWidth * 2 - wenWidth - 12, y, unitWidth, "right");
  16.     };
  17.     this.resetTextColor();
  18.     this.drawText(wen, x, y, width - unitWidth - 6, "right");
  19.     this.changeTextColor(ColorManager.systemColor());
  20.     this.drawText(unit, x + width - unitWidth, y, unitWidth, "right");
  21. };
回复 支持 1 反对 0

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
24564
在线时间
5096 小时
注册时间
2016-3-8
帖子
1625
2
发表于 2024-2-28 17:08:53 | 显示全部楼层
本帖最后由 alexncf125 于 2024-2-28 17:12 编辑
二十八画员 发表于 2024-2-28 16:58
大佬牛啤!  那么同理,商店的单价显示也在rmmz_windows.js吗?


是的也在rmmz_windows.js
JAVASCRIPT 代码复制
  1. Window_ShopBuy.prototype.drawItem = function (index) {
  2.     const item = this.itemAt(index);
  3.     const price = this.price(item);
  4.  
  5.     const guan = Math.floor(price / 1000);
  6.     const wen = price % 1000;
  7.     const guanwen = guan > 0 ? guan + "贯" + wen + "文" : wen + "文";
  8.  
  9.     const rect = this.itemLineRect(index);
  10.     const priceWidth = this.priceWidth();
  11.     const priceX = rect.x + rect.width - priceWidth;
  12.     const nameWidth = rect.width - priceWidth;
  13.     this.changePaintOpacity(this.isEnabled(item));
  14.     this.drawItemName(item, rect.x, rect.y, nameWidth);
  15.  
  16.     // this.drawText(price, priceX, rect.y, priceWidth, "right");
  17.     this.drawText(guanwen, priceX, rect.y, priceWidth, "right");
  18.  
  19.     this.changePaintOpacity(true);
  20. };
  21.  
  22. Window_ShopBuy.prototype.priceWidth = function () {
  23.     // return 96;
  24.     return 192;
  25. };


priceWidth改192是因为,当显示999贯999文时只得96的话,文字会被收窄显示
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
24564
在线时间
5096 小时
注册时间
2016-3-8
帖子
1625
3
发表于 2024-2-28 21:06:30 | 显示全部楼层
二十八画员 发表于 2024-2-28 17:59
非常感谢!

但是有个bug,购买一个单价999文的物品,销售的价格却为1贯500文,哪里自己定义卖出价格呢? ...


RM默认的卖出价是数据库价格的一半,我这边新建工程测试,
买一个单价999文的物品,销售的价格为499文,
所以不知道你那边何以会是1贯500文

至于自己定义卖出价格,可以试试这个插件
https://forums.rpgmakerweb.com/i ... -formula-mz.129116/
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-26 21:13

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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