class Game_Switches
#--------------------------------------------------------------------------
# ● 设置开关
# switch_id : 开关 ID
# value : ON (true) / OFF (false)
#--------------------------------------------------------------------------
def []=(switch_id, value)
if switch_id <= 5000
@data[switch_id] = value
end
if value
for i in 1..20
if switch_id == i
switch_off_after(i, 5)
end
end
end
end
def switch_off_after(switch_id, sec)
Thread.new {
cnt = 0
while cnt < sec
sleep 1
cnt += 1
end
self[switch_id] = false
}
end
end
class Game_Switches
#--------------------------------------------------------------------------
# ● 设置开关
# switch_id : 开关 ID
# value : ON (true) / OFF (false)
#--------------------------------------------------------------------------
def []=(switch_id, value)
if switch_id <= 5000
@data[switch_id] = value
end
if value
for i in 1..20
if switch_id == i
switch_off_after(i, 5)
end
end
end
end
def switch_off_after(switch_id, sec)
Thread.new {
cnt = 0
while cnt < sec
sleep 1
cnt += 1
end
self[switch_id] = false
}
end
end