设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 3649|回复: 12
打印 上一主题 下一主题

[已经解决] 请问XP如何增加存档点阿?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
14 小时
注册时间
2014-8-23
帖子
20
跳转到指定楼层
1
发表于 2014-8-26 18:24:24 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
我在网上搜了很多脚本 都没有看明白

Lv4.逐梦者 (版主)

梦石
0
星屑
9532
在线时间
5073 小时
注册时间
2013-6-21
帖子
3580

开拓者贵宾剧作品鉴家

来自 7楼
发表于 2014-8-27 19:53:52 | 只看该作者
本帖最后由 RyanBern 于 2014-8-27 21:43 编辑

存档数增加的脚本很多很乱啊,那我也发一个今天遇到的,看看行不行吧。
这个脚本会把存档存到游戏根目录下一个叫Save的文件夹里,所以使用的时候要新建一个名为Save的文件夹,否则会找不到文件。旧档也可以放在这个文件夹下一起使用。
范例工程: Project8.rar (191.5 KB, 下载次数: 70)
RUBY 代码复制
  1. class Scene_File
  2.   #——最大存档数量
  3.   SAVEFILE_MAX = 100
  4.   # -------------------
  5.   def initialize(help_text)
  6.     @help_text = help_text
  7.   end
  8.   # -------------------
  9.   def main
  10.     @help_window = Window_Help.new
  11.     @help_window.set_text(@help_text)
  12.     @savefile_windows = []
  13.     @cursor_displace = 0
  14.     for i in 0..3
  15.       @savefile_windows.push(Window_SaveFile.new(i, make_filename(i), i))
  16.     end
  17.     @file_index = 0
  18.     @savefile_windows[@file_index].selected = true
  19.     Graphics.transition
  20.     loop do
  21.       Graphics.update
  22.       Input.update
  23.       update
  24.       if $scene != self
  25.         break
  26.       end
  27.     end
  28.     Graphics.freeze
  29.     @help_window.dispose
  30.     for i in @savefile_windows
  31.       i.dispose
  32.     end
  33.   end
  34.   # -------------------
  35.   def update
  36.     @help_window.update
  37.     for i in @savefile_windows
  38.       i.update
  39.     end
  40.     if Input.trigger?(Input::C)
  41.       on_decision(make_filename(@file_index))
  42.       $game_temp.last_file_index = @file_index
  43.       return
  44.     end
  45.     if Input.trigger?(Input::B)
  46.       on_cancel
  47.       return
  48.     end
  49.     if Input.repeat?(Input::DOWN)
  50.       if Input.trigger?(Input::DOWN) or @file_index < SAVEFILE_MAX - 1
  51.         if @file_index == SAVEFILE_MAX - 1
  52.           $game_system.se_play($data_system.buzzer_se)
  53.           return
  54.         end
  55.         @cursor_displace += 1
  56.         if @cursor_displace == 4
  57.           @cursor_displace = 3
  58.           for i in @savefile_windows
  59.             i.dispose
  60.           end
  61.           @savefile_windows = []
  62.           for i in 0..3
  63.             f = i - 2 + @file_index
  64.             name = make_filename(f)
  65.             @savefile_windows.push(Window_SaveFile.new(f, name, i))
  66.             @savefile_windows[i].selected = false
  67.           end
  68.         end
  69.         $game_system.se_play($data_system.cursor_se)
  70.         @file_index = (@file_index + 1)
  71.         if @file_index == SAVEFILE_MAX
  72.           @file_index = SAVEFILE_MAX - 1
  73.         end
  74.         for i in 0..3
  75.           @savefile_windows[i].selected = false
  76.         end
  77.         @savefile_windows[@cursor_displace].selected = true
  78.         return
  79.       end
  80.     end
  81.     if Input.repeat?(Input::UP)
  82.       if Input.trigger?(Input::UP) or @file_index > 0
  83.         if @file_index == 0
  84.           $game_system.se_play($data_system.buzzer_se)
  85.           return
  86.         end
  87.         @cursor_displace -= 1
  88.         if @cursor_displace == -1
  89.           @cursor_displace = 0
  90.           for i in @savefile_windows
  91.             i.dispose
  92.           end
  93.           @savefile_windows = []
  94.           for i in 0..3
  95.             f = i - 1 + @file_index
  96.             name = make_filename(f)
  97.             @savefile_windows.push(Window_SaveFile.new(f, name, i))
  98.             @savefile_windows[i].selected = false
  99.           end
  100.         end
  101.         $game_system.se_play($data_system.cursor_se)
  102.         @file_index = (@file_index - 1)
  103.         if @file_index == -1
  104.           @file_index = 0
  105.         end
  106.         for i in 0..3
  107.           @savefile_windows[i].selected = false
  108.         end
  109.         @savefile_windows[@cursor_displace].selected = true
  110.         return
  111.       end
  112.     end
  113.   end
  114.   # -------------------
  115.   def make_filename(file_index)
  116.     return "Save/Save#{file_index + 1}.rxdata"
  117.   end
  118.   # -------------------
  119. end
  120.  
  121.  
  122.  
  123.  
  124. class Window_SaveFile < Window_Base
  125.   # -------------------
  126.   def initialize(file_index, filename, position)
  127.     y = 64 + position * 104
  128.     super(0, y, 640, 104)
  129.     self.contents = Bitmap.new(width - 32, height - 32)
  130.     @file_index = file_index
  131.     @filename = "Save/Save#{@file_index + 1}.rxdata"
  132.     @time_stamp = Time.at(0)
  133.     @file_exist = FileTest.exist?(@filename)
  134.     if @file_exist
  135.       file = File.open(@filename, "r")
  136.       @time_stamp = file.mtime
  137.       @characters = Marshal.load(file)
  138.       @frame_count = Marshal.load(file)
  139.       @game_system = Marshal.load(file)
  140.       @game_switches = Marshal.load(file)
  141.       @game_variables = Marshal.load(file)
  142.       @total_sec = @frame_count / Graphics.frame_rate
  143.       file.close
  144.     end
  145.     refresh
  146.     @selected = false
  147.   end
  148. end

点评

恩 好的 谢谢你 帮了我大忙啦~  发表于 2014-8-27 22:30
这样干说解决不了问题的,很多脚本之间相互冲突,都需要整合一下。  发表于 2014-8-27 22:06
那就发文件吧,找到Data文件夹下的Scripts.rxdata,然后编辑帖子,那里有个上传附件。具体方法看置顶帖“RMXP提问区帖子发布向导”的2L  发表于 2014-8-27 22:05
你发的那个确实是可用的!我直接用那个重新做算了  发表于 2014-8-27 22:03
还是不可以。。。显示脚本有问题 也是醉了  发表于 2014-8-27 22:01
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
92 小时
注册时间
2010-9-26
帖子
66
2
发表于 2014-8-26 19:25:14 | 只看该作者
请问下..存档点是什么..可以存档的地点?(事件里面第三页有的呼叫存档界面,另外菜单自带存档..)还是要增加存档数量?(这么多不够吗{:2_276:})主站上搜索突破界限之类的就可以找到了
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
14 小时
注册时间
2014-8-23
帖子
20
3
 楼主| 发表于 2014-8-26 20:24:17 | 只看该作者
qdqlloxe 发表于 2014-8-26 19:25
请问下..存档点是什么..可以存档的地点?(事件里面第三页有的呼叫存档界面,另外菜单自带存档..)还是要增 ...

