while ((c = text_copy.slice!(/./m)) != nil)
#====================================
#设置字体
#====================================
#颜色
if c == "\001"
text_copy.sub!(/\[([0-9]+)\]/, "")
next if color[$1.to_i].nil?
self.font.color = color[$1.to_i]
next
end
#大小
if c == "\002"
text_copy.sub!(/\[([0-9]+)\]/, "")
self.font.size = $1.to_i
next
end
#名称
if c == "\003"
text_copy.sub!(/\[(.+)\]/, "")
self.font.name = $1 if Font.exist?($1)
next
end
#粗体关
if c == "\004"
self.font.bold = false
next
end
#粗体开
if c == "\005"
self.font.bold = true
next
end
#斜体关
if c == "\006"
self.font.italic = false
next
end
#斜体开
if c == "\007"
self.font.italic = true
next
end
#====================================
#描绘图标
#====================================
#物品
if c == "\020"
text_copy.sub!(/\[([0-9]+)\]/, "")
if !$data_items[$1.to_i].nil? and $data_items[$1.to_i].icon_name != ""
next if tx + 24 > self.width - 32
bitmap = RPG::Cache.icon($data_items[$1.to_i].icon_name)
self.blt(tx, ty, bitmap, rect)
tx += 24
end
next
end
#特技
if c == "\021"
text_copy.sub!(/\[([0-9]+)\]/, "")
if !$data_skills[$1.to_i].nil? and $data_skills[$1.to_i].icon_name != ""
next if tx + 24 > self.width - 32
bitmap = RPG::Cache.icon($data_skills[$1.to_i].icon_name)
self.blt(tx, ty, bitmap, rect)
tx += 24
end
next
end
#武器
if c == "\022"
text_copy.sub!(/\[([0-9]+)\]/, "")
if !$data_weapons[$1.to_i].nil? and $data_weapons[$1.to_i].icon_name != ""
next if tx + 24 > self.width - 32
bitmap = RPG::Cache.icon($data_weapons[$1.to_i].icon_name)
self.blt(tx, ty, bitmap, rect)
tx += 24
end
next
end
#防具
if c == "\023"
text_copy.sub!(/\[([0-9]+)\]/, "")
if !$data_armors[$1.to_i].nil? and $data_armors[$1.to_i].icon_name != ""
next if tx + 24 > self.width - 32
bitmap = RPG::Cache.icon($data_armors[$1.to_i].icon_name)
self.blt(tx, ty, bitmap, rect)
tx += 24
end
next
end
#自定
if c == "\025"
text_copy.sub!(/\[(.+)\]/, "")
if $1 != ""
next if tx + 24 > self.width - 32
bitmap = RPG::Cache.icon($1)
self.blt(tx, ty, bitmap, rect)
tx += 24
end
next
end
#====================================
#其他
#====================================
#换行
if c == "\030"
ty += self.font.size
next
end
cx = self.text_size(c).width
#投影
#dl_color_copy = self.font.color.clone
#self.font.color.set(0, 0, 0)
#self.draw_text(tx+1, ty+1, cx, self.font.size, c)
#self.draw_text(tx-1, ty+1, cx, self.font.size, c)
#self.draw_text(tx+1, ty-1, cx, self.font.size, c)
#self.draw_text(tx-1, ty-1, cx, self.font.size, c)
#self.font.color = dl_color_copy
self.draw_text(tx, ty, cx, self.font.size, c)
tx += cx
#自动换行
if tx >= self.width
tx = 0
ty += self.font.size
end
end
#恢复调整
self.font.name = name_copy
self.font.size = size_copy
self.font.bold = bold_copy
self.font.italic = italic_copy
self.font.color = color_copy
end
end
[/pre]