end
def dispose
super
@sprite.dispose
@backsp.dispose
for i in @sp_ch
i.dispose
end
end
end
$打开自动存档用的开关编号 = 999
$自动存档位置 = 0
$按下F5之后的自动存档的音效 = "Audio/SE/存档"
$按下F5之后禁止存档时候的音效 = "Audio/Se/】警告"
DIR = "Save/"
$打开自动存档开关之后调用的公共事件 = 0 #——默认未定义
$按下F5之后可以存档调用的公共事件 = 0 #——默认未定义
$按下F5之后禁止存档调用的公共事件 = 0 #——默认未定义
class Scene_Map
alias auto_update update
def update
auto_update
#——按下F5的时候自动存档,可以修改为F5,F6,F7,F8,也可以修改成默认按键但是不推荐。
#——注意在不可存档的时候是无效的
if Input.trigger?(Input::F5)
unless $game_system.map_interpreter.running?
if $game_system.save_disabled
Audio.se_play($按下F5之后禁止存档时候的音效)
$game_temp.common_event_id = 977
else
Audio.se_play($按下F5之后的自动存档的音效)
$game_temp.common_event_id = 977
auto_save
end
end
end
#——当BOSS战之前打开一下定义的开关,即可自动存档
if $game_switches[$打开自动存档用的开关编号] == true
$game_switches[$打开自动存档用的开关编号] = false
$game_temp.common_event_id = $打开自动存档开关之后调用的公共事件
auto_save
end
end
def auto_save
#——这里定义了储存的文件,如果不希望用Save4可以自己修改编号
# 写入存档数据
Screen::shot
file = File.open( DIR+"Save#{$自动存档位置}.rxdata", "wb")
auto_save_data(file)
if FileTest.exist?( DIR+"shot.jpg")
File.rename( DIR+"shot.jpg", DIR+"Save#{$自动存档位置}.jpg")
end
file.close
end
def auto_save_data(file)
#——以下定义内容和Scene_Save的write_save_data(file)完全一样
#——如果你修改过该存档方法,不要忘记用你修改的覆盖这部分内容。
# 生成描绘存档文件用的角色图形
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors
characters.push([actor.character_name, actor.character_hue, actor])
end
# 写入描绘存档文件用的角色数据
Marshal.dump(characters, file)
# 写入测量游戏时间用画面计数
Marshal.dump(Graphics.frame_count, file)
# 增加 1 次存档次数
$game_system.save_count += 1
# 保存魔法编号
# (将编辑器保存的值以随机值替换)
$game_system.magic_number = $data_system.magic_number
# 写入各种游戏对像
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
end
end
DIR = "Save/" # 储存文件夹名,请制作游戏时自行建立此文件夹
module Screen
@screen = Win32API.new 'screenshot', 'Screenshot', %w(l l l l p l l), ''
@readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l
p), 'l'
@findwindow = Win32API.new 'user32', 'FindWindowA', %w(p p), 'l'
module_function
def shot(file = "shot", typ = 1)
# to add the right extension...
if typ == 0
typname = ".bmp"
elsif typ == 1
typname = ".jpg"
elsif typ == 2
typname = ".png"
end
file_index = 0
dir = "Save/"
# make the filename....
file_name = dir + file.to_s + typname.to_s
# make the screenshot.... Attention dont change anything from here on....
@screen.call(0,0,640,480,file_name,handel,typ)
end
# find the game window...
def handel
game_name = "\0" * 256
@readini.call('Game','Title','',game_name,255,".\\Game.ini")
game_name.delete!("\0")
return @findwindow.call('RGSS Player',game_name)
end
end
class Scene_Menu
alias shotsave_main main
def main
if @menu_index == 0
Screen::shot
end
shotsave_main
end
end
return
return
end
end
when 1,2
if Input.trigger?(Input::C)
if @savestate == 1
$menu_call = false
load_file
return
else
# 禁止存档的情况下
if $game_system.save_disabled
@help_window.set_text("当前地图禁止存档.")
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$last_savefile_index = @option_window.index
save_file
return
end
end
# 取消
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = false
@help_window.set_text("请选择.")
@savestate = 0
@option_window.active = true
return
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@savestate = 2
@command_window.active = true
return
end
end
end
#--------------------------------------------------------------------------
# 建立记录文件索引
#--------------------------------------------------------------------------