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

Project1

 找回密码
 注册会员
搜索

[RMVA发布] [PS0]截图存档 v20120216【VX新截图存档移植增强版】

  [复制链接]

Lv1.梦旅人

梦石
0
星屑
68
在线时间
931 小时
注册时间
2009-5-25
帖子
430

开拓者

发表于 2012-3-10 20:40:44 | 显示全部楼层
本帖最后由 alann 于 2012-3-11 00:43 编辑

编辑:
原来是脚本位置跟原来的顺序不一样,要调成本来的位置……

点评

表示我没发现这个问题啊……删除存档重试呢?  发表于 2012-3-10 22:25
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
123 小时
注册时间
2012-2-12
帖子
73
发表于 2012-3-10 22:00:41 | 显示全部楼层
代码可以改下不    复制不了

点评

个人浏览器问题 - - 请自行解决。  发表于 2012-3-10 22:25
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
723
在线时间
530 小时
注册时间
2010-6-9
帖子
840
发表于 2012-3-13 02:52:41 | 显示全部楼层
请问,能不能提供一个修改存档SKIN的方法,因为不想让他和游戏中的窗口一致。望赐教
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
49
在线时间
152 小时
注册时间
2012-1-12
帖子
456
发表于 2012-3-27 19:40:35 | 显示全部楼层
我点复制代码按钮根本复制不了,一气之下手动复制,但结果是全部在一行,全变成注释了

点评

请更换浏览器  发表于 2012-3-28 03:47
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
48
在线时间
543 小时
注册时间
2011-6-25
帖子
441
发表于 2012-3-28 17:57:11 | 显示全部楼层
kswy 发表于 2012-2-16 18:59
换什么浏览器可以复制代码啊,我换了360浏览器,qq浏览器,ie浏览器都无法复制 ...

用谷歌大概可以


------------------------------------------我只放我看中的遊戲-----------------------------------------------
臉書:http://www.facebook.com/brian.lee.52643821
  音速君的論壇
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
45 小时
注册时间
2012-4-1
帖子
16
发表于 2012-4-3 17:02:04 | 显示全部楼层
226行 class Scene_File < Scene_Base 出问题

点评

