class Window_Variables < Window_Base
def initialize
super(448,368,96,48) # 创建大小
@text = "" # 初始化内容
@variable = 0
refresh #调用refresh方法(下文定义)
end
def refresh #定义refresh方法
if $game_switches[$s_id] == false #判断是否显示窗口
self.visible = false
else
self.visible = true
end
if @text != $text or @variable != $game_variables[$v_id] #内容变化时
self.contents.clear #清除窗口的位图
self.contents.draw_text(0,0,64,24,$text) #重绘
self.contents.draw_text(0,0,64,24,$game_variables[$v_id].to_s,2)
self.contents.draw_text(0,24,64,24,$game_variables[1].to_s, 2)
@type = $type # 代入当前内容
@owner = $owner
end
end
end
class Scene_Map < Scene_Base
alias new_start start #生成窗体
def start
new_start
@varia_window = Window_Variables.new
end
alias new_update update #更新窗体
def update
new_update
@varia_window.refresh
end
alias new_terminate terminate #消除窗体
def terminate
@varia_window.dispose
new_terminate
end
end
啊,这....