本帖最后由 VIPArcher 于 2014-11-13 22:29 编辑
https://rpg.blue/thread-371989-1-1.html
以前给你弄的这个,稍微改一改。
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
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
你就可以用大图标了,当然前提是绘制图标的地方需要足够大。 |