Project1
标题:
再次提问:物品颜色脚本发生错误
[打印本页]
作者:
k_ichinose
时间:
2009-6-11 20:20
标题:
再次提问:物品颜色脚本发生错误
#物品颜色描绘脚本--by[Beside]
class Window_Base < Window
def disabled_color
return Color.new(255, 255, 255, 128)
end
def draw_item_name(item, x, y, enabled = true)
if item != nil
draw_icon(item.icon_index, x, y, enabled)
name_color = item.note.split(/#/)[0]
if name_color != nil
name_color.gsub!(/\[([0-9a-zA-Z]+)\]/) { "[#{$1}]" }
if $1[0,1]=="H"
# 先拷贝一下文字
c=$1.dup
# 分3段分别取出R,G,B颜色
c.sub!(/H([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})/, "")
# 设定文字颜色
self.contents.font.color = Color.new($1.to_i(16), $2.to_i(16), $3.to_i(16))
else
color = $1.to_i
if color >= 0 and color <= 31
self.contents.font.color = text_color(color)
elsif color == 32
self.contents.font.color = disabled_color
elsif color == 33
self.contents.font.color = system_color
end
end
else self.contents.font.color = normal_color
end
opacity = self.contents.font.color == disabled_color ? 128 : 255
self.contents.draw_text(x + 24, y, 172, WLH, item.name.to_s)
end
end
end
复制代码
第13行出现NoMethodError。重开游戏也没用
PS:用的学校电脑,所以没截图也没范例……
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1