| 赞 | 4  | 
 
| VIP | 71 | 
 
| 好人卡 | 22 | 
 
| 积分 | 7 | 
 
| 经验 | 32145 | 
 
| 最后登录 | 2013-8-9 | 
 
| 在线时间 | 184 小时 | 
 
 
 
 
 
Lv2.观梦者 天仙 
	- 梦石
 - 0 
 
        - 星屑
 - 680 
 
        - 在线时间
 - 184 小时
 
        - 注册时间
 - 2008-4-15
 
        - 帖子
 - 5023
 
 
  
 
 | 
	
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员  
 
x
 
 本帖最后由 雪流星 于 2012-2-10 20:36 编辑  
 
旧版:http://rpg.blue/forum.php?mod=viewthread&tid=79657 
 
原本的版本中,没有使用 alias 去降低脚本冲突的可能。 
而且VA和VX的绘制方法都有一些修改,所以直接重写一个通用的版本。 
 
使用方法: 
将图标文件放在 游戏根目录/Graphics/Icons 里面 
在数据库的物品/武器/防具/技能/状态中的备注里面写 [icon 文件名](注意这点与旧版稍有不同) 
 
2012-02-10 [关於VA]更新 
 * 忽然发现 VA 当中, Actor 和 Class 同样作为 BaseItem 的子类,也可以设定图标。 
    所以将脚本稍做修改,可以使用 [icon X] 来设定图标。X 为图标的 index 
    当然,这个设定只有角色和职业需要使用。(物品等可以这样设定,但是有需要吗?) 
    具体要怎么用就看个人。 
- class RPG::BaseItem
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 获取图标
 
 -   #--------------------------------------------------------------------------
 
 -   def get_icon
 
 -     self.note.split(/[\r\n]+/).each { |line|
 
 -       return $1 if line =~ /\[(?:icon) (\S+)\]/
 
 -     }
 
 -     return nil
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 图标 index
 
 -   #--------------------------------------------------------------------------
 
 -   alias draw_single_icon_icon_index icon_index
 
 -   def icon_index
 
 -     icon_index = get_icon
 
 -     # 如果有指定图标
 
 -     if icon_index && icon_index =~ /\d+/ # 如果指定的是數字
 
 -       @icon_index = icon_index.to_i # 轉換成數字
 
 -     elsif icon_index
 
 -       return icon_index # 返回指定图标文件名
 
 -     end
 
 -     return draw_single_icon_icon_index # 否则返回原本的图标 index
 
 -   end
 
 - end
 
 - class Window_Base
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 绘制图标
 
 -   #--------------------------------------------------------------------------
 
 -   alias draw_single_icon_draw_icon draw_icon
 
 -   def draw_icon(icon_index, x, y, enabled = true)
 
 -     if icon_index.is_a?(Integer) # 判断是否为整数
 
 -       # 调用原本的绘制图标方法
 
 -       draw_single_icon_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
 
 
  复制代码 |   
 
评分
- 
查看全部评分
 
 
 
 
 
 |