# 新建窗口
class Window_Variables < Window_Base
# 初始化
def initialize
# 创建大小
super(416,360,128,56)
# 获取图标编号
@icon = 0
# 获取变量编号
@variable = 0
# 刷新
refresh
# 初始化结束
end
# 刷新
def refresh
# 在图表与变量都有变化的情况下
if @icon != $icon_index or @variable != $game_variables[$variables_id]
# 清楚内容
self.contents.clear
# 描绘图表
draw_icon($icon_index,4,0,true)
# 描绘变量,偏右
self.contents.draw_text(32,0,64,24,$game_variables[$variables_id].to_s,2)
# 带入变量
@icon = $icon_index
@variable = $game_variables[$variables_id]
# if 结束
end
# 刷新结束
end
# class 结束
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
# class 结束
end