加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
我想创建一个窗口
显示位置是屏幕中央 高度为100
文字内容为自定义 脚本里是输入$tip="";$tip_imformation="";
也就是在事件编辑中输入脚本进行调用 但是每次调用3秒之后让窗口消失不太会
class Window_Tip < Window_Base def initialize if $tip_information.is_a?(String) and $tip_information!="" @temptext = $tip_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(0,416/2+50, window_width, window_height) refresh end def window_width return 544 end def window_height return 100 end def refresh contents.clear if $tip.nil? or $tip=="" $tip="" $tip_information="" end draw_text_ex(0,0,"\\c[1]#{$tip}") text_color(2) draw_text_ex(0,24,@temptext) end def tip $tip end def open refresh super end end
class Window_Tip < Window_Base
def initialize
if $tip_information.is_a?(String) and $tip_information!=""
@temptext = $tip_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(0,416/2+50, window_width, window_height)
refresh
end
def window_width
return 544
end
def window_height
return 100
end
def refresh
contents.clear
if $tip.nil? or $tip==""
$tip=""
$tip_information=""
end
draw_text_ex(0,0,"\\c[1]#{$tip}")
text_color(2)
draw_text_ex(0,24,@temptext)
end
def tip
$tip
end
def open
refresh
super
end
end
|