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

Project1

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

[已经过期] 有关于存档的问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
85
在线时间
287 小时
注册时间
2013-6-16
帖子
35
跳转到指定楼层
1
发表于 2013-12-28 17:48:20 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 小w的w 于 2014-1-19 12:34 编辑

那个……这个问题已经在别的地方得到解决了,不过看了一下版规好像是不允许自己修改为过期的,所以在此说明。


vx默认四个存档,我觉得少就用了一个存档扩张脚本,不过发现效果和我想象的不一样。
如图。


请问怎样能实现我希望的效果呢?十分感谢。

Lv1.梦旅人

梦石
0
星屑
85
在线时间
287 小时
注册时间
2013-6-16
帖子
35
2
 楼主| 发表于 2013-12-28 17:55:26 | 只看该作者
本帖最后由 小w的w 于 2013-12-30 12:20 编辑

汗,为毛第三张截成标题画面的存档了,请无视。

点评

好的好的,下次一定注意。  发表于 2014-1-6 11:43

评分

参与人数 1星屑 -20 收起 理由
丿梁丶小柒 -20 善用编辑功能

查看全部评分

回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
3
星屑
73
在线时间
1597 小时
注册时间
2013-2-23
帖子
1789
3
发表于 2014-1-1 12:50:35 | 只看该作者
lz看看这张存档脚本怎样?

