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

Project1

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

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

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
139 小时
注册时间
2013-1-30
帖子
65
跳转到指定楼层
1
发表于 2014-1-23 20:09:43 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
使用截图存档使会出错



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

Lv2.观梦者

梦石
0
星屑
600
在线时间
1118 小时
注册时间
2012-12-24
帖子
831
2
发表于 2014-1-23 20:47:06 | 只看该作者
本帖最后由 江户川洛奇 于 2014-1-24 11:16 编辑

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

评分

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

查看全部评分


点击签名档去一个神奇的地方
回复 支持 反对

使用道具 举报

Lv1.梦旅人

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

恩,问题解决了
愁死我了。。。。
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-29 16:16

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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