Project1
标题:
单一状态图标
[打印本页]
作者:
xiaoxiyp
时间:
2014-9-28 20:45
标题:
单一状态图标
一些小图标我不想用iconset,而想用单张照片
作者:
VIPArcher
时间:
2014-9-28 21:09
本帖最后由 VIPArcher 于 2014-9-28 21:58 编辑
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, 24, 24)
contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
end
end
end
复制代码
使用方法:物品/技能/状态备注栏备注<ICON:文件名>
文件放在"Graphics/Icons/"文件夹下(自己新建一个)
作者:
xiaoxiyp
时间:
2014-9-28 22:25
谢,已解决
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1