啊 是存档 增加存档数量4个 我基友说不够QwQ
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
14 小时
注册时间
2014-8-23
帖子
20
4
 楼主| 发表于 2014-8-26 20:26:45 | 只看该作者
qdqlloxe 发表于 2014-8-26 19:25
请问下..存档点是什么..可以存档的地点?(事件里面第三页有的呼叫存档界面,另外菜单自带存档..)还是要增 ...

啊 是存档 增加存档数量4个 我基友说不够QwQ
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
92 小时
注册时间
2010-9-26
帖子
66
5
发表于 2014-8-26 20:58:42 | 只看该作者
本帖最后由 qdqlloxe 于 2014-8-26 21:00 编辑

大师包里面的..50个.不够的话自己把0..51后面的51(要全改哟)改成n..然后别忘了添加中文对应就可以了。
RUBY 代码复制下载
  1. class Window_File < Window_Base
  2.   attr_accessor :index
  3.   def initialize(index = 0)
  4.     @backsp = Sprite.new
  5.    # @backsp.bitmap = Bitmap.new("Graphics/Pictures/菜单底图.jpg")
  6.     @backsp.z = 100
  7.     super(160,64,480,416)
  8.     #这行可以不用
  9.     self.contents = Bitmap.new(width - 32, height - 32)
  10.     @index = index
  11.     #这里我要说明一句,之所以用sprite是为了放缩图片
  12.     @sprite = Sprite.new
  13.     @sprite.visible = false
  14.     @sprite.z = 100
  15.     @sp_ch = []
  16.     @sp_ch[0] = Sprite.new
  17.     refresh
  18.   end
  19.   def refresh
  20.     self.contents.clear
  21.     for i in @sp_ch
  22.       i.visible = false
  23.     end
  24.     @sprite.visible = false
  25.     if FileTest.exist?(DIR+"Save#{@index}.rxdata")
  26.       @sprite.visible = true
  27.       if FileTest.exist?(DIR+"Save#{@index}.jpg")
  28.         @sprite.bitmap = Bitmap.new(DIR+"Save#{@index}.jpg")
  29.       else
  30.         self.contents.draw_text(32,64,400,32,"截图似乎有点问题……您搞什么了您?
  31.  
  32. ")
  33.       end
  34.       @sprite.x = 290
  35.       @sprite.y = 96
  36.       @sprite.z = 998
  37.       @sprite.zoom_x = 0.5
  38.       @sprite.zoom_y = 0.5
  39.       file = File.open(DIR+"Save#{@index}.rxdata", "r")
  40.       @time_stamp = file.mtime
  41.       @characters = Marshal.load(file)
  42.       @frame_count = Marshal.load(file)
  43.       @game_system = Marshal.load(file)
  44.       @game_switches = Marshal.load(file)
  45.       @game_variables = Marshal.load(file)
  46.       @total_sec = @frame_count / Graphics.frame_rate
  47.       file.close
  48.       for i in [email]0...@characters.size[/email]
  49.         @sp_ch[i] = Sprite.new
  50.         @sp_ch[i].visible = true
  51.         testname = @characters[i][2].name+"_f"
  52.         @sp_ch[i].bitmap = Bitmap.new("Graphics/battlers/#{testname}")
  53.         @sp_ch[i].zoom_x = 0.8
  54.         @sp_ch[i].zoom_y = 0.8
  55.         @sp_ch[i].x = 180        
  56.         @sp_ch[i].y = 96 + i*90
  57.         @sp_ch[i].z = 101
  58.       end
  59.       # 描绘游戏时间
  60.       hour = @total_sec / 60 / 60
  61.       min = @total_sec / 60 % 60
  62.       sec = @total_sec % 60
  63.       time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  64.       self.contents.font.color = normal_color
  65.       self.contents.draw_text(4, 326, 420, 32, time_string, 2)
  66.       # 描绘时间标记
  67.       self.contents.font.color = normal_color
  68.       time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
  69.       self.contents.draw_text(4, 356, 420, 32, time_string, 2)
  70.     else
  71.       self.contents.draw_text(32,32,420,32,"这个存档是空的")
  72.     end
  73.  
  74.   end
  75.   def dispose
  76.     super
  77.     @sprite.dispose
  78.     @backsp.dispose
  79.     for i in @sp_ch
  80.       i.dispose
  81.     end
  82.   end
  83. end
  84.  
  85.  
  86. class Window_File2 < Window_Base
  87.   attr_accessor :index
  88.   def initialize(index = 0)
  89.     @backsp = Sprite.new
  90.    # @backsp.bitmap = Bitmap.new("Graphics/Pictures/菜单底图.jpg")
  91.     @backsp.z = 100
  92.     super(160,0,480,480)
  93.     #这行可以不用
  94.     self.contents = Bitmap.new(width - 32, height - 32)
  95.     @index = index
  96.     #这里我要说明一句,之所以用sprite是为了放缩图片
  97.     @sprite = Sprite.new
  98.     @sprite.visible = false
  99.     @sprite.z = 100
  100.     @sp_ch = []
  101.     @sp_ch[0] = Sprite.new
  102.     refresh
  103.   end
  104.   def refresh
  105.     self.contents.clear
  106.     for i in @sp_ch
  107.       i.visible = false
  108.     end
  109.     @sprite.visible = false
  110.     if FileTest.exist?(DIR+"Save#{@index}.rxdata")
  111.       @sprite.visible = true
  112.       if FileTest.exist?(DIR+"Save#{@index}.jpg")
  113.         @sprite.bitmap = Bitmap.new(DIR+"Save#{@index}.jpg")
  114.       else
  115.         self.contents.draw_text(32,64,400,32,"截图似乎有点问题……您搞什么了您?
  116.  
  117. ")
  118.       end
  119.       @sprite.x = 290
  120.       @sprite.y = 32
  121.       @sprite.z = 998
  122.       @sprite.zoom_x = 0.5
  123.       @sprite.zoom_y = 0.5
  124.       file = File.open(DIR+"Save#{@index}.rxdata", "r")
  125.       @time_stamp = file.mtime
  126.       @characters = Marshal.load(file)
  127.       @frame_count = Marshal.load(file)
  128.       @game_system = Marshal.load(file)
  129.       @game_switches = Marshal.load(file)
  130.       @game_variables = Marshal.load(file)
  131.       @total_sec = @frame_count / Graphics.frame_rate
  132.       file.close
  133.       for i in [email]0...@characters.size[/email]
  134.         @sp_ch[i] = Sprite.new
  135.         @sp_ch[i].visible = true
  136.         testname = @characters[i][2].name+"_f"
  137.         @sp_ch[i].bitmap = Bitmap.new("Graphics/battlers/#{testname}")
  138.         @sp_ch[i].x = 180        
  139.         @sp_ch[i].y = 32 + i*110
  140.         @sp_ch[i].z = 101
  141.       end
  142.       # 描绘游戏时间
  143.       hour = @total_sec / 60 / 60
  144.       min = @total_sec / 60 % 60
  145.       sec = @total_sec % 60
  146.       time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  147.       self.contents.font.color = normal_color
  148.       self.contents.draw_text(4, 390, 420, 32, time_string, 2)
  149.       # 描绘时间标记
  150.       self.contents.font.color = normal_color
  151.       time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
  152.       self.contents.draw_text(4, 420, 420, 32, time_string, 2)
  153.     else
  154.       self.contents.draw_text(32,32,420,32,"这个存档是空的")
  155.     end
  156.  
  157.   end
  158.   def dispose
  159.     super
  160.     @sprite.dispose
  161.     @backsp.dispose
  162.     for i in @sp_ch
  163.       i.dispose
  164.     end
  165.   end
  166. end
  167.  
  168.  
  169.  
  170. $打开自动存档用的开关编号 = 1
  171. $自动存档位置 = 0
  172. $按下F5之后的自动存档的音效 = "Audio/SE/007-System07"
  173. $按下F5之后禁止存档时候的音效 = "Audio/Se/003-System03"
  174. DIR = "Save/"
  175. $打开自动存档开关之后调用的公共事件 = 0 #——默认未定义
  176. $按下F5之后可以存档调用的公共事件 = 0 #——默认未定义
  177. $按下F5之后禁止存档调用的公共事件 = 0 #——默认未定义
  178. class Scene_Map
  179. alias auto_update update
  180. def update
  181. auto_update
  182. #——按下F5的时候自动存档,可以修改为F5,F6,F7,F8,也可以修改成默认按键但是不推荐。
  183. #——注意在不可存档的时候是无效的
  184. if Input.trigger?(Input::F5)
  185.    unless $game_system.map_interpreter.running?
  186.    if $game_system.save_disabled
  187.      Audio.se_play($按下F5之后禁止存档时候的音效)
  188.      $game_temp.common_event_id = $按下F5之后禁止存档调用的公共事件
  189.    else
  190.      Audio.se_play($按下F5之后的自动存档的音效)
  191.      $game_temp.common_event_id = $按下F5之后可以存档调用的公共事件
  192.      auto_save
  193.    end
  194.    end
  195. end
  196. #——当BOSS战之前打开一下定义的开关,即可自动存档
  197. if $game_switches[$打开自动存档用的开关编号] == true
  198.    $game_switches[$打开自动存档用的开关编号] = false
  199.    $game_temp.common_event_id = $打开自动存档开关之后调用的公共事件
  200.    auto_save
  201. end
  202. end
  203. def auto_save
  204. #——这里定义了储存的文件,如果不希望用Save4可以自己修改编号
  205. # 写入存档数据
  206. Screen::shot
  207.      file = File.open( DIR+"Save#{$自动存档位置}.rxdata", "wb")
  208.      auto_save_data(file)
  209.      if FileTest.exist?( DIR+"shot.jpg")
  210.        File.rename( DIR+"shot.jpg", DIR+"Save#{$自动存档位置}.jpg")
  211.      end
  212.      file.close
  213. end
  214. def auto_save_data(file)
  215. #——以下定义内容和Scene_Save的write_save_data(file)完全一样
  216. #——如果你修改过该存档方法,不要忘记用你修改的覆盖这部分内容。
  217. # 生成描绘存档文件用的角色图形
  218. characters = []
  219. for i in 0...$game_party.actors.size
  220.    actor = $game_party.actors[i]
  221.    characters.push([actor.character_name, actor.character_hue, actor])
  222. end
  223. # 写入描绘存档文件用的角色数据
  224. Marshal.dump(characters, file)
  225. # 写入测量游戏时间用画面计数
  226. Marshal.dump(Graphics.frame_count, file)
  227. # 增加 1 次存档次数
  228. $game_system.save_count += 1
  229. # 保存魔法编号
  230. # (将编辑器保存的值以随机值替换)
  231. $game_system.magic_number = $data_system.magic_number
  232. # 写入各种游戏对像
  233. Marshal.dump($game_system, file)
  234. Marshal.dump($game_switches, file)
  235. Marshal.dump($game_variables, file)
  236. Marshal.dump($game_self_switches, file)
  237. Marshal.dump($game_screen, file)
  238. Marshal.dump($game_actors, file)
  239. Marshal.dump($game_party, file)
  240. Marshal.dump($game_troop, file)
  241. Marshal.dump($game_map, file)
  242. Marshal.dump($game_player, file)
  243. end
  244. end
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252. DIR = "Save/"  # 储存文件夹名,请制作游戏时自行建立此文件夹
  253.  
  254.  
  255. module Screen  
  256.   @screen = Win32API.new 'screenshot', 'Screenshot', %w(l l l l p l l), ''
  257.   @readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l
  258.  
  259. p), 'l'
  260.   @findwindow = Win32API.new 'user32', 'FindWindowA', %w(p p), 'l'
  261.   module_function
  262.   def shot(file = "shot", typ = 1)
  263.     # to add the right extension...
  264.     if typ == 0
  265.       typname = ".bmp"
  266.     elsif typ == 1
  267.       typname = ".jpg"
  268.     elsif typ == 2
  269.       typname = ".png"
  270.     end   
  271.     file_index = 0   
  272.     dir = "Save/"   
  273.     # make the filename....
  274.     file_name = dir + file.to_s + typname.to_s   
  275.     # make the screenshot.... Attention dont change anything from here on....
  276.     @screen.call(0,0,640,480,file_name,handel,typ)
  277.   end
  278.   # find the game window...
  279.   def handel
  280.     game_name = "\0" * 256
  281.     @readini.call('Game','Title','',game_name,255,".\\Game.ini")
  282.     game_name.delete!("\0")
  283.     return @findwindow.call('RGSS Player',game_name)
  284.   end
  285. end
  286.  
  287.  
  288. class Scene_Menu
  289.   alias shotsave_main main
  290.   def main
  291.     if @menu_index == 0
  292.       Screen::shot
  293.     end   
  294.     shotsave_main
  295.   end
  296. end
  297.  
  298. class Interpreter
  299.   #--------------------------------------------------------------------------
  300.   # ● 调用存档画面
  301.   #--------------------------------------------------------------------------
  302.   def command_352
  303.     # 设置战斗中断标志
  304.     $game_temp.battle_abort = true
  305.     # 设置调用存档标志
  306.     $game_temp.save_calling = true
  307.     # 推进索引
  308.     @index += 1
  309.     # 结束
  310.     Screen::shot
  311.     return false
  312.   end
  313. end
  314.  
  315. #==============================================================================
  316. # ■ Scene_Load
  317. #------------------------------------------------------------------------------
  318. #  处理读档画面的类。
  319. #==============================================================================
  320.  
  321. class Scene_Load
  322.   #--------------------------------------------------------------------------
  323.   # ● 初始化对像
  324.   #--------------------------------------------------------------------------
  325.   def initialize
  326.     # 再生成临时对像
  327.     $game_temp = Game_Temp.new
  328.     # 选择存档时间最新的文件
  329.     $game_temp.last_file_index = 0
  330.     latest_time = Time.at(0)
  331.     for i in 0..51
  332.       filename = DIR+"Save#{i}.rxdata"
  333.       if FileTest.exist?(filename)
  334.         file = File.open(filename, "r")
  335.         if file.mtime > latest_time
  336.           latest_time = file.mtime
  337.           $game_temp.last_file_index = i
  338.         end
  339.         file.close
  340.       end
  341.     end
  342.   end  
  343.   def main
  344.     @command_window = Window_Command.new(160,["自动存档","进度一","进度二",
  345.     "进度三","进度四","进度五","进度六","进度七","进度八","进度九","进度十",
  346.     "进度十一","进度十二","进度十三","进度十四","进度十五","进度十六",
  347.     "进度十七","进度十八","进度十九","进度二十","进度二一","进度二二",
  348.     "进度二三","进度二四","进度二五","进度二六","进度二七","进度二八",
  349.     "进度二九","进度三十","进度三一","进度三二","进度三三","进度三四",
  350.     "进度三五","进度三六","进度三七","进度三八","进度三九","进度四十",
  351.     "进度四一","进度四二","进度四三","进度四四","进度四五","进度四六",
  352.     "进度四七","进度四八","进度四九","进度五十"])
  353.     @command_window.y = 0
  354.     @command_window.height = 480
  355.     @command_window.index = $game_temp.last_file_index
  356.     @content_window = Window_File2.new($game_temp.last_file_index)
  357.     # 执行过渡
  358.     Graphics.transition
  359.     # 主循环
  360.     loop do
  361.       # 刷新游戏画面
  362.       Graphics.update
  363.       # 刷新输入信息
  364.       Input.update
  365.       # 刷新画面
  366.       update
  367.       # 如果画面被切换的话就中断循环
  368.       if $scene != self
  369.         break
  370.       end
  371.     end
  372.     # 准备过渡
  373.     Graphics.freeze
  374.     @command_window.dispose
  375.     @content_window.dispose
  376.   end
  377.   def update
  378.     @command_window.update
  379.     if @command_window.index != @content_window.index
  380.       @content_window.index = @command_window.index
  381.       @content_window.refresh
  382.     end   
  383.     #——————下面这一部分是原装脚本——————#
  384.     if Input.trigger?(Input::B)  
  385.     # 演奏取消 SE
  386.     $game_system.se_play($data_system.cancel_se)
  387.     # 切换到标题画面
  388.     $scene = Scene_Title.new
  389.     end   
  390.     #———————————————————————#   
  391.     if Input.trigger?(Input::C)
  392.       # 文件不存在的情况下
  393.       unless FileTest.exist?(DIR+"Save#{@command_window.index}.rxdata")
  394.         # 演奏冻结 SE
  395.         $game_system.se_play($data_system.buzzer_se)
  396.         return
  397.       end
  398.       # 演奏读档 SE
  399.       $game_system.se_play($data_system.load_se)
  400.       # 写入存档数据
  401.       file = File.open(DIR+"Save#{@command_window.index}.rxdata",
  402.  
  403. "rb")
  404.       read_save_data(file)
  405.       file.close
  406.       # 还原 BGM、BGS
  407.       $game_system.bgm_play($game_system.playing_bgm)
  408.       $game_system.bgs_play($game_system.playing_bgs)
  409.       # 刷新地图 (执行并行事件)
  410.       $game_map.update
  411.       # 切换到地图画面
  412.       $scene = Scene_Map.new
  413.     end
  414.     #———————————————————————#
  415.   end
  416.   #--------------------------------------------------------------------------
  417.   # ● 写入存档数据
  418.   #     file : 写入用文件对像 (已经打开)
  419.   #--------------------------------------------------------------------------
  420.   def read_save_data(file)
  421.     # 读取描绘存档文件用的角色数据
  422.     characters = Marshal.load(file)
  423.     # 读取测量游戏时间用画面计数
  424.     Graphics.frame_count = Marshal.load(file)
  425.     # 读取各种游戏对像
  426.     $game_system        = Marshal.load(file)
  427.     $game_switches      = Marshal.load(file)
  428.     $game_variables     = Marshal.load(file)
  429.     $game_self_switches = Marshal.load(file)
  430.     $game_screen        = Marshal.load(file)
  431.     $game_actors        = Marshal.load(file)
  432.     $game_party         = Marshal.load(file)
  433.     $game_troop         = Marshal.load(file)
  434.     $game_map           = Marshal.load(file)
  435.     $game_player        = Marshal.load(file)
  436.     # 魔法编号与保存时有差异的情况下
  437.     # (加入编辑器的编辑过的数据)
  438.     if $game_system.magic_number != $data_system.magic_number
  439.       # 重新装载地图
  440.       $game_map.setup($game_map.map_id)
  441.       $game_player.center($game_player.x, $game_player.y)
  442.     end
  443.     # 刷新同伴成员
  444.     $game_party.refresh
  445.   end
  446. end
  447.  
  448. #==============================================================================
  449. #  Window_LoadCommand
  450. #------------------------------------------------------------------------------
  451. #  存取档画面选择按钮窗口
  452. #==============================================================================
  453.  
  454. class Window_LoadCommand < Window_Selectable
  455. #--------------------------------------------------------------------------
  456. #  初始化对象
  457. #--------------------------------------------------------------------------
  458. def initialize
  459.   super(320, 0, 320, 64)
  460.   self.contents = Bitmap.new(width - 32, height - 32)
  461.   @item_max = 2
  462.   @column_max = 2
  463.   @commands = ["读取", "存储"]
  464.   refresh
  465.   self.index = 0
  466. end
  467. #--------------------------------------------------------------------------
  468. #  刷新
  469. #--------------------------------------------------------------------------
  470. def refresh
  471.   self.contents.clear
  472.   for i in 0...@item_max
  473.     draw_item(i)
  474.   end
  475. end
  476. #--------------------------------------------------------------------------
  477. #  描画按钮文字
  478. #--------------------------------------------------------------------------
  479. def draw_item(index)
  480.   x = 4 + index * 160
  481.   self.contents.draw_text(x, 0, 144, 32, @commands[index])
  482. end
  483. #--------------------------------------------------------------------------
  484. # ● 项目无效化
  485. #     index : 项目编号
  486. #--------------------------------------------------------------------------
  487.   def disable_item(index)
  488.     draw_item(index, disabled_color)
  489.   end
  490.  
  491. end
  492.  
  493. #==============================================================================
  494. #  Scene_Loadsave
  495. #------------------------------------------------------------------------------
  496. # 处理存取档画面的类。
  497. #==============================================================================
  498.  
  499. class Scene_Loadsave
  500. #--------------------------------------------------------------------------
  501. # ● 初始化对像
  502. #     $last_savefile_index : 记录光标位置
  503. #--------------------------------------------------------------------------
  504.   def initialize
  505.     $last_savefile_index = 0 if $last_savefile_index == nil
  506.     # 再生成临时对像
  507.     $game_temp = Game_Temp.new
  508.     # 选择存档时间最新的文件
  509.     $game_temp.last_file_index = 0
  510.     latest_time = Time.at(0)
  511.     for i in 0..51
  512.       filename = DIR+"Save#{i}.rxdata"
  513.       if FileTest.exist?(filename)
  514.         file = File.open(filename, "r")
  515.         if file.mtime > latest_time
  516.           latest_time = file.mtime
  517.           $game_temp.last_file_index = i
  518.         end
  519.         file.close
  520.       end
  521.     end
  522.   end
  523. #--------------------------------------------------------------------------
  524. #  主处理
  525. #--------------------------------------------------------------------------
  526.   def main
  527.     @savestate = 0
  528.     # 生成窗口
  529.     @help_window = Window_LoadHelp.new
  530.     @help_window.set_text("请选择.")
  531.     @option_window = Window_LoadCommand.new
  532.     @option_window.index = $last_savefile_index
  533.  
  534.     ########################################################
  535.     @command_window = Window_Command.new(160,["自动存档","进度一","进度二",
  536.       "进度三","进度四","进度五","进度六","进度七","进度八","进度九","进度十",
  537.       "进度十一","进度十二","进度十三","进度十四","进度十五","进度十六",
  538.       "进度十七","进度十八","进度十九","进度二十","进度二一","进度二二",
  539.       "进度二三","进度二四","进度二五","进度二六","进度二七","进度二八",
  540.       "进度二九","进度三十","进度三一","进度三二","进度三三","进度三四",
  541.       "进度三五","进度三六","进度三七","进度三八","进度三九","进度四十",
  542.       "进度四一","进度四二","进度四三","进度四四","进度四五","进度四六",
  543.       "进度四七","进度四八","进度四九","进度五十"])
  544.       @command_window.y = 64
  545.       @command_window.height = 416
  546.       @command_window.index = $game_temp.last_file_index
  547.       @content_window = Window_File.new($game_temp.last_file_index)
  548.       @command_window.active = false
  549.         ###############覆盖存档
  550.         @confirm_window = Window_Base.new(120, 188, 400, 64)
  551.         @confirm_window.contents = Bitmap.new(368, 32)
  552.         string = "确定要覆盖这个进度吗?"
  553.         @confirm_window.contents.font.name = "黑体"
  554.         @confirm_window.contents.font.size = 24
  555.         @confirm_window.contents.draw_text(4, 0, 368, 32, string)
  556.         @yes_no_window = Window_Command.new(100, ["覆盖", "取消"])
  557.         @confirm_window.z = 1500
  558.         @yes_no_window.index = 1
  559.         @yes_no_window.x = 270
  560.         @yes_no_window.y = 252
  561.         @yes_no_window.z = 1500
  562.         @confirm_window.visible = false
  563.         @yes_no_window.visible = false
  564.         @yes_no_window.active = false
  565.  
  566.     # 执行过渡
  567.     Graphics.transition
  568.     # 主循环
  569.     loop do
  570.       # 刷新游戏画面
  571.       Graphics.update
  572.       # 刷新输入信息
  573.       Input.update
  574.       # 刷新画面
  575.       update
  576.       # 如果画面被切换的话就中断循环
  577.       if $scene != self
  578.         break
  579.       end
  580.     end
  581.     # 准备过渡
  582.     Graphics.freeze
  583.     # 释放窗口
  584.     @command_window.dispose
  585.     @content_window.dispose
  586.     @confirm_window.dispose
  587.     @yes_no_window.dispose
  588.     @help_window.dispose
  589.     @option_window.dispose
  590.  
  591.   end
  592.  
  593. #--------------------------------------------------------------------------
  594. #  ● 刷新画面
  595. #--------------------------------------------------------------------------
  596.   def update
  597.     # 刷新窗口
  598.     @help_window.update
  599.     @option_window.update
  600. #   @content_window.update
  601.     @command_window.update
  602.     if @yes_no_window.active
  603.         confirm_update
  604.         return
  605.     end
  606.     @content_window.index = @command_window.index
  607.     @content_window.refresh
  608.     case @savestate
  609.     when 0
  610.         if Input.trigger?(Input::B)
  611.         $game_system.se_play($data_system.cancel_se)
  612.         # 淡入淡出 BGM
  613.         Audio.bgm_fade(800)
  614.         # 返回地图
  615.         if $menu_call == false
  616.         # 切换到地图画面
  617.         $scene = Scene_Map.new
  618.           return
  619.         end
  620.         # 切换到菜单画面
  621.         $menu_call = false
  622.         $scene = Scene_Menu.new(7)
  623.      end
  624.       if Input.trigger?(Input::C)
  625.         case @option_window.index
  626.         when 0
  627.           @command_window.active = true
  628.           @option_window.active = false
  629.           $game_system.se_play($data_system.decision_se)
  630.           @help_window.set_text("请选择一个文件进行读取.")
  631.           @savestate  = 1
  632.           return
  633.         when 1
  634.           @command_window.active = true
  635.           @option_window.active = false
  636.           $game_system.se_play($data_system.decision_se)
  637.           @help_window.set_text("请选择一个文件进行存储.")
  638.           @savestate = 2
  639.  
  640.           return
  641.         return
  642.         end
  643.       end
  644.     when 1,2
  645.       if Input.trigger?(Input::C)
  646.         if @savestate == 1
  647.           $menu_call = false
  648.           load_file
  649.           return
  650.         else
  651.           # 禁止存档的情况下
  652.           if $game_system.save_disabled
  653.             @help_window.set_text("抱歉,这里禁止存储.")
  654.             # 演奏冻结 SE
  655.             $game_system.se_play($data_system.buzzer_se)
  656.             return
  657.           end
  658.          $game_system.se_play($data_system.decision_se)
  659.          $last_savefile_index = @option_window.index
  660.  
  661.          save_file
  662.           return
  663.         end
  664.       end
  665.       # 取消
  666.       if Input.trigger?(Input::B)
  667.         $game_system.se_play($data_system.cancel_se)
  668.         @command_window.active = false
  669.         @help_window.set_text("请选择.")
  670.         @savestate = 0
  671.         @option_window.active = true
  672.         return
  673.       end
  674.  
  675.       if Input.trigger?(Input::B)
  676.         $game_system.se_play($data_system.cancel_se)
  677.         @savestate = 2
  678.         @command_window.active = true
  679.  
  680.         return
  681.       end
  682.     end
  683.   end
  684. #--------------------------------------------------------------------------
  685. # 建立记录文件索引
  686. #--------------------------------------------------------------------------
  687.  
  688. #--------------------------------------------------------------------------
  689. #  读取记录文件
  690. #     filename  : 被读取文件
  691. #--------------------------------------------------------------------------
  692. def load_file
  693.       # 文件不存在的情况下
  694.       unless FileTest.exist?(DIR+"Save#{@command_window.index}.rxdata")
  695.         # 演奏冻结 SE
  696.         $game_system.se_play($data_system.buzzer_se)
  697.         return
  698.       end
  699.       # 演奏读档 SE
  700.       $game_system.se_play($data_system.load_se)
  701.       # 写入存档数据
  702.       file = File.open(DIR+"Save#{@command_window.index}.rxdata", "rb")
  703.       read_save_data(file)
  704.       file.close
  705.       # 还原 BGM、BGS
  706.       $game_system.bgm_play($game_system.playing_bgm)
  707.       $game_system.bgs_play($game_system.playing_bgs)
  708.       # 刷新地图 (执行并行事件)
  709.       $game_map.update
  710.       # 切换到地图画面
  711.       $scene = Scene_Map.new
  712. end
  713. #--------------------------------------------------------------------------
  714. # ● 读取存档数据
  715. #     file : 读取用文件对像 (已经打开)
  716. #--------------------------------------------------------------------------
  717.   def read_save_data(file)
  718.     # 读取描绘存档文件用的角色数据
  719.     characters = Marshal.load(file)
  720.     # 读取测量游戏时间用画面计数
  721.     Graphics.frame_count = Marshal.load(file)
  722.     # 读取各种游戏对像
  723.     $game_system        = Marshal.load(file)
  724.     $game_switches      = Marshal.load(file)
  725.     $game_variables     = Marshal.load(file)
  726.     $game_self_switches = Marshal.load(file)
  727.     $game_screen        = Marshal.load(file)
  728.     $game_actors        = Marshal.load(file)
  729.     $game_party         = Marshal.load(file)
  730.     $game_troop         = Marshal.load(file)
  731.     $game_map           = Marshal.load(file)
  732.     $game_player        = Marshal.load(file)
  733.     # 魔法编号与保存时有差异的情况下
  734.     # (加入编辑器的编辑过的数据)
  735.     if $game_system.magic_number != $data_system.magic_number
  736.       # 重新装载地图
  737.       $game_map.setup($game_map.map_id)
  738.       $game_player.center($game_player.x, $game_player.y)
  739.     end
  740.     # 刷新同伴成员
  741.     $game_party.refresh
  742.   end
  743.   #--------------------------------------------------------------------------
  744.   # ● 写入存档文件
  745.   #--------------------------------------------------------------------------
  746.   def save_file
  747.     if Input.trigger?(Input::C)
  748.       unless FileTest.exist?(DIR+"Save#{@command_window.index}.rxdata")
  749.         # 演奏冻结 SE
  750.         # 演奏存档 SE
  751.           $game_system.se_play($data_system.save_se)
  752.           # 写入存档数据
  753.           file = File.open(DIR+"Save#{@command_window.index}.rxdata", "wb")
  754.           write_save_data(file)
  755.           if FileTest.exist?(DIR+"shot.jpg")
  756.             File.rename(DIR+"shot.jpg", DIR+"Save#{@command_window.index}.jpg")
  757.           end
  758.           file.close
  759.           $game_temp.last_file_index = @command_window.index
  760.           # 如果被事件调用
  761.           if $game_temp.save_calling
  762.             # 清除存档调用标志
  763.             $game_temp.save_calling = false
  764.             @confirm_window.dispose
  765.             # 切换到地图画面
  766.             $scene = Scene_Map.new   
  767.             return
  768.           end
  769.         # 切换到菜单画面
  770.           $scene = Scene_Map.new  
  771.       end
  772.       @yes_no_window.active = true
  773.       @command_window.active = false            
  774.     end
  775.     #———————————————————————#     
  776.   end
  777.   #-------------------------------------------------------------------
  778.   def confirm_update
  779.     @command_index = @command_window.index
  780.     @confirm_window.visible = true
  781.     @confirm_window.z = 1500
  782.     @yes_no_window.visible = true
  783.     @yes_no_window.active = true
  784.     @yes_no_window.z = 1500
  785.     @yes_no_window.update
  786.     if Input.trigger?(Input::C)
  787.       if @yes_no_window.index == 0
  788.           #######################################################
  789.           # 演奏存档 SE
  790.           $game_system.se_play($data_system.save_se)
  791.           # 写入存档数据
  792.           file = File.open(DIR+"Save#{@command_window.index}.rxdata",
  793.  
  794. "wb")
  795.           write_save_data(file)
  796.           if FileTest.exist?(DIR+"shot.jpg")
  797.             File.rename(DIR+"shot.jpg", DIR+"Save#{@command_window.index}.jpg")
  798.           end
  799.           file.close
  800.           $game_temp.last_file_index = @command_window.index
  801.           # 如果被事件调用
  802.           if $game_temp.save_calling
  803.             # 清除存档调用标志
  804.             $game_temp.save_calling = false
  805.             @confirm_window.dispose
  806.             @content_window.dispose
  807.             # 切换到地图画面
  808.             $scene = Scene_Map.new
  809.  
  810.             return
  811.           end
  812.         # 切换到菜单画面
  813.           $scene = Scene_Map.new        
  814.         else
  815.         $game_system.se_play($data_system.cancel_se)
  816.         @yes_no_window.active = false
  817.         @command_window.active = true
  818.         end
  819.     end
  820.     if Input.trigger?(Input::B)
  821.       $game_system.se_play($data_system.cancel_se)
  822.       @yes_no_window.active = false
  823.       @command_window.active = true
  824.     end
  825.   end
  826.   #--------------------------------------------------------------------------
  827.   # ● 写入存档数据
  828.   #     file : 写入用文件对像 (已经打开)
  829.   #--------------------------------------------------------------------------
  830.   def write_save_data(file)
  831.     # 生成描绘存档文件用的角色图形
  832.     characters = []
  833.     for i in 0...$game_party.actors.size
  834.       actor = $game_party.actors[i]
  835.       characters.push([actor.character_name, actor.character_hue, actor])
  836.     end
  837.     # 写入描绘存档文件用的角色数据
  838.     Marshal.dump(characters, file)
  839.     # 写入测量游戏时间用画面计数
  840.     Marshal.dump(Graphics.frame_count, file)
  841.     # 增加 1 次存档次数
  842.     $game_system.save_count += 1
  843.     # 保存魔法编号
  844.     # (将编辑器保存的值以随机值替换)
  845.     $game_system.magic_number = $data_system.magic_number
  846.     # 写入各种游戏对像
  847.     Marshal.dump($game_system, file)
  848.     Marshal.dump($game_switches, file)
  849.     Marshal.dump($game_variables, file)
  850.     Marshal.dump($game_self_switches, file)
  851.     Marshal.dump($game_screen, file)
  852.     Marshal.dump($game_actors, file)
  853.     Marshal.dump($game_party, file)
  854.     Marshal.dump($game_troop, file)
  855.     Marshal.dump($game_map, file)
  856.     Marshal.dump($game_player, file)
  857.   end
  858. end
  859.  
  860. #==============================================================================
  861. # ■ Window_LoadHelp
  862. #------------------------------------------------------------------------------
  863. #  存取档画面帮助信息的显示窗口。
  864. #==============================================================================
  865.  
  866. class Window_LoadHelp < Window_Base
  867. #--------------------------------------------------------------------------
  868. #  初始化对象
  869. #--------------------------------------------------------------------------
  870. def initialize
  871.   super(0, 0, 320, 64)
  872.   self.contents = Bitmap.new(width - 32, height - 32)
  873. end
  874. #--------------------------------------------------------------------------
  875. #  刷新文本
  876. #--------------------------------------------------------------------------
  877. def set_text(text, align = 1)
  878.   if text != @text or align != @align
  879.     self.contents.clear
  880.     self.contents.font.color = normal_color
  881.     self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
  882.     @text = text
  883.     @align = align
  884.     @actor = nil
  885.   end
  886.   self.visible = true
  887. end
  888. end
  889.  
  890. #==============================================================================
  891. #  Scene_Loadsave
  892. #------------------------------------------------------------------------------
  893. # 处理存取档画面的类。
  894. #==============================================================================
  895.  
  896. class Scene_Loadsave
  897. #--------------------------------------------------------------------------
  898. # ● 初始化对像
  899. #     $last_savefile_index : 记录光标位置
  900. #--------------------------------------------------------------------------
  901.   def initialize
  902.     $last_savefile_index = 0 if $last_savefile_index == nil
  903.     # 再生成临时对像
  904.     $game_temp = Game_Temp.new
  905.     # 选择存档时间最新的文件
  906.     $game_temp.last_file_index = 0
  907.     latest_time = Time.at(0)
  908.     for i in 0..51
  909.       filename = DIR+"Save#{i}.rxdata"
  910.       if FileTest.exist?(filename)
  911.         file = File.open(filename, "r")
  912.         if file.mtime > latest_time
  913.           latest_time = file.mtime
  914.           $game_temp.last_file_index = i
  915.         end
  916.         file.close
  917.       end
  918.     end
  919.   end
  920. #--------------------------------------------------------------------------
  921. #  主处理
  922. #--------------------------------------------------------------------------
  923.   def main
  924.     @savestate = 0
  925.     # 生成窗口
  926.     @help_window = Window_LoadHelp.new
  927.     @help_window.set_text("请选择.")
  928.     @option_window = Window_LoadCommand.new
  929.     @option_window.index = $last_savefile_index
  930.  
  931.     ########################################################
  932.     @command_window = Window_Command.new(160,["自动存档","进度一","进度二",
  933.       "进度三","进度四","进度五","进度六","进度七","进度八","进度九","进度十",
  934.       "进度十一","进度十二","进度十三","进度十四","进度十五","进度十六",
  935.       "进度十七","进度十八","进度十九","进度二十","进度二一","进度二二",
  936.       "进度二三","进度二四","进度二五","进度二六","进度二七","进度二八",
  937.       "进度二九","进度三十","进度三一","进度三二","进度三三","进度三四",
  938.       "进度三五","进度三六","进度三七","进度三八","进度三九","进度四十",
  939.       "进度四一","进度四二","进度四三","进度四四","进度四五","进度四六",
  940.       "进度四七","进度四八","进度四九","进度五十"])
  941.       @command_window.y = 64
  942.       @command_window.height = 416
  943.       @command_window.index = $game_temp.last_file_index
  944.       @content_window = Window_File.new($game_temp.last_file_index)
  945.       @command_window.active = false
  946.         ###############覆盖存档
  947.         @confirm_window = Window_Base.new(120, 188, 400, 64)
  948.         @confirm_window.contents = Bitmap.new(368, 32)
  949.         string = "确定要覆盖这个进度吗?"
  950.         @confirm_window.contents.font.name = "黑体"
  951.         @confirm_window.contents.font.size = 24
  952.         @confirm_window.contents.draw_text(4, 0, 368, 32, string)
  953.         @yes_no_window = Window_Command.new(100, ["覆盖", "取消"])
  954.         @confirm_window.z = 1500
  955.         @yes_no_window.index = 1
  956.         @yes_no_window.x = 270
  957.         @yes_no_window.y = 252
  958.         @yes_no_window.z = 1500
  959.         @confirm_window.visible = false
  960.         @yes_no_window.visible = false
  961.         @yes_no_window.active = false
  962.  
  963.     # 执行过渡
  964.     Graphics.transition
  965.     # 主循环
  966.     loop do
  967.       # 刷新游戏画面
  968.       Graphics.update
  969.       # 刷新输入信息
  970.       Input.update
  971.       # 刷新画面
  972.       update
  973.       # 如果画面被切换的话就中断循环
  974.       if $scene != self
  975.         break
  976.       end
  977.     end
  978.     # 准备过渡
  979.     Graphics.freeze
  980.     # 释放窗口
  981.     @command_window.dispose
  982.     @content_window.dispose
  983.     @confirm_window.dispose
  984.     @yes_no_window.dispose
  985.     @help_window.dispose
  986.     @option_window.dispose
  987.  
  988.   end
  989.  
  990. #--------------------------------------------------------------------------
  991. #  ● 刷新画面
  992. #--------------------------------------------------------------------------
  993.   def update
  994.     # 刷新窗口
  995.     @help_window.update
  996.     @option_window.update
  997. #   @content_window.update
  998.     @command_window.update
  999.     if @yes_no_window.active
  1000.         confirm_update
  1001.         return
  1002.     end
  1003.     @content_window.index = @command_window.index
  1004.     @content_window.refresh
  1005.     case @savestate
  1006.     when 0
  1007.         if Input.trigger?(Input::B)
  1008.         $game_system.se_play($data_system.cancel_se)
  1009.         # 淡入淡出 BGM
  1010.         Audio.bgm_fade(800)
  1011.         # 返回地图
  1012.         if $menu_call == false
  1013.         # 切换到地图画面
  1014.         $scene = Scene_Map.new
  1015.           return
  1016.         end
  1017.         # 切换到菜单画面
  1018.         $menu_call = false
  1019.         $scene = Scene_Menu.new(7)
  1020.      end
  1021.       if Input.trigger?(Input::C)
  1022.         case @option_window.index
  1023.         when 0
  1024.           @command_window.active = true
  1025.           @option_window.active = false
  1026.           $game_system.se_play($data_system.decision_se)
  1027.           @help_window.set_text("请选择一个文件进行读取.")
  1028.           @savestate  = 1
  1029.           return
  1030.         when 1
  1031.           @command_window.active = true
  1032.           @option_window.active = false
  1033.           $game_system.se_play($data_system.decision_se)
  1034.           @help_window.set_text("请选择一个文件进行存储.")
  1035.           @savestate = 2
  1036.  
  1037.           return
  1038.         return
  1039.         end
  1040.       end
  1041.     when 1,2
  1042.       if Input.trigger?(Input::C)
  1043.         if @savestate == 1
  1044.           $menu_call = false
  1045.           load_file
  1046.           return
  1047.         else
  1048.           # 禁止存档的情况下
  1049.           if $game_system.save_disabled
  1050.             @help_window.set_text("抱歉,这里禁止存储.")
  1051.             # 演奏冻结 SE
  1052.             $game_system.se_play($data_system.buzzer_se)
  1053.             return
  1054.           end
  1055.          $game_system.se_play($data_system.decision_se)
  1056.          $last_savefile_index = @option_window.index
  1057.  
  1058.          save_file
  1059.           return
  1060.         end
  1061.       end
  1062.       # 取消
  1063.       if Input.trigger?(Input::B)
  1064.         $game_system.se_play($data_system.cancel_se)
  1065.         @command_window.active = false
  1066.         @help_window.set_text("请选择.")
  1067.         @savestate = 0
  1068.         @option_window.active = true
  1069.         return
  1070.       end
  1071.  
  1072.       if Input.trigger?(Input::B)
  1073.         $game_system.se_play($data_system.cancel_se)
  1074.         @savestate = 2
  1075.         @command_window.active = true
  1076.  
  1077.         return
  1078.       end
  1079.     end
  1080.   end
  1081. #--------------------------------------------------------------------------
  1082. # 建立记录文件索引
  1083. #--------------------------------------------------------------------------
  1084.  
  1085. #--------------------------------------------------------------------------
  1086. #  读取记录文件
  1087. #     filename  : 被读取文件
  1088. #--------------------------------------------------------------------------
  1089. def load_file
  1090.       # 文件不存在的情况下
  1091.       unless FileTest.exist?(DIR+"Save#{@command_window.index}.rxdata")
  1092.         # 演奏冻结 SE
  1093.         $game_system.se_play($data_system.buzzer_se)
  1094.         return
  1095.       end
  1096.       # 演奏读档 SE
  1097.       $game_system.se_play($data_system.load_se)
  1098.       # 写入存档数据
  1099.       file = File.open(DIR+"Save#{@command_window.index}.rxdata", "rb")
  1100.       read_save_data(file)
  1101.       file.close
  1102.       # 还原 BGM、BGS
  1103.       $game_system.bgm_play($game_system.playing_bgm)
  1104.       $game_system.bgs_play($game_system.playing_bgs)
  1105.       # 刷新地图 (执行并行事件)
  1106.       $game_map.update
  1107.       # 切换到地图画面
  1108.       $scene = Scene_Map.new
  1109. end
  1110. #--------------------------------------------------------------------------
  1111. # ● 读取存档数据
  1112. #     file : 读取用文件对像 (已经打开)
  1113. #--------------------------------------------------------------------------
  1114.   def read_save_data(file)
  1115.     # 读取描绘存档文件用的角色数据
  1116.     characters = Marshal.load(file)
  1117.     # 读取测量游戏时间用画面计数
  1118.     Graphics.frame_count = Marshal.load(file)
  1119.     # 读取各种游戏对像
  1120.     $game_system        = Marshal.load(file)
  1121.     $game_switches      = Marshal.load(file)
  1122.     $game_variables     = Marshal.load(file)
  1123.     $game_self_switches = Marshal.load(file)
  1124.     $game_screen        = Marshal.load(file)
  1125.     $game_actors        = Marshal.load(file)
  1126.     $game_party         = Marshal.load(file)
  1127.     $game_troop         = Marshal.load(file)
  1128.     $game_map           = Marshal.load(file)
  1129.     $game_player        = Marshal.load(file)
  1130.     # 魔法编号与保存时有差异的情况下
  1131.     # (加入编辑器的编辑过的数据)
  1132.     if $game_system.magic_number != $data_system.magic_number
  1133.       # 重新装载地图
  1134.       $game_map.setup($game_map.map_id)
  1135.       $game_player.center($game_player.x, $game_player.y)
  1136.     end
  1137.     # 刷新同伴成员
  1138.     $game_party.refresh
  1139.   end
  1140.   #--------------------------------------------------------------------------
  1141.   # ● 写入存档文件
  1142.   #--------------------------------------------------------------------------
  1143.   def save_file
  1144.     if Input.trigger?(Input::C)
  1145.       unless FileTest.exist?(DIR+"Save#{@command_window.index}.rxdata")
  1146.         # 演奏冻结 SE
  1147.         # 演奏存档 SE
  1148.           $game_system.se_play($data_system.save_se)
  1149.           # 写入存档数据
  1150.           file = File.open(DIR+"Save#{@command_window.index}.rxdata", "wb")
  1151.           write_save_data(file)
  1152.           if FileTest.exist?(DIR+"shot.jpg")
  1153.             File.rename(DIR+"shot.jpg", DIR+"Save#{@command_window.index}.jpg")
  1154.           end
  1155.           file.close
  1156.           $game_temp.last_file_index = @command_window.index
  1157.           # 如果被事件调用
  1158.           if $game_temp.save_calling
  1159.             # 清除存档调用标志
  1160.             $game_temp.save_calling = false
  1161.             @confirm_window.dispose
  1162.             # 切换到地图画面
  1163.             $scene = Scene_Map.new   
  1164.             return
  1165.           end
  1166.         # 切换到菜单画面
  1167.           $scene = Scene_Map.new  
  1168.       end
  1169.       @yes_no_window.active = true
  1170.       @command_window.active = false            
  1171.     end
  1172.     #———————————————————————#     
  1173.   end
  1174.   #-------------------------------------------------------------------
  1175.   def confirm_update
  1176.     @command_index = @command_window.index
  1177.     @confirm_window.visible = true
  1178.     @confirm_window.z = 1500
  1179.     @yes_no_window.visible = true
  1180.     @yes_no_window.active = true
  1181.     @yes_no_window.z = 1500
  1182.     @yes_no_window.update
  1183.     if Input.trigger?(Input::C)
  1184.       if @yes_no_window.index == 0
  1185.           #######################################################
  1186.           # 演奏存档 SE
  1187.           $game_system.se_play($data_system.save_se)
  1188.           # 写入存档数据
  1189.           file = File.open(DIR+"Save#{@command_window.index}.rxdata", "wb")
  1190.           write_save_data(file)
  1191.           if FileTest.exist?(DIR+"shot.jpg")
  1192.             File.rename(DIR+"shot.jpg", DIR+"Save#{@command_window.index}.jpg")
  1193.           end
  1194.           file.close
  1195.           $game_temp.last_file_index = @command_window.index
  1196.           # 如果被事件调用
  1197.           if $game_temp.save_calling
  1198.             # 清除存档调用标志
  1199.             $game_temp.save_calling = false
  1200.             @confirm_window.dispose
  1201.             @content_window.dispose
  1202.             # 切换到地图画面
  1203.             $scene = Scene_Map.new
  1204.  
  1205.             return
  1206.           end
  1207.         # 切换到菜单画面
  1208.           $scene = Scene_Map.new        
  1209.         else
  1210.         $game_system.se_play($data_system.cancel_se)
  1211.         @yes_no_window.active = false
  1212.         @command_window.active = true
  1213.         end
  1214.     end
  1215.     if Input.trigger?(Input::B)
  1216.       $game_system.se_play($data_system.cancel_se)
  1217.       @yes_no_window.active = false
  1218.       @command_window.active = true
  1219.     end
  1220.   end
  1221.   #--------------------------------------------------------------------------
  1222.   # ● 写入存档数据
  1223.   #     file : 写入用文件对像 (已经打开)
  1224.   #--------------------------------------------------------------------------
  1225.   def write_save_data(file)
  1226.     # 生成描绘存档文件用的角色图形
  1227.     characters = []
  1228.     for i in 0...$game_party.actors.size
  1229.       actor = $game_party.actors[i]
  1230.       characters.push([actor.character_name, actor.character_hue, actor])
  1231.     end
  1232.     # 写入描绘存档文件用的角色数据
  1233.     Marshal.dump(characters, file)
  1234.     # 写入测量游戏时间用画面计数
  1235.     Marshal.dump(Graphics.frame_count, file)
  1236.     # 增加 1 次存档次数
  1237.     $game_system.save_count += 1
  1238.     # 保存魔法编号
  1239.     # (将编辑器保存的值以随机值替换)
  1240.     $game_system.magic_number = $data_system.magic_number
  1241.     # 写入各种游戏对像
  1242.     Marshal.dump($game_system, file)
  1243.     Marshal.dump($game_switches, file)
  1244.     Marshal.dump($game_variables, file)
  1245.     Marshal.dump($game_self_switches, file)
  1246.     Marshal.dump($game_screen, file)
  1247.     Marshal.dump($game_actors, file)
  1248.     Marshal.dump($game_party, file)
  1249.     Marshal.dump($game_troop, file)
  1250.     Marshal.dump($game_map, file)
  1251.     Marshal.dump($game_player, file)
  1252.   end
  1253. end

screenshot.rar

48.44 KB, 下载次数: 41

解压放到根目录即可

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
14 小时
注册时间
2014-8-23
帖子
20
6
 楼主| 发表于 2014-8-27 19:24:53 | 只看该作者
qdqlloxe 发表于 2014-8-26 20:58
大师包里面的..50个.不够的话自己把0..51后面的51(要全改哟)改成n..然后别忘了添加中文对应就可以了。
cl ...

试验过了不能用
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
14 小时
注册时间
2014-8-23
帖子
20
8
 楼主| 发表于 2014-8-27 21:01:15 | 只看该作者
RyanBern 发表于 2014-8-27 19:53
存档数增加的脚本很多很乱啊,那我也发一个今天遇到的,看看行不行吧。
这个脚本会把存档存到游戏根目录下 ...

哇哇哇哇!这个是靠谱一些的! 但是我建立了那个文件夹也是不可以存的。。。闹心

点评

不可以存?  发表于 2014-8-27 21:12
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
14 小时
注册时间
2014-8-23
帖子
20
9
 楼主| 发表于 2014-8-27 21:17:46 | 只看该作者
@RyanBern
八云桃 发表于 2014-8-27 21:01
哇哇哇哇!这个是靠谱一些的! 但是我建立了那个文件夹也是不可以存的。。。闹心 ...


对的
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
14 小时
注册时间
2014-8-23
帖子
20
10
 楼主| 发表于 2014-8-27 21:20:55 | 只看该作者
RyanBern 发表于 2014-8-27 19:53
存档数增加的脚本很多很乱啊,那我也发一个今天遇到的,看看行不行吧。
这个脚本会把存档存到游戏根目录下 ...

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-21 19:08

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表