# 显示提示信息。获得金钱时将 item 设为 nil。
def self.show(value, item)
@item = item
@value = value
$game_message.background = BACKGROUND
$game_message.position = POSITION
$game_message.add(message)
play_se
end
private
# 获取提示的消息
def self.message
if @item
format = ITEM_FORMAT
icon_index = @item.icon_index
name = @item.name
else
format = GOLD_FORMAT
icon_index = GOLD_ICON_INDEX
name = Vocab.currency_unit
end
def self.play_se
const = :"#{@value > 0 ? 'GAIN' : 'LOSE'}_#{@item ? 'ITEM' : 'GOLD'}_SE"
se = const_defined?(const) && const_get(const)
Audio.se_play('Audio/SE/' + se) if se
end
end
class Game_Party < Game_Unit
# 获取道具总数(包括装备)
def item_number_with_equip(item)
members.inject(item_number(item)) { |a, e| a + e.equips.count(item) }
end
end
可以插入图标配合这个脚本吗?
class RPG::BaseItem
#--------------------------------------------------------------------------
# ● 获取图标
#--------------------------------------------------------------------------
def get_icon
self.note.split(/[\r\n]+/).each { |line|
return $1 if line =~ /<ICON:(\S+)>/i
}
return nil
end
#--------------------------------------------------------------------------
# ● 图标 index
#--------------------------------------------------------------------------
alias vip_20140928_icon_index icon_index
def icon_index
return get_icon if get_icon
return vip_20140928_icon_index
end
end
class Window_Base
#--------------------------------------------------------------------------
# ● 绘制图标
#--------------------------------------------------------------------------
alias vip_20140928_draw_icon draw_icon
def draw_icon(icon_index, x, y, enabled = true)
if icon_index.is_a?(Integer)
vip_20140928_draw_icon(icon_index, x, y, enabled)
else
bitmap = Cache.load_bitmap("Graphics/Icons/", icon_index)
rect = Rect.new(0, 0, bitmap.width, bitmap.height)
contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
end
end
end