除了伸手之外也用用眼睛和脑子吧 这是【VA发布】帖  发表于 2012-4-3 18:07
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
49
在线时间
152 小时
注册时间
2012-1-12
帖子
456
发表于 2012-4-19 00:23:22 | 显示全部楼层
既然大家都反映代码无法复制,我就把代码粘贴出来就是了……
  1. #==============================================================================
  2. # [PS0]截图存档
  3. #      Window_SaveFile_Plus
  4. #------------------------------------------------------------------------------
  5. #     一种带有截图的存档,同时可以自定义存档数量。
  6. #==============================================================================
  7. # [核心脚本]
  8. #    - 快速储存Bitmap的Marshal         By 柳之一
  9. #------------------------------------------------------------------------------
  10. # [更新记录]
  11. #    - 2012.02.16 By 各种压力的猫君
  12. #      * 修正地图边缘时截图不完整的错误
  13. #    - 2012.01.28 By 各种压力的猫君
  14. #      * 去掉效率较差的双线性缩放算法;
  15. #      * 新增存档管理功能(F5键,复制/移动/删除存档)
  16. #    - 2011.12.27 By 各种压力的猫君
  17. #      * 补上截图阴影;
  18. #      * 新增“不缩放”截图(推荐使用,尤其是大分辨率);
  19. #      * 修正选择不存在的存档时存档列表窗口卡死以及奇怪的SE;
  20. #      * 新增“存档中”提示窗口、覆盖存档提示、删除存档功能(Z键,对应键盘D)
  21. #    - 2011.12.26 By 各种压力的猫君
  22. #      * 功能齐全的测试版
  23. #    - 2011.12.16 By 各种压力的猫君
  24. #      * 移植至RGSS3,遵循PS0协议;
  25. #      * 丰富自定义选项,整合双线性插值算法精简版
  26. #    - 2008.05.26 By 沉影不器
  27. #      * 蓝本(VX新截图存档)
  28. #------------------------------------------------------------------------------
  29. # [使用方法]
  30. #    - 删除原Scene_File、Window_SaveFile 并将本脚本插入到原Scene_File位置。
  31. #    - 或者直接将本脚本插入到MAIN以上,并确保本脚本位于上述两个脚本以下。
  32. #==============================================================================
  33. $_PS0 = {} if $_PS0 == nil  
  34. $_PS0["Window_SaveFile_Plus"] = 20120216
  35. #==============================================================================
  36. # [PS0] 通用配置模块  
  37. #==============================================================================
  38. module PS0
  39.   module Window_SaveFile_Plus

  40.     # 最大存档数(范围正整数)
  41.     MAX_SAVE = 18

  42.     # 存档目录(默认值 "Saves/";根目录 "")
  43.     SAVE_DIR = "Saves/"   

  44.     # 无存档时显示的文字
  45.     NO_DATA  = "无存档"

  46.     # 保存时显示的信息
  47.     SAVE_NOW = "存档中..."

  48.     # 复制存档时的帮助文字
  49.     HELP_COPY = "要复制到哪个位置?"

  50.     # 移动存档时的帮助文字
  51.     HELP_MOVE = "要移动到哪个位置?"

  52.     # 是否显示存档中窗口(true:显示;false:不显示)
  53.     # - 分辨率较大时建议显示
  54.     SHOW_SAVE_NOW = false

  55.     # 截图缩放使用的插值算法
  56.     # - "NN" 最邻近(速度最快,质量最差,RM默认算法)
  57.     # - "NZ" 不缩放(速度快,质量好,以主角为中心切边,非全屏)
  58.     Zoom_Type = "NZ"

  59.     # 双线性插值能获得更好的截图缩放质量,但所需时间较最邻近插值更长。
  60.     # 缩略图尺寸(范围整数,单位像素)
  61.     # - VA默认分辨率(544×416)推荐使用340×260
  62.     # - VA最大分辨率(640×480)推荐使用425×325
  63.     # - 本脚本兼容分辨率解放,窗口大小将自动计算。
  64.     #   请自行计算截图分辨率,注意要确保宽高比一致,
  65.     #   若使用“不缩放”模式则可以不保持一致。
  66.     Thumbnail_Width  = 340  # 宽度
  67.     Thumbnail_Height = 260  # 高度

  68.     # 缩略图位置微调(范围整数,单位像素)
  69.     Thumbnail_ox = -2    # 横向
  70.     Thumbnail_oy = -2-32 # 纵向

  71.     # 各窗口切换时的渐变帧数
  72.     TRANS_DURATION = 5

  73.   end
  74. end
  75. #==============================================================================
  76. # [核心脚本] 快速储存Bitmap的Marshal By 柳之一
  77. #==============================================================================
  78. class Font
  79.   def marshal_dump
  80.   end
  81.   def marshal_load(obj)
  82.   end
  83. end
  84. class Bitmap
  85.   RtlMoveMemory_pi = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
  86.   RtlMoveMemory_ip = Win32API.new('kernel32', 'RtlMoveMemory', 'ipi', 'i')
  87.   def _dump(limit)
  88.     data = "rgba" * width * height
  89.     RtlMoveMemory_pi.call(data, address, data.length)
  90.     [width, height, Zlib::Deflate.deflate(data)].pack("LLa*")
  91.   end
  92.   def self._load(str)
  93.     w, h, zdata = str.unpack("LLa*")
  94.     b = self.new(w, h)
  95.     RtlMoveMemory_ip.call(b.address, Zlib::Inflate.inflate(zdata), w * h * 4)
  96.     return b
  97.   end
  98.   def address
  99.     buffer, ad = "rgba", object_id * 2 + 16
  100.     RtlMoveMemory_pi.call(buffer, ad, 4)
  101.     ad = buffer.unpack("L")[0] + 8
  102.     RtlMoveMemory_pi.call(buffer, ad, 4)
  103.     ad = buffer.unpack("L")[0] + 16
  104.     RtlMoveMemory_pi.call(buffer, ad, 4)
  105.     return buffer.unpack("L")[0]
  106.   end
  107. end
  108. #==============================================================================
  109. # ■ Game_Temp
  110. #==============================================================================
  111. class Game_Temp
  112.   attr_accessor :save_bitmap
  113.   attr_accessor :save_snapshoot
  114.   alias new_initialize initialize
  115.   def initialize
  116.     new_initialize
  117.     @save_bitmap = Bitmap.new(1, 1)
  118.     @save_snapshoot = Bitmap.new(1, 1)
  119.   end
  120. end
  121. #==============================================================================
  122. # ■ SceneManager
  123. #==============================================================================
  124. module SceneManager
  125.   def self.snapshot_for_save
  126.     $game_temp.save_bitmap = Graphics.snap_to_bitmap
  127.     unless FileTest.exist?(PS0::Window_SaveFile_Plus::SAVE_DIR)
  128.       Dir.mkdir(PS0::Window_SaveFile_Plus::SAVE_DIR)
  129.     end
  130.   end
  131. end
  132. #==============================================================================
  133. # ■ Scene_Map
  134. #==============================================================================
  135. class Scene_Map < Scene_Base
  136.   alias save_terminate terminate
  137.   def terminate
  138.     SceneManager.snapshot_for_save
  139.     save_terminate
  140.   end
  141. end
  142. #==============================================================================
  143. # ■ DataManager
  144. #==============================================================================
  145. module DataManager
  146.   def self.save_file_exists?
  147.     !Dir.glob(PS0::Window_SaveFile_Plus::SAVE_DIR + 'Save*.rvdata2').empty?
  148.   end
  149.   def self.make_filename(index)
  150.     sprintf(PS0::Window_SaveFile_Plus::SAVE_DIR + "Save%02d.rvdata2", index + 1)
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   # ● セーブヘッダの作成
  154.   #--------------------------------------------------------------------------
  155.   def self.make_save_header
  156.     d_rect = Rect.new(0, 0, PS0::Window_SaveFile_Plus::Thumbnail_Width,
  157.                             PS0::Window_SaveFile_Plus::Thumbnail_Height)
  158.     case PS0::Window_SaveFile_Plus::Zoom_Type
  159.     when "NN"
  160.       s_rect = $game_temp.save_bitmap.rect
  161.       $game_temp.save_snapshoot = Bitmap.new(d_rect.width, d_rect.height)
  162.       $game_temp.save_snapshoot.stretch_blt(d_rect, $game_temp.save_bitmap, s_rect)
  163.     when "NZ"
  164.       x = [$game_player.screen_x - d_rect.width/2, 0].max
  165.       x = [x, Graphics.width - d_rect.width].min
  166.       y = [$game_player.screen_y - d_rect.height/2, 0].max
  167.       y = [y, Graphics.height - d_rect.height].min
  168.       s_rect = Rect.new(x, y, d_rect.width, d_rect.height)
  169.       $game_temp.save_snapshoot = Bitmap.new(d_rect.width, d_rect.height)
  170.       $game_temp.save_snapshoot.blt(0, 0, $game_temp.save_bitmap, s_rect)
  171.     end
  172.     header = {}
  173.     header[:characters] = $game_party.characters_for_savefile
  174.     header[:playtime_s] = $game_system.playtime_s
  175.     header[:snapshoot]  = $game_temp.save_snapshoot
  176.     header
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # ● セーブの実行
  180.   #--------------------------------------------------------------------------
  181.   def self.save_game(index)
  182.     saving_window = Window_Saving.new
  183.     Graphics.update
  184.     begin
  185.       save_game_without_rescue(index)
  186.     rescue
  187.        delete_save_file(index)
  188.        false
  189.     end
  190.     saving_window.dispose
  191.     return true
  192.   end
  193. end
  194. #==============================================================================
  195. # ■ Window_Yes_Or_No
  196. #------------------------------------------------------------------------------
  197. #  提供“是”、“否”两个选项的窗口(替换、删除存档用)
  198. #==============================================================================
  199. class Window_Yes_Or_No < Window_HorzCommand
  200.   #--------------------------------------------------------------------------
  201.   # ● オブジェクト初期化
  202.   #--------------------------------------------------------------------------
  203.   def initialize(yes, no)
  204.     @yes = yes
  205.     @no = no
  206.     super(130, 0)
  207.     self.visible = false
  208.     self.active = false
  209.     @index = 0
  210.   end
  211.   #--------------------------------------------------------------------------
  212.   # ● 桁数の取得
  213.   #--------------------------------------------------------------------------
  214.   def col_max
  215.     return 2
  216.   end
  217.   #--------------------------------------------------------------------------
  218.   # ● コマンドリストの作成
  219.   #--------------------------------------------------------------------------
  220.   def make_command_list
  221.     add_command(@yes,   :yes)
  222.     add_command(@no,    :cancel)
  223.   end
  224.   #--------------------------------------------------------------------------
  225.   # ● 決定ボタンが押されたときの処理
  226.   #--------------------------------------------------------------------------
  227.   def process_ok
  228.     Input.update
  229.     call_ok_handler
  230.   end
  231.   #--------------------------------------------------------------------------
  232.   # ● 按下取消键时的处理
  233.   #--------------------------------------------------------------------------
  234.   def process_cancel
  235.     Input.update
  236.     call_cancel_handler
  237.   end
  238.   #--------------------------------------------------------------------------
  239.   # ● 启用窗口
  240.   #--------------------------------------------------------------------------
  241.   def activate
  242.     temp = self.y + self.height - Graphics.height
  243.     if temp > 0
  244.       self.y -= (temp + 12)
  245.     end
  246.     self.active = true
  247.     self
  248.   end
  249. end
  250. #==============================================================================
  251. # ■ Window_Saving
  252. #------------------------------------------------------------------------------
  253. #  显示保存信息的窗口
  254. #==============================================================================
  255. class Window_Saving < Window_Base
  256.   #--------------------------------------------------------------------------
  257.   # ● オブジェクト初期化
  258.   #--------------------------------------------------------------------------
  259.   def initialize
  260.     w = PS0::Window_SaveFile_Plus::SAVE_NOW.length * 16 + 32
  261.     x = (Graphics.width - w)/2
  262.     y = (Graphics.height - fitting_height(1))/2
  263.     super(x, y, w, fitting_height(1))
  264.     self.visible = PS0::Window_SaveFile_Plus::SHOW_SAVE_NOW
  265.     draw_text_ex(4, 0, PS0::Window_SaveFile_Plus::SAVE_NOW)
  266.   end
  267. end
  268. #==============================================================================
  269. # ■ Window_SaveManagerCommand
  270. #------------------------------------------------------------------------------
  271. #  存档管理窗口
  272. #==============================================================================
  273. class Window_SaveManagerCommand < Window_Command
  274.   #--------------------------------------------------------------------------
  275.   # ● 初始化对象
  276.   #--------------------------------------------------------------------------
  277.   def initialize(*args)
  278.     @copy, @move, @delete, @cancel = args[0..3]
  279.     super(130, 0)
  280.     self.visible = false
  281.     self.active = false
  282.     @index = 0
  283.   end
  284.   #--------------------------------------------------------------------------
  285.   # ● 获取窗口的宽度
  286.   #--------------------------------------------------------------------------
  287.   def window_width
  288.     return 100
  289.   end
  290.   #--------------------------------------------------------------------------
  291.   # ● 获取项目数
  292.   #--------------------------------------------------------------------------
  293.   def item_max
  294.     return 4
  295.   end
  296.   #--------------------------------------------------------------------------
  297.   # ● 生成指令列表
  298.   #--------------------------------------------------------------------------
  299.   def make_command_list
  300.     add_command(@copy,   :copy  )
  301.     add_command(@move,   :move  )
  302.     add_command(@delete, :delete)
  303.     add_command(@cancel, :cancel)
  304.   end
  305.   #--------------------------------------------------------------------------
  306.   # ● 按下确定键时的处理
  307.   #--------------------------------------------------------------------------
  308.   def process_ok
  309.     Input.update
  310.     call_ok_handler
  311.   end
  312.   #--------------------------------------------------------------------------
  313.   # ● 启用窗口
  314.   #--------------------------------------------------------------------------
  315.   def activate
  316.     temp = self.y + self.height - Graphics.height
  317.     if temp > 0
  318.       self.y -= (temp + 12)
  319.     end
  320.     self.active = true
  321.     self
  322.   end
  323. end
  324. #==============================================================================
  325. # ■ Window_FileCommand
  326. #------------------------------------------------------------------------------
  327. #  截图存档左侧的选择窗口。
  328. #==============================================================================
  329. class Window_FileCommand < Window_Command
  330.   #--------------------------------------------------------------------------
  331.   # ● オブジェクト初期化
  332.   #--------------------------------------------------------------------------
  333.   def initialize
  334.     super(0, 0)
  335.   end
  336.   #--------------------------------------------------------------------------
  337.   # ● ウィンドウ幅の取得
  338.   #--------------------------------------------------------------------------
  339.   def window_height
  340.     return Graphics.height-fitting_height(1)
  341.   end
  342.   #--------------------------------------------------------------------------
  343.   # ● 表示行数の取得
  344.   #--------------------------------------------------------------------------
  345.   def visible_line_number
  346.     item_max
  347.   end
  348.   #--------------------------------------------------------------------------
  349.   # ● コマンドリストの作成
  350.   #--------------------------------------------------------------------------
  351.   def make_command_list
  352.     add_main_commands
  353.   end
  354.   #--------------------------------------------------------------------------
  355.   # ● 主要コマンドをリストに追加
  356.   #--------------------------------------------------------------------------
  357.   def add_main_commands
  358.     for i in 1..PS0::Window_SaveFile_Plus::MAX_SAVE
  359.       if i < 10
  360.         text = Vocab::File + " 0" + i.to_s
  361.       else
  362.         text = Vocab::File + " " + i.to_s
  363.       end
  364.       add_command(text, :file)
  365.     end
  366.   end
  367.   #--------------------------------------------------------------------------
  368.   # ● 決定ボタンが押されたときの処理
  369.   #--------------------------------------------------------------------------
  370.   def process_ok
  371.   end
  372. end
  373. #==============================================================================
  374. # ■ Window_SaveFile
  375. #------------------------------------------------------------------------------
  376. #  セーブ画面およびロード画面で表示する、セーブファイルのウィンドウです。
  377. #==============================================================================
  378. class Window_SaveFile < Window_Base
  379.   #--------------------------------------------------------------------------
  380.   # ● オブジェクト初期化
  381.   #     index : セーブファイルのインデックス
  382.   #--------------------------------------------------------------------------
  383.   def initialize(index)
  384.     super(160, 0, Graphics.width-160, Graphics.height-fitting_height(1))
  385.     @file_index = index
  386.     @selected = true
  387.     refresh
  388.   end
  389.   #--------------------------------------------------------------------------
  390.   # ● リフレッシュ
  391.   #--------------------------------------------------------------------------
  392.   def refresh
  393.     contents.clear
  394.     change_color(normal_color)
  395.     w = (self.width-PS0::Window_SaveFile_Plus::Thumbnail_Width-16)/2
  396.     h = (self.height-PS0::Window_SaveFile_Plus::Thumbnail_Height-16)/2
  397.     width  = w + PS0::Window_SaveFile_Plus::Thumbnail_ox
  398.     height = h + PS0::Window_SaveFile_Plus::Thumbnail_oy
  399.     draw_shadow(width+5, height+5)
  400.     draw_text((self.width-32-PS0::Window_SaveFile_Plus::NO_DATA.length*16)/2,
  401.               self.height/2-32, PS0::Window_SaveFile_Plus::NO_DATA.length*32,
  402.               line_height, PS0::Window_SaveFile_Plus::NO_DATA)
  403.     draw_party_characters(32, Graphics.height-fitting_height(1)-32)
  404.     draw_playtime(-10, contents.height - line_height-10, contents.width - 4, 2)
  405.     draw_snapshoot(width, height)
  406.   end
  407.   #--------------------------------------------------------------------------
  408.   # ● パーティキャラの描画
  409.   #--------------------------------------------------------------------------
  410.   def draw_party_characters(x, y)
  411.     header = DataManager.load_header(@file_index)
  412.     return unless header
  413.     header[:characters].each_with_index do |data, i|
  414.       draw_character(data[0], data[1], x + i * 48, y)
  415.     end
  416.   end
  417.   #--------------------------------------------------------------------------
  418.   # ● プレイ時間の描画
  419.   #--------------------------------------------------------------------------
  420.   def draw_playtime(x, y, width, align)
  421.     header = DataManager.load_header(@file_index)
  422.     return unless header
  423.     draw_text(x, y, width, line_height, header[:playtime_s], 2)
  424.   end
  425.   #--------------------------------------------------------------------------
  426.   # ● 绘制截图
  427.   #--------------------------------------------------------------------------
  428.   def draw_snapshoot(x, y)
  429.     header = DataManager.load_header(@file_index)
  430.     return unless header
  431.     bitmap = header[:snapshoot]
  432.     contents.blt(x, y, bitmap, bitmap.rect)
  433.     bitmap.dispose
  434.   end
  435.   #--------------------------------------------------------------------------
  436.   # ● 绘制阴影
  437.   #--------------------------------------------------------------------------
  438.   def draw_shadow(x, y)
  439.     header = DataManager.load_header(@file_index)
  440.     return unless header
  441.     contents.fill_rect(x, y, PS0::Window_SaveFile_Plus::Thumbnail_Width,
  442.                              PS0::Window_SaveFile_Plus::Thumbnail_Height, Color.new(0, 0, 0))
  443.     contents.blur
  444.   end
  445. end
  446. #==============================================================================
  447. # ■ Scene_File
  448. #------------------------------------------------------------------------------
  449. #  セーブ画面とロード画面の共通処理を行うクラスです。
  450. #==============================================================================
  451. class Scene_File < Scene_MenuBase
  452.   #--------------------------------------------------------------------------
  453.   # ● 開始処理
  454.   #--------------------------------------------------------------------------
  455.   def start
  456.     super
  457.     create_help_window
  458.     create_savefile_viewport
  459.     create_command_window
  460.     create_savefile_window
  461.     create_manager_window
  462.     create_replace_window
  463.     create_delete_window
  464.   end
  465.   #--------------------------------------------------------------------------
  466.   # ● 終了処理
  467.   #--------------------------------------------------------------------------
  468.   def terminate
  469.     super
  470.     @savefile_viewport.dispose
  471.     @savefile_window.dispose
  472.     @command_window.dispose
  473.     @window_manager.dispose
  474.     @window_replace.dispose
  475.     @window_delete.dispose
  476.   end
  477.   #--------------------------------------------------------------------------
  478.   # ● フレーム更新
  479.   #--------------------------------------------------------------------------
  480.   def update
  481.     super
  482.     update_savefile_selection
  483.   end
  484.   #--------------------------------------------------------------------------
  485.   # ● 创建替换窗口
  486.   #--------------------------------------------------------------------------
  487.   def create_replace_window
  488.     @window_replace = Window_Yes_Or_No.new("替换", "取消")
  489.     @window_replace.set_handler(:yes,    method(:do_replace))
  490.     @window_replace.set_handler(:cancel, method(:do_cancel))
  491.   end
  492.   #--------------------------------------------------------------------------
  493.   # ● 创建删除窗口
  494.   #--------------------------------------------------------------------------
  495.   def create_delete_window
  496.     @window_delete  = Window_Yes_Or_No.new("删除", "取消")
  497.     @window_delete.set_handler(:yes,    method(:do_delete))
  498.     @window_delete.set_handler(:cancel, method(:do_return_manager))
  499.     @window_delete.x += 40
  500.   end
  501.   #--------------------------------------------------------------------------
  502.   # ● 创建管理窗口
  503.   #--------------------------------------------------------------------------
  504.   def create_manager_window
  505.     @window_manager = Window_SaveManagerCommand.new("复制", "移动", "删除", "取消")
  506.     @window_manager.set_handler(:copy  , method(:on_copy?))
  507.     @window_manager.set_handler(:move  , method(:on_move?))
  508.     @window_manager.set_handler(:delete, method(:on_delete?))
  509.     @window_manager.set_handler(:cancel, method(:do_cancel))
  510.   end
  511.   #--------------------------------------------------------------------------
  512.   # ● ヘルプウィンドウの作成
  513.   #--------------------------------------------------------------------------
  514.   def create_help_window
  515.     @help_window = Window_Help.new(1)
  516.     @help_window.set_text(help_window_text)
  517.   end
  518.   #--------------------------------------------------------------------------
  519.   # ● ヘルプウィンドウのテキストを取得
  520.   #--------------------------------------------------------------------------
  521.   def help_window_text
  522.     return ""
  523.   end
  524.   #--------------------------------------------------------------------------
  525.   # ● セーブファイルビューポートの作成
  526.   #--------------------------------------------------------------------------
  527.   def create_savefile_viewport
  528.     @savefile_viewport = Viewport.new
  529.     @savefile_viewport.rect.y = @help_window.height
  530.     @savefile_viewport.rect.height -= @help_window.height
  531.   end
  532.   #--------------------------------------------------------------------------
  533.   # ● セーブファイルウィンドウの作成
  534.   #--------------------------------------------------------------------------
  535.   def create_savefile_window
  536.     @savefile_window = Window_SaveFile.new(@index)
  537.     @savefile_window.viewport = @savefile_viewport
  538.   end
  539.   #--------------------------------------------------------------------------
  540.   # ● 生成存档列表窗口
  541.   #--------------------------------------------------------------------------
  542.   def create_command_window
  543.     @command_window = Window_FileCommand.new
  544.     @command_window.index = first_savefile_index
  545.     @index = @command_window.index
  546.     @command_window.viewport = @savefile_viewport
  547.     @command_window.set_handler(:file,      method(:on_savefile_ok))
  548.   end
  549.   #--------------------------------------------------------------------------
  550.   # ● セーブファイル選択の更新
  551.   #--------------------------------------------------------------------------
  552.   def update_savefile_selection
  553.     if @source_index != nil
  554.       if Input.trigger?(:C)
  555.         if @index == @source_index
  556.           Sound.play_buzzer
  557.         elsif FileTest.exist?(DataManager.make_filename(@index))
  558.           Graphics.freeze
  559.           @command_window.deactivate
  560.           @window_replace.y = 72 + @index * 24
  561.           @window_replace.activate
  562.           @window_replace.visible = true
  563.           @window_replace.refresh
  564.           Sound.play_ok
  565.           Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  566.         else
  567.           return on_copy_ok
  568.         end
  569.       elsif Input.trigger?(:B)
  570.         return do_return_manager
  571.       end
  572.     else
  573.       if Input.trigger?(:C)
  574.         if self.is_a?(Scene_Save) and FileTest.exist?(DataManager.make_filename(@index))
  575.           Graphics.freeze
  576.           @command_window.deactivate
  577.           @window_replace.y = 72 + @index * 24
  578.           @window_replace.activate
  579.           @window_replace.visible = true
  580.           @window_replace.refresh
  581.           Sound.play_ok
  582.           Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  583.         else
  584.           return on_savefile_ok
  585.         end
  586.       elsif Input.trigger?(:B)
  587.         return on_savefile_cancel
  588.       elsif Input.trigger?(:F5)
  589.         unless @window_manager.active == true or
  590.                @window_delete.active == true or
  591.                @window_replace.active == true
  592.           return on_manager?
  593.         end
  594.       end
  595.     end
  596.     @need_refresh = true if @index != @command_window.index
  597.     if @need_refresh
  598.       Graphics.freeze
  599.       @index = @command_window.index
  600.       @savefile_window.dispose
  601.       create_savefile_window
  602.       @need_refresh = false
  603.       Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  604.     end
  605.   end
  606.   #--------------------------------------------------------------------------
  607.   # ● セーブファイル[決定]
  608.   #--------------------------------------------------------------------------
  609.   def on_savefile_ok
  610.   end
  611.   #--------------------------------------------------------------------------
  612.   # ● セーブファイル[キャンセル]
  613.   #--------------------------------------------------------------------------
  614.   def on_savefile_cancel
  615.     Sound.play_cancel
  616.     return_scene
  617.   end
  618.   #--------------------------------------------------------------------------
  619.   # ● セーブファイル[決定]
  620.   #--------------------------------------------------------------------------
  621.   def on_copy_ok
  622.     Graphics.freeze
  623.     source_name = DataManager.make_filename(@source_index)
  624.     new_name    = DataManager.make_filename(@index)
  625.     case @source_type
  626.     when "copy"
  627.       # 复制存档文件(API)
  628.       Win32API.new('kernel32',"CopyFileA",'ppl','').call(source_name,new_name,0)
  629.     when "move"
  630.       # 重命名存档
  631.       File.rename(source_name, new_name)
  632.     end
  633.     # 返回
  634.     @help_window.set_text(help_window_text)
  635.     @source_index = nil
  636.     do_return_savelist
  637.   end
  638.   #--------------------------------------------------------------------------
  639.   # ● セーブファイル[复制]
  640.   #--------------------------------------------------------------------------
  641.   def on_copy?
  642.     Graphics.freeze
  643.     @help_window.set_text(PS0::Window_SaveFile_Plus::HELP_COPY)
  644.     @source_index = @index
  645.     @source_type = "copy"
  646.     do_return_savelist
  647.   end
  648.   #--------------------------------------------------------------------------
  649.   # ● セーブファイル[移动]
  650.   #--------------------------------------------------------------------------
  651.   def on_move?
  652.     Graphics.freeze
  653.     @help_window.set_text(PS0::Window_SaveFile_Plus::HELP_MOVE)
  654.     @source_index = @index
  655.     @source_type = "move"
  656.     do_return_savelist
  657.   end
  658.   #--------------------------------------------------------------------------
  659.   # ● セーブファイル[管理]
  660.   #--------------------------------------------------------------------------
  661.   def on_manager?
  662.     if FileTest.exist?(DataManager.make_filename(@index))
  663.       Graphics.freeze
  664.       @command_window.deactivate
  665.       @window_manager.y = 72 + @index * 24
  666.       @window_manager.activate
  667.       @window_manager.visible = true
  668.       @window_manager.refresh
  669.       Sound.play_ok
  670.       Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  671.     else
  672.       Sound.play_buzzer
  673.     end
  674.   end
  675.   #--------------------------------------------------------------------------
  676.   # ● セーブファイル[删除]
  677.   #--------------------------------------------------------------------------
  678.   def on_delete?
  679.     Graphics.freeze
  680.     @window_manager.deactivate
  681.     @command_window.deactivate
  682.     @window_delete.y = 72 + 72 + @index * 24
  683.     @window_delete.activate
  684.     @window_delete.visible = true
  685.     @window_delete.refresh
  686.     Sound.play_ok
  687.     Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  688.   end
  689.   #--------------------------------------------------------------------------
  690.   # ● 删除
  691.   #--------------------------------------------------------------------------
  692.   def do_delete
  693.     Graphics.freeze
  694.     File.delete(DataManager.make_filename(@index))
  695.     @window_delete.index  = 0
  696.     @window_manager.index = 0
  697.     @window_delete.visible  = false
  698.     @window_manager.visible = false
  699.     @window_delete.deactivate
  700.     @window_manager.deactivate
  701.     @command_window.activate
  702.     @need_refresh = true
  703.     Sound.play_save
  704.     if DataManager.save_file_exists?
  705.       Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  706.     else
  707.       return_scene
  708.     end
  709.   end
  710.   #--------------------------------------------------------------------------
  711.   # ● 替换
  712.   #--------------------------------------------------------------------------
  713.   def do_replace
  714.     Graphics.freeze
  715.     if @source_index != nil
  716.       return on_copy_ok
  717.     else
  718.       return on_savefile_ok
  719.     end
  720.     @window_replace.visible = false
  721.     @window_replace.deactivate
  722.     @need_refresh = true
  723.   end
  724.   #--------------------------------------------------------------------------
  725.   # ● 取消
  726.   #--------------------------------------------------------------------------
  727.   def do_cancel
  728.     Graphics.freeze
  729.     Sound.play_cancel
  730.     @window_delete.index  = 0
  731.     @window_replace.index = 0
  732.     @window_manager.index = 0
  733.     @window_delete.visible  = false
  734.     @window_replace.visible = false
  735.     @window_manager.visible = false
  736.     @window_delete.deactivate
  737.     @window_replace.deactivate
  738.     @window_manager.deactivate
  739.     @command_window.activate
  740.     Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  741.   end
  742.   #--------------------------------------------------------------------------
  743.   # ● 返回管理菜单
  744.   #--------------------------------------------------------------------------
  745.   def do_return_manager
  746.     Graphics.freeze
  747.     @help_window.set_text(help_window_text)
  748.     @command_window.index = @source_index unless @source_index == nil
  749.     @source_index = nil
  750.     @source_type = nil
  751.     @command_window.deactivate
  752.     @window_delete.index  = 0
  753.     @window_replace.index = 0
  754.     @window_delete.visible  = false
  755.     @window_replace.visible = false
  756.     @window_delete.deactivate
  757.     @window_replace.deactivate
  758.     @window_manager.y = 72 + @index * 24
  759.     @window_manager.activate
  760.     @window_manager.visible = true
  761.     @window_manager.refresh
  762.     Sound.play_cancel
  763.     Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  764.   end
  765.   #--------------------------------------------------------------------------
  766.   # ● 返回文件列表(复制、移动 用)
  767.   #--------------------------------------------------------------------------
  768.   def do_return_savelist
  769.     @window_manager.visible = false
  770.     @window_manager.deactivate
  771.     @command_window.activate
  772.     @need_refresh = true
  773.     Sound.play_ok
  774.   end
  775. end
  776. #==============================================================================
  777. # [PS0] End of Script
  778. #==============================================================================
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
44
在线时间
31 小时
注册时间
2010-6-26
帖子
56
发表于 2012-5-4 19:19:52 | 显示全部楼层
这个脚本很实用啊!!
崇拜………………
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
32 小时
注册时间
2012-5-3
帖子
25
发表于 2012-5-12 16:32:30 | 显示全部楼层
报错了……
444行: NoMethodError ?
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
0 小时
注册时间
2012-6-22
帖子
5
发表于 2012-6-22 17:55:54 | 显示全部楼层
好东西,不过“拿”不下来呢??
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-3-29 08:46

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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