end
def dispose
super
@sprite.dispose
@backsp.dispose
for i in @sp_ch
i.dispose
end
end
end
$打开自动存档用的开关编号 = 1
$自动存档位置 = 0
$按下F5之后的自动存档的音效 = "Audio/SE/007-System07"
$按下F5之后禁止存档时候的音效 = "Audio/Se/003-System03"
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 = $按下F5之后禁止存档调用的公共事件
else
Audio.se_play($按下F5之后的自动存档的音效)
$game_temp.common_event_id = $按下F5之后可以存档调用的公共事件
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
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面被切换的话就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
# 释放窗口
@command_window.dispose
@content_window.dispose
@confirm_window.dispose
@yes_no_window.dispose
@help_window.dispose
@option_window.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 刷新窗口
@help_window.update
@option_window.update
# @content_window.update
@command_window.update
if @yes_no_window.active
confirm_update
return
end
@content_window.index = @command_window.index
@content_window.refresh
case @savestate
when 0
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
# 淡入淡出 BGM
Audio.bgm_fade(800)
# 返回地图
if $menu_call == false
# 切换到地图画面
$scene = Scene_Map.new
return
end
# 切换到菜单画面
$menu_call = false
$scene = Scene_Menu.new(7)
end
if Input.trigger?(Input::C)
case @option_window.index
when 0
@command_window.active = true
@option_window.active = false
$game_system.se_play($data_system.decision_se)
@help_window.set_text("请选择一个文件进行读取.")
@savestate = 1
return
when 1
@command_window.active = true
@option_window.active = false
$game_system.se_play($data_system.decision_se)
@help_window.set_text("请选择一个文件进行存储.")
@savestate = 2
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
#--------------------------------------------------------------------------
# 建立记录文件索引
#--------------------------------------------------------------------------
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面被切换的话就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
# 释放窗口
@command_window.dispose
@content_window.dispose
@confirm_window.dispose
@yes_no_window.dispose
@help_window.dispose
@option_window.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 刷新窗口
@help_window.update
@option_window.update
# @content_window.update
@command_window.update
if @yes_no_window.active
confirm_update
return
end
@content_window.index = @command_window.index
@content_window.refresh
case @savestate
when 0
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
# 淡入淡出 BGM
Audio.bgm_fade(800)
# 返回地图
if $menu_call == false
# 切换到地图画面
$scene = Scene_Map.new
return
end
# 切换到菜单画面
$menu_call = false
$scene = Scene_Menu.new(7)
end
if Input.trigger?(Input::C)
case @option_window.index
when 0
@command_window.active = true
@option_window.active = false
$game_system.se_play($data_system.decision_se)
@help_window.set_text("请选择一个文件进行读取.")
@savestate = 1
return
when 1
@command_window.active = true
@option_window.active = false
$game_system.se_play($data_system.decision_se)
@help_window.set_text("请选择一个文件进行存储.")
@savestate = 2
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
#--------------------------------------------------------------------------
# 建立记录文件索引
#--------------------------------------------------------------------------