【VXAce】ゴールドのカンマ表示

EDIT

RPGツクールVXAce ゴールドカンマ

メニューとかショップでのゴールド表記を3桁で区切る。

class Window_Base < Window
def draw_currency_value(value, unit, x, y, width)
cx = text_size(unit).width
change_color(normal_color)
gold = $game_party.gold.to_s.gsub(/(\d)(?=\d{3}+(?:\.|$))(\d{3}\..*)?/,'\1,\2')
draw_text(x, y, width - cx - 2, line_height, gold, 2)
change_color(system_color)
draw_text(x, y, width, line_height, unit, 2)
draw_icon(361, x, y + (line_height - 24) / 2)
end
end

class Window_ShopBuy < Window_Selectable
def draw_item(index)
item = @data[index]
rect = item_rect(index)
draw_item_name(item, rect.x, rect.y, enable?(item))
rect.width -= 4
gold = price(item).to_s.gsub(/(\d)(?=\d{3}+(?:\.|$))(\d{3}\..*)?/,'\1,\2')
draw_text(rect, gold, 2)
end
end

class Window_ShopNumber < Window_Selectable
def draw_currency_value(value, unit, x, y, width)
cx = text_size(unit).width
change_color(normal_color)
gold = (@price * @number).to_s.gsub(/(\d)(?=\d{3}+(?:\.|$))(\d{3}\..*)?/,'\1,\2')
draw_text(x, y, width - cx - 2, line_height, gold, 2)
change_color(system_color)
draw_text(x, y, width, line_height, unit, 2)
end
end

関連記事
コメントの投稿












管理者にだけ表示を許可する

トラックバック
この記事のトラックバックURL