查看: 2287|回复: 2

[已经解决] 截图存档弹错

[复制链接]
梦石
0
星屑
50
在线时间
139 小时
注册时间
2013-1-30
回帖
39
发表于 2014-1-23 20:09:43 | 显示全部楼层 |阅读模式

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

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

×
使用截图存档使会出错

QQ截图20140123200548.png


  1. #==============================================================================
  2. $_PS0 = {} if $_PS0 == nil  
  3. $_PS0["Window_SaveFile_Plus"] = 20120216
  4. #==============================================================================
  5. # [PS0] 通用配置模块  
  6. #==============================================================================
  7. module PS0
  8.    module Window_SaveFile_Plus

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

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

  13.     # 无存档时显示的文字
  14.      NO_DATA  = "无存档"

  15.      # 保存时显示的信息
  16.      SAVE_NOW = "存档中..."

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

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

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

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

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

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

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

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

复制代码
愁死我了。。。。
梦石
0
星屑
600
在线时间
1118 小时
注册时间
2012-12-24
回帖
761
发表于 2014-1-23 20:47:06 | 显示全部楼层
本帖最后由 江户川洛奇 于 2014-1-24 11:16 编辑

测试表示没问题,就是把论坛自动加的代码删掉就可以了
就是那些[url=home.php?mod=space&uid=40913][/url]都删掉了

评分

参与人数 1星屑 +100 收起 理由
Sion + 100 认可答案

查看全部评分


点击签名档去一个神奇的地方
回复

使用道具 举报

梦石
0
星屑
50
在线时间
139 小时
注册时间
2013-1-30
回帖
39
 楼主| 发表于 2014-1-23 20:55:48 | 显示全部楼层
江户川洛奇 发表于 2014-1-23 20:47
测试表示没问题,就是把论坛自动加的代码删掉就可以了
就是那些和都删掉了 ...

恩,问题解决了
愁死我了。。。。
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部