本帖最后由 铅笔描绘的思念 于 2012-6-13 19:27 编辑
class Window_Pos < Window_Base def initialize super(10, -16, 344, 100)#这里设置窗口的X坐标、Y坐标、宽、高(屏幕显示为544*416) self.z = 151 self.opacity = 0 unless $game_switches[1]#利用开关控制窗口是否显示,1代表一号开关 self.openness = 255 else self.openness = 0 end @sec = 0 refresh end def refresh self.contents.clear self.contents.font.color = text_color(0) self.contents.font.size = 16 # 字体大小 text = "文字" # ""中间的文字可以随意替换 self.contents.draw_text(0, 0, 312, 30, text, 0) end def update sec = Graphics.frame_count / Graphics.frame_rate if sec - @sec > 59 @sec = sec refresh else return end end end class Scene_Map < Scene_Base alias old_start start def start old_start @pos_window = Window_Pos.new end alias old_ter terminate def terminate old_ter @pos_window.dispose end alias old_update update def update old_update @pos_window.update end end
class Window_Pos < Window_Base
def initialize
super(10, -16, 344, 100)#这里设置窗口的X坐标、Y坐标、宽、高(屏幕显示为544*416)
self.z = 151
self.opacity = 0
unless $game_switches[1]#利用开关控制窗口是否显示,1代表一号开关
self.openness = 255
else
self.openness = 0
end
@sec = 0
refresh
end
def refresh
self.contents.clear
self.contents.font.color = text_color(0)
self.contents.font.size = 16 # 字体大小
text = "文字" # ""中间的文字可以随意替换
self.contents.draw_text(0, 0, 312, 30, text, 0)
end
def update
sec = Graphics.frame_count / Graphics.frame_rate
if sec - @sec > 59
@sec = sec
refresh
else
return
end
end
end
class Scene_Map < Scene_Base
alias old_start start
def start
old_start
@pos_window = Window_Pos.new
end
alias old_ter terminate
def terminate
old_ter
@pos_window.dispose
end
alias old_update update
def update
old_update
@pos_window.update
end
end
|