じ☆ve冰风 发表于 2024-4-19 23:05:11

让金钱窗口的金钱每三位用逗号隔开

LZ鼓捣了几个月的RGSS后,终于开始动手做自己的脚本了。

希望各位可以支持,也多多提出意见。

如图,像这样的让金钱的每三位以逗号隔开,看起来更有条理。
LZ鼓捣了几个小时才弄出来的……是我第一个纯自主非仿照脚本,希望支持。
可能有很多累赘的东西,各位如果有什么意见尽管提。
使用方法:
①新人:在main上按Insert插入空白脚本,然后将该脚本复制进去。
②大神:直接在原Window_Gold中进行修改。

RUBY 代码
#==============================================================================
# ■ Window_Gold
#------------------------------------------------------------------------------
#  显示金钱的窗口。 (更有条理)
# By 风中的翔 (第一次做)
#==============================================================================
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#清除内容
    size=contents.text_size($data_system.words.gold).width#取得金钱宽度
    self.contents.font.color=normal_color
    gold_fenhao
    self.contents.draw_text(4,0,120-size-2,32,@goldshu, 2)#描绘钱数
    self.contents.font.color=system_color
    self.contents.draw_text(124-size,0,size,32,$data_system.words.gold,2)#描绘单位
end
def gold_fenhao
    a = $game_party.gold.to_s
    @fenhaoshu = a.size/3
    @fenhaoyu = a.size%3
    @d=[]
    @d_n=0
    a.scan(/./).each{|a| qudu_gold(a)}
    @goldshu=""
    b=0
    while b
页: [1]
查看完整版本: 让金钱窗口的金钱每三位用逗号隔开