# ■ Window_Task
class Window_Task < Window_Base
# ● 初始化对象
def initialize
addheight = 24
tb = Bitmap.new(544,416)
if $task_information.is_a?(String) and $task_information!=""
@temptext = $task_information.gsub(/(\r\n)|\n/,"")
i = 1
p = 0
insert_list = []
while p+i<= @temptext.size
w = tb.text_size(@temptext[p,i]).width
if w > window_width
insert_list << p+i-2
p = p+i-2
i = 1
end
i+=1
end
insert_list.reverse!
insert_list.each{|k| @temptext.insert(k,"\n")}
tb.dispose
addheight = (insert_list.size+2) * 24
end
#~ super(380,50, window_width, 48 + addheight)
super(0,260, window_width, 48 + addheight)
refresh
end
#--------------------------------------------------------------------------
# ● 获取窗口的宽度
#--------------------------------------------------------------------------
def window_width
return 170
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
contents.clear
if $task.nil? or $task==""
$task="无"
$task_information=""
end
draw_text_ex(0,0,"提示:\\C[1]#{$task}")
#~ draw_text_ex(0,24,"\\C[1]#{$task}")
text_color(2)
#~ draw_text_ex(0,48,@temptext)
draw_text_ex(0,24,@temptext)
end
#--------------------------------------------------------------------------
# ● 获取任务
#--------------------------------------------------------------------------
def task
$task
end
#--------------------------------------------------------------------------
# ● 打开窗口
#--------------------------------------------------------------------------
def open
refresh
super
end
end