#==============================================================================
# ■ Window_Help2
#==============================================================================
class Window_Help2 < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
end
#--------------------------------------------------------------------------
# ● 设置文本
# text : 窗口显示的字符串
#--------------------------------------------------------------------------
def set_text(text)
line_width = self.width - 32 - 4 * 2
text_array = text.scan(/./)
temp_str = ""
line = 0
for i in 0...text_array.size
if self.contents.text_size(temp_str+text_array).width > line_width
self.contents.draw_text(4, line*32, line_width , 32, temp_str)
temp_str = ""
line += 1
end
if i == text_array.size - 1
self.contents.draw_text(4, line*32, line_width , 32, temp_str+text_array)
end
temp_str += text_array # 竟然打错了,不知道误导了谁没,这句应该在这
end
end
end