查看: 2026|回复: 5

[已经解决] 关于第二币种的问题

[复制链接]
梦石
0
星屑
1293
在线时间
118 小时
注册时间
2017-7-14
回帖
112
发表于 2019-3-31 13:24:40 | 显示全部楼层 |阅读模式

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

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

×
emmm...在脚本中添加了银币的新币种..相关脚本如图,窗口代码附上。启动游戏时发现银币并没有显示==而且如果把金币字符串的颜色改掉金币也不见了...这是什么操作==求大佬们指教QWQ
  1. #==============================================================================
  2. # ■ Window_Gold
  3. #------------------------------------------------------------------------------
  4. #  显示金钱的窗口。
  5. #==============================================================================
  6. #修改了金币的显示,添加了银币的显示
  7. class Window_Gold < Window_Base
  8.   #--------------------------------------------------------------------------
  9.   # ● 初始化窗口
  10.   #--------------------------------------------------------------------------
  11.   def initialize
  12.     super(0, 0, 160, 64)
  13.     self.contents = Bitmap.new(width - 32, height - 32)
  14.     refresh
  15.   end
  16.   #--------------------------------------------------------------------------
  17.   # ● 刷新
  18.   #--------------------------------------------------------------------------
  19.   def refresh
  20.     self.contents.clear
  21.     cx = contents.text_size($data_system.words.gold).width
  22. ################################################################################
  23.     #self.contents.font.color = Color.new(248,181,81,0)
  24.     self.contents.draw_text(4, 0, 120-cx-2, 32, $game_party.gold.to_s, 2)
  25.     bitmap = Bitmap.new("Graphics/Money/" +"金币.png")
  26.     self.contents.blt(124-cx, 8, bitmap, Rect.new(0,0,114,114),255)
  27. ################################################################################
  28.     self.contents.font.color = Color.new(191,191,191,0)
  29.     self.contents.draw_text(4, 0, 0, 32, $game_party.silver.to_s,1)
  30.     bitmap = Bitmap.new("Graphics/Money/" +"银币.png")
  31.     self.contents.blt(62-cx, 8, bitmap, Rect.new(0,0,114,114),255)
  32.   end
  33. end
  34. #描绘图片写法 self.contents.blt(x, y, bitmap, Rect.new(x, y, 宽, 高),透明度)
  35. #bitmap 是图片文件, 例如 bitmap = RPG::Cache.picture("一张图片")
  36. #描绘文字写法 self.contents.draw_text(x, y, 宽, 高, 要描绘的字符串, 对齐0左1中2右)
复制代码
@Y$5~(VQ6CND9BTY]96FSCW.png
{[Z0LOGXVOC6YVB9ZLLFK)0.png
梦石
0
星屑
42345
在线时间
6022 小时
注册时间
2006-11-10
回帖
6975
发表于 2019-3-31 14:25:34 | 显示全部楼层
本帖最后由 灯笼菜刀王 于 2019-3-31 14:26 编辑

  原因有2,
其一, 字符串宽度为0, 没地方给它显示 self.contents.draw_text(4, 0, 0, 32, $game_party.silver.to_s,1)
其二, 颜色alpha为0, 显示了你也看不到 Color.new(191,191,191,0)

点评

因为你用来绘制银币字符串的那个矩形, 宽度为0, 在0宽度的地方你要它怎么才能让三次元的你看到呢? 把红色的那个0换个数字,比如32, 你再看看  发表于 2019-4-1 13:45
谢谢大佬,金币的问题解决了==然而银币还是出不来==请再次赐教QAQ  发表于 2019-4-1 12:50
跟着你学找,找原因哈哈  发表于 2019-3-31 22:22

评分

参与人数 1星屑 +60 收起 理由
RyanBern + 60 认可答案

查看全部评分

回复 2 0

使用道具 举报

梦石
0
星屑
1293
在线时间
118 小时
注册时间
2017-7-14
回帖
112
 楼主| 发表于 2019-4-1 22:23:54 | 显示全部楼层
本帖最后由 wyw838 于 2019-4-1 22:57 编辑

好吧,现在已经解决了,谢谢大佬QWQ
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部