查看: 1983|回复: 5

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

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

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

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

×
emmm...在脚本中添加了银币的新币种..相关脚本如图,窗口代码附上。启动游戏时发现银币并没有显示==而且如果把金币字符串的颜色改掉金币也不见了...这是什么操作==求大佬们指教QWQ[pre lang="ruby" line="1"]#==============================================================================
# ■ Window_Gold
#------------------------------------------------------------------------------
#  显示金钱的窗口。
#==============================================================================
#修改了金币的显示,添加了银币的显示
class Window_Gold < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化窗口
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 160, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    cx = contents.text_size($data_system.words.gold).width
################################################################################
    #self.contents.font.color = Color.new(248,181,81,0)
    self.contents.draw_text(4, 0, 120-cx-2, 32, $game_party.gold.to_s, 2)
    bitmap = Bitmap.new("Graphics/Money/" +"金币.png")
    self.contents.blt(124-cx, 8, bitmap, Rect.new(0,0,114,114),255)
################################################################################
    self.contents.font.color = Color.new(191,191,191,0)
    self.contents.draw_text(4, 0, 0, 32, $game_party.silver.to_s,1)
    bitmap = Bitmap.new("Graphics/Money/" +"银币.png")
    self.contents.blt(62-cx, 8, bitmap, Rect.new(0,0,114,114),255)
  end
end
#描绘图片写法 self.contents.blt(x, y, bitmap, Rect.new(x, y, 宽, 高),透明度)
#bitmap 是图片文件, 例如 bitmap = RPG::Cache.picture("一张图片")
#描绘文字写法 self.contents.draw_text(x, y, 宽, 高, 要描绘的字符串, 对齐0左1中2右)[/pre]
@Y$5~(VQ6CND9BTY]96FSCW.png
{[Z0LOGXVOC6YVB9ZLLFK)0.png
梦石
0
星屑
42235
在线时间
6017 小时
注册时间
2006-11-10
回帖
6966
发表于 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.

在本版发帖返回顶部