RUBY 代码复制
  1. #==============================================================================
  2. # vx新截图存档 by 沉影不器
  3. #------------------------------------------------------------------------------
  4. # ☆ 核心部分是内存位图的输入输出
  5. #    (快速存储Bitmap的Marshal 作者: 柳之一) 强大啊
  6. #------------------------------------------------------------------------------
  7. # ▼ 相比rmxp正版截图存档(作者: 柳柳),主要变动如下:
  8. #     ① 省去了 screenshot.dll 文件 (因快速存储Bitmap的Marshal的存在)
  9. #     ② 无须人工新建存档文件夹,脚本将自建
  10. #     ③ 方便地更改最大存档数,只需设置最大值
  11. #==============================================================================
  12. MAX_SAVE_ID = 12                          # 最大存档数
  13. SAVE_DIR = "Saves/"                       # 改变的存档目录(不希望改变目录请删)
  14. #==============================================================================
  15. # (快速存储Bitmap的Marshal 作者: 柳之一) 强大啊
  16. #==============================================================================
  17. class Font
  18.   def marshal_dump
  19.   end
  20.   def marshal_load(obj)
  21.   end
  22. end
  23.  
  24. class Bitmap
  25.   # 传送到内存的API函数
  26.   RtlMoveMemory_pi = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
  27.   RtlMoveMemory_ip = Win32API.new('kernel32', 'RtlMoveMemory', 'ipi', 'i')
  28.   def _dump(limit)
  29.     data = "rgba" * width * height
  30.     RtlMoveMemory_pi.call(data, address, data.length)
  31.     [width, height, Zlib::Deflate.deflate(data)].pack("LLa*") # 压缩
  32.   end
  33.   def self._load(str)
  34.     w, h, zdata = str.unpack("LLa*")
  35.     b = self.new(w, h)
  36.     RtlMoveMemory_ip.call(b.address, Zlib::Inflate.inflate(zdata), w * h * 4)
  37.     return b
  38.   end
  39. # [[[bitmap.object_id * 2 + 16] + 8] + 16] == 数据的开头
  40.   def address
  41.     buffer, ad = "rgba", object_id * 2 + 16
  42.     RtlMoveMemory_pi.call(buffer, ad, 4)
  43.     ad = buffer.unpack("L")[0] + 8
  44.     RtlMoveMemory_pi.call(buffer, ad, 4)
  45.     ad = buffer.unpack("L")[0] + 16
  46.     RtlMoveMemory_pi.call(buffer, ad, 4)
  47.     return buffer.unpack("L")[0]
  48.   end
  49. end
  50.  
  51. #==============================================================================
  52. # ■ Game_Temp
  53. #==============================================================================
  54. class Game_Temp
  55.   #--------------------------------------------------------------------------
  56.   # ● 定义实例变量
  57.   #--------------------------------------------------------------------------
  58.   attr_accessor :save_bitmap        # 存档位图
  59.   #--------------------------------------------------------------------------
  60.   # ● 初始化对象
  61.   #--------------------------------------------------------------------------
  62.   alias ini initialize
  63.   def initialize
  64.     ini
  65.     @save_bitmap = Bitmap.new(1, 1)
  66.   end
  67. end
  68.  
  69. #==============================================================================
  70. # ■ Window_SaveFile
  71. #==============================================================================
  72. class Window_SaveFile < Window_Base
  73.   #--------------------------------------------------------------------------
  74.   # ● 定义实例变量
  75.   #--------------------------------------------------------------------------
  76.   attr_reader   :filename                 # 文件名
  77.   attr_reader   :file_exist               # 文件存在标志
  78.   #--------------------------------------------------------------------------
  79.   # ● 初始化对象
  80.   #     file_index : 存档文件索引 (0~3)
  81.   #     filename   : 文件名
  82.   #--------------------------------------------------------------------------
  83.   def initialize(file_index, filename)
  84.     super(160, 56, 384, 360)
  85.     @file_index = file_index
  86.     @filename = filename
  87.     make_dir(SAVE_DIR) if SAVE_DIR != nil
  88.     load_gamedata
  89.     refresh(@file_index)
  90.   end
  91.   #--------------------------------------------------------------------------
  92.   # ● 读取部分游戏数据
  93.   #--------------------------------------------------------------------------
  94.   def load_gamedata
  95.     @file_exist = FileTest.exist?(SAVE_DIR + @filename)
  96.     if @file_exist
  97.       file = File.open(SAVE_DIR + @filename, "r")
  98.       begin
  99.         @characters          = Marshal.load(file)
  100.         @frame_count         = Marshal.load(file)
  101.         @last_bgm            = Marshal.load(file)
  102.         @last_bgs            = Marshal.load(file)
  103.         @game_system         = Marshal.load(file)
  104.         @game_message        = Marshal.load(file)
  105.         @game_switches       = Marshal.load(file)
  106.         @game_variables      = Marshal.load(file)
  107.         @game_self_switches  = Marshal.load(file)
  108.         @game_actors         = Marshal.load(file)
  109.         @game_party          = Marshal.load(file)
  110.         @game_troop          = Marshal.load(file)
  111.         @game_map            = Marshal.load(file)
  112.         [url=home.php?mod=space&uid=14736]@game_player[/url]         = Marshal.load(file)
  113.         # 读取截图
  114.         @file_bitmap         = Marshal.load(file)
  115.         @total_sec = @frame_count / Graphics.frame_rate
  116.       rescue
  117.         @file_exist = false
  118.       ensure
  119.         file.close
  120.       end
  121.     end
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # ● 刷新
  125.   #     index : 索引
  126.   #--------------------------------------------------------------------------
  127.   def refresh(index)
  128.     file_index = index
  129.     self.contents.clear
  130.     self.contents.font.color = normal_color
  131.     if @file_exist
  132.       # 描绘底部阴影
  133.       self.contents.fill_rect(12+3, 4+3, 326,249, Color.new(0,0,64))
  134.       # 描绘截图
  135.       draw_snap_bitmap(12, 4)
  136.       draw_party_characters(152, 296)
  137.       draw_playtime(0, 296+8, contents.width - 40, 2)
  138.     else
  139.       self.contents.draw_text(0, 296, 384-32, 24, "无此存档!", 1)
  140.     end
  141.   end
  142.   #--------------------------------------------------------------------------
  143.   # ◎ 更改索引
  144.   #     index : 索引
  145.   #--------------------------------------------------------------------------
  146.   def file_index=(file_index)
  147.     @file_index = file_index
  148.   end
  149.   #--------------------------------------------------------------------------
  150.   # ● 描绘游戏人物
  151.   #     x : 描画先 X 座標
  152.   #     y : 描画先 Y 座標
  153.   #--------------------------------------------------------------------------
  154.   def draw_party_characters(x, y)
  155.     for i in [email]0...@characters.size[/email]
  156.       name = @characters[i][0]
  157.       index = @characters[i][1]
  158.       draw_character(name, index, x + i * 48, y)
  159.     end
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   # ◎ 生成保存路径
  163.   #     path : 路径
  164.   #--------------------------------------------------------------------------
  165.   def make_dir(path)
  166.     dir = path.split("/")
  167.     for i in 0...dir.size
  168.       unless dir == "."
  169.         add_dir = dir[0..i].join("/")
  170.         begin
  171.           Dir.mkdir(add_dir)
  172.         rescue
  173.         end
  174.       end
  175.     end
  176.   end
  177.   #--------------------------------------------------------------------------
  178.   # ◎ 生成文件名
  179.   #     file_index : 存档文件索引 (0~3)
  180.   #--------------------------------------------------------------------------
  181.   def make_filename(file_index)
  182.     return "Save#{file_index + 1}.rvdata"
  183.   end
  184.   #--------------------------------------------------------------------------
  185.   # ◎ 描绘截图
  186.   #     x : 描画先 X 座標
  187.   #     y : 描画先 Y 座標
  188.   #--------------------------------------------------------------------------
  189.   def draw_snap_bitmap(x, y)
  190.     bitmap = @file_bitmap
  191.     if bitmap == nil
  192.       self.contents.draw_text(0, 112, 384-32, 24, "找不到截图文件!", 1)
  193.     else
  194.       self.contents.blur
  195.       rect = Rect.new(0, 0, 0, 0)
  196.       rect.width = bitmap.width
  197.       rect.height = bitmap.height
  198.       self.contents.blt(x, y, bitmap, rect)
  199.     end
  200.   end
  201.   #--------------------------------------------------------------------------
  202.   # ● 描绘游戏时间
  203.   #     x     : 描绘目标 X 坐标
  204.   #     y     : 描绘目标 Y 坐标
  205.   #     width : 宽
  206.   #     align : 配置
  207.   #--------------------------------------------------------------------------
  208.   def draw_playtime(x, y, width, align)
  209.     hour = @total_sec / 60 / 60
  210.     min = @total_sec / 60 % 60
  211.     sec = @total_sec % 60
  212.     time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  213.     self.contents.font.color = normal_color
  214.     self.contents.draw_text(x, y, width, WLH, time_string, 2)
  215.   end
  216. end
  217.  
  218. #==============================================================================
  219. # ■ Scene_Base
  220. #==============================================================================
  221. class Scene_Base
  222.   #--------------------------------------------------------------------------
  223.   # ◎ 生成存档位图快照
  224.   #--------------------------------------------------------------------------
  225.   def snapshot_for_save
  226.     d_rect = Rect.new(0, 0, 326, 249)
  227.     s_rect = Rect.new(0, 0, 544, 416)
  228.     save_bitmap = Graphics.snap_to_bitmap
  229.     $game_temp.save_bitmap.dispose
  230.     $game_temp.save_bitmap = Bitmap.new(326, 249)
  231.     $game_temp.save_bitmap.stretch_blt(d_rect, save_bitmap, s_rect)
  232.   end
  233. end
  234.  
  235. #==============================================================================
  236. # ■ Scene_Map
  237. #==============================================================================
  238. class Scene_Map < Scene_Base
  239.   #--------------------------------------------------------------------------
  240.   # ● 结束处理
  241.   #--------------------------------------------------------------------------
  242.   alias save_terminate terminate
  243.   def terminate
  244.     snapshot_for_save
  245.     save_terminate
  246.   end
  247. end
  248.  
  249. #==============================================================================
  250. # ■ Scene_Title
  251. #==============================================================================
  252. class Scene_Title < Scene_Base
  253.   #--------------------------------------------------------------------------
  254.   # ● 判断继续是否有效
  255.   #--------------------------------------------------------------------------
  256.   def check_continue
  257.     @continue_enabled = (Dir.glob(SAVE_DIR + 'Save*.rvdata').size > 0)
  258.   end
  259. end
  260.  
  261. #==============================================================================
  262. # ■ Scene_File
  263. #------------------------------------------------------------------------------
  264. #  处理文件的类。
  265. #==============================================================================
  266. class Scene_File < Scene_Base
  267.   #--------------------------------------------------------------------------
  268.   # ● 初始化对象
  269.   #     saving     : 存档标志 (false 为载入画面)
  270.   #     from_title : 调用标题画面的 "继续" 标志
  271.   #     from_event : 事件的 "调用存档画面" 的调用标志
  272.   #--------------------------------------------------------------------------
  273.   def initialize(saving, from_title, from_event)
  274.     @saving = saving
  275.     @from_title = from_title
  276.     @from_event = from_event
  277.   end
  278.   #--------------------------------------------------------------------------
  279.   # ● 开始处理
  280.   #--------------------------------------------------------------------------
  281.   def start
  282.     super
  283.     create_menu_background
  284.     @help_window = Window_Help.new
  285.     create_command_window
  286.     if @saving
  287.       [url=home.php?mod=space&uid=370741]@Index[/url] = $game_temp.last_file_index
  288.       @help_window.set_text(Vocab::SaveMessage)
  289.     else
  290.       @index = self.latest_file_index
  291.       @help_window.set_text(Vocab::LoadMessage)
  292.     end
  293.     @refresh_index = @command_window.index = @index
  294.     @item_max = MAX_SAVE_ID
  295.     create_savefile_window
  296.   end
  297.   #--------------------------------------------------------------------------
  298.   # ● 结束处理
  299.   #--------------------------------------------------------------------------
  300.   def terminate
  301.     super
  302.     dispose_menu_background
  303.     @help_window.dispose
  304.     dispose_item_windows
  305.   end
  306.   #--------------------------------------------------------------------------
  307.   # ● 还原至原先的画面
  308.   #--------------------------------------------------------------------------
  309.   def return_scene
  310.     if @from_title
  311.       $scene = Scene_Title.new
  312.     elsif @from_event
  313.       $scene = Scene_Map.new
  314.     else
  315.       $scene = Scene_Menu.new(4)
  316.     end
  317.   end
  318.   #--------------------------------------------------------------------------
  319.   # ● 更新画面
  320.   #--------------------------------------------------------------------------
  321.   def update
  322.     super
  323.     update_menu_background
  324.     @help_window.update
  325.     update_savefile_windows
  326.     update_savefile_selection
  327.   end
  328.   #--------------------------------------------------------------------------
  329.   # ◎ 生成存档文件列表窗口
  330.   #--------------------------------------------------------------------------
  331.   def create_command_window
  332.     file_names = []
  333.     digit = MAX_SAVE_ID.to_s.size
  334.     str_f = ""
  335.     digit.times{|n| str_f += "0"}
  336.     str_f[str_f.size-1, 1] = digit.to_s
  337.     for i in 0...MAX_SAVE_ID
  338.       id = sprintf("%#{str_f}d", i+1)
  339.       file_names.push(Vocab::File + "\s" + id)
  340.     end
  341.     @command_window = Window_Command.new(160, file_names)
  342.     @command_window.height = 360
  343.     @command_window.y = 56
  344.   end
  345.   #--------------------------------------------------------------------------
  346.   # ● 生成存档文件窗口
  347.   #--------------------------------------------------------------------------
  348.   def create_savefile_window
  349.     @savefile_window = Window_SaveFile.new(@command_window.index, make_filename(@command_window.index))
  350.   end
  351.   #--------------------------------------------------------------------------
  352.   # ● 释放存档文件
  353.   #--------------------------------------------------------------------------
  354.   def dispose_item_windows
  355.     @command_window.dispose
  356.     @savefile_window.dispose
  357.   end
  358.   #--------------------------------------------------------------------------
  359.   # ● 更新存档文件窗口
  360.   #--------------------------------------------------------------------------
  361.   def update_savefile_windows
  362.     @command_window.update
  363.     @savefile_window.update
  364.   end
  365.   #--------------------------------------------------------------------------
  366.   # ● 更新存档文件选择
  367.   #--------------------------------------------------------------------------
  368.   def update_savefile_selection
  369.     if Input.trigger?(Input::C)
  370.       determine_savefile
  371.     end
  372.     if Input.trigger?(Input::B)
  373.       Sound.play_cancel
  374.       return_scene
  375.     end
  376.     if @refresh_index != @command_window.index
  377.       @refresh_index = @command_window.index
  378.       @savefile_window.dispose
  379.       create_savefile_window
  380.       end
  381.   end
  382.   #--------------------------------------------------------------------------
  383.   # ● 确定存档文件
  384.   #--------------------------------------------------------------------------
  385.   def determine_savefile
  386.     if @saving
  387.       Sound.play_save
  388.       do_save
  389.     else
  390.       if @savefile_window.file_exist
  391.         Sound.play_load
  392.         do_load
  393.       else
  394.         Sound.play_buzzer
  395.         return
  396.       end
  397.     end
  398.     $game_temp.last_file_index = @index
  399.   end
  400.   #--------------------------------------------------------------------------
  401.   # ◎ 生成文件名
  402.   #     file_index : 存档文件索引
  403.   #--------------------------------------------------------------------------
  404.   def make_filename(file_index)
  405.     return "Save#{file_index + 1}.rvdata"
  406.   end
  407.   #--------------------------------------------------------------------------
  408.   # ● 按时间戳选择最新的文件
  409.   #--------------------------------------------------------------------------
  410.   def latest_file_index
  411.     index = 0
  412.     latest_time = Time.at(0) # 时间戳
  413.     for i in 0...MAX_SAVE_ID
  414.       file_name = make_filename(i)
  415.       if FileTest.exist?(SAVE_DIR + file_name)
  416.         file = File.open(SAVE_DIR + file_name, "r")
  417.         if file.mtime > latest_time
  418.           latest_time = file.mtime
  419.           index = i
  420.         end
  421.       end
  422.     end
  423.     return index
  424.   end
  425.   #--------------------------------------------------------------------------
  426.   # ● 执行存档
  427.   #--------------------------------------------------------------------------
  428.   def do_save
  429.     file_name = make_filename(@command_window.index)
  430.     file = File.open(SAVE_DIR + file_name, "wb")
  431.     write_save_data(file)
  432.     # 保存位图
  433.     $file_bitmap = $game_temp.save_bitmap
  434.     Marshal.dump($file_bitmap, file)
  435.     file.close
  436.     return_scene
  437.   end
  438.   #--------------------------------------------------------------------------
  439.   # ● 执行载入
  440.   #--------------------------------------------------------------------------
  441.   def do_load
  442.     file_name = make_filename(@command_window.index)
  443.     file = File.open(SAVE_DIR + file_name, "rb")
  444.     read_save_data(file)
  445.     file.close
  446.     $scene = Scene_Map.new
  447.     RPG::BGM.fade(1500)
  448.     Graphics.fadeout(60)
  449.     Graphics.wait(40)
  450.     @last_bgm.play
  451.     @last_bgs.play
  452.   end
  453. end
像我这么帅的在自己的游戏里一定是主角!
最近申请了b站直播间:http://live.bilibili.com/31494
鄙人的视频合集:点我
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
85
在线时间
287 小时
注册时间
2013-6-16
帖子
35
4
 楼主| 发表于 2014-1-4 23:22:09 | 只看该作者
q374435503 发表于 2014-1-1 12:50
lz看看这张存档脚本怎样?

#========================================================================= ...

诶居然没有回复提醒,所以现在才看到。
谢谢你的回答,但是我个人不太喜欢这种存档界面,还是希望是默认的存档界面。
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-17 02:57

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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