class Game_Variables
FileVariablesID1 = 63,64,65
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize
@data = []
end
#--------------------------------------------------------------------------
# ● 获取变量
# variable_id : 变量 ID
#--------------------------------------------------------------------------
def [](variable_id)
if variable_id == FileVariablesID1
begin
val = load_data("TempVariables.rxdata")
rescue Errno::ENOENT
save_data(0, "TempVariables.rxdata")
retry
end
return val
end
if variable_id <= 5000 and @data[variable_id] != nil
return @data[variable_id]
else
return 0
end
end
#--------------------------------------------------------------------------
# ● 设置变量
# variable_id : 变量 ID
# value : 变量的值
#--------------------------------------------------------------------------
def []=(variable_id, value)
if variable_id <= 5000
@data[variable_id] = value
end
if variable_id == FileVariablesID1
save_data(@data[variable_id], "TempVariables.rxdata")
end
end
end