查看: 2050|回复: 3

[已经解决] 在存档时人物下面添加等级要怎么做?

[复制链接]
梦石
0
星屑
96
在线时间
81 小时
注册时间
2015-6-30
回帖
21
发表于 2015-7-5 00:44:18 | 显示全部楼层 |阅读模式

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

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

×
[pre lang="ruby"]#==============================================================================
# [PS0]截图存档
#      Window_SaveFile_Plus
#------------------------------------------------------------------------------
#     一种带有截图的存档,同时可以自定义存档数量。
#==============================================================================
# [核心脚本]
#    - 快速储存Bitmap的Marshal         By 柳之一
#------------------------------------------------------------------------------
# [更新记录]
#    - 2012.02.16 By 各种压力的猫君
#      * 修正地图边缘时截图不完整的错误
#    - 2012.01.28 By 各种压力的猫君
#      * 去掉效率较差的双线性缩放算法;
#      * 新增存档管理功能(F5键,复制/移动/删除存档)
#    - 2011.12.27 By 各种压力的猫君
#      * 补上截图阴影;
#      * 新增“不缩放”截图(推荐使用,尤其是大分辨率);
#      * 修正选择不存在的存档时存档列表窗口卡死以及奇怪的SE;
#      * 新增“存档中”提示窗口、覆盖存档提示、删除存档功能(Z键,对应键盘D)
#    - 2011.12.26 By 各种压力的猫君
#      * 功能齐全的测试版
#    - 2011.12.16 By 各种压力的猫君
#      * 移植至RGSS3,遵循PS0协议;
#      * 丰富自定义选项,整合双线性插值算法精简版
#    - 2008.05.26 By 沉影不器
#      * 蓝本(VX新截图存档)
#------------------------------------------------------------------------------
# [使用方法]
#    - 删除原Scene_File、Window_SaveFile 并将本脚本插入到原Scene_File位置。
#    - 或者直接将本脚本插入到MAIN以上,并确保本脚本位于上述两个脚本以下。
#==============================================================================
$_PS0 = {} if $_PS0 == nil  
$_PS0["Window_SaveFile_Plus"] = 20120216
#==============================================================================
# [PS0] 通用配置模块  
#==============================================================================
module PS0
  module Window_SaveFile_Plus

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

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

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

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

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

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

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

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

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

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

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

  end
end
#==============================================================================
# [核心脚本] 快速储存Bitmap的Marshal By 柳之一
#==============================================================================
class Font
  def marshal_dump
  end
  def marshal_load(obj)
  end
end
class Bitmap
  RtlMoveMemory_pi = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
  RtlMoveMemory_ip = Win32API.new('kernel32', 'RtlMoveMemory', 'ipi', 'i')
  def _dump(limit)
    data = "rgba" * width * height
    RtlMoveMemory_pi.call(data, address, data.length)
    [width, height, Zlib::Deflate.deflate(data)].pack("LLa*")
  end
  def self._load(str)
    w, h, zdata = str.unpack("LLa*")
    b = self.new(w, h)
    RtlMoveMemory_ip.call(b.address, Zlib::Inflate.inflate(zdata), w * h * 4)
    return b
  end
  def address
    buffer, ad = "rgba", object_id * 2 + 16
    RtlMoveMemory_pi.call(buffer, ad, 4)
    ad = buffer.unpack("L")[0] + 8
    RtlMoveMemory_pi.call(buffer, ad, 4)
    ad = buffer.unpack("L")[0] + 16
    RtlMoveMemory_pi.call(buffer, ad, 4)
    return buffer.unpack("L")[0]
  end
end
#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
  attr_accessor :save_bitmap
  attr_accessor :save_snapshoot
  alias new_initialize initialize
  def initialize
    new_initialize
    @save_bitmap = Bitmap.new(1, 1)
    @save_snapshoot = Bitmap.new(1, 1)
  end
end
#==============================================================================
# ■ SceneManager
#==============================================================================
module SceneManager
  def self.snapshot_for_save
    $game_temp.save_bitmap = Graphics.snap_to_bitmap
    unless FileTest.exist?(PS0::Window_SaveFile_Plus::SAVE_DIR)
      Dir.mkdir(PS0::Window_SaveFile_Plus::SAVE_DIR)
    end
  end
end
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map < Scene_Base
  alias save_terminate terminate
  def terminate
    SceneManager.snapshot_for_save
    save_terminate
  end
end
#==============================================================================
# ■ DataManager
#==============================================================================
module DataManager
  def self.save_file_exists?
    !Dir.glob(PS0::Window_SaveFile_Plus::SAVE_DIR + 'Save*.rvdata2').empty?
  end
  def self.make_filename(index)
    sprintf(PS0::Window_SaveFile_Plus::SAVE_DIR + "Save%02d.rvdata2", index + 1)
  end
  #--------------------------------------------------------------------------
  # ● セーブヘッダの作成
  #--------------------------------------------------------------------------
  def self.make_save_header
    d_rect = Rect.new(0, 0, PS0::Window_SaveFile_Plus::Thumbnail_Width,
                            PS0::Window_SaveFile_Plus::Thumbnail_Height)
    case PS0::Window_SaveFile_Plus::Zoom_Type
    when "NN"
      s_rect = $game_temp.save_bitmap.rect
      $game_temp.save_snapshoot = Bitmap.new(d_rect.width, d_rect.height)
      $game_temp.save_snapshoot.stretch_blt(d_rect, $game_temp.save_bitmap, s_rect)
    when "NZ"
      x = [$game_player.screen_x - d_rect.width/2, 0].max
      x = [x, Graphics.width - d_rect.width].min
      y = [$game_player.screen_y - d_rect.height/2, 0].max
      y = [y, Graphics.height - d_rect.height].min
      s_rect = Rect.new(x, y, d_rect.width, d_rect.height)
      $game_temp.save_snapshoot = Bitmap.new(d_rect.width, d_rect.height)
      $game_temp.save_snapshoot.blt(0, 0, $game_temp.save_bitmap, s_rect)
    end
    header = {}
    header[:characters] = $game_party.characters_for_savefile
    header[:playtime_s] = $game_system.playtime_s
    header[:snapshoot]  = $game_temp.save_snapshoot
    header
  end
  #--------------------------------------------------------------------------
  # ● セーブの実行
  #--------------------------------------------------------------------------
  def self.save_game(index)
    saving_window = Window_Saving.new
    Graphics.update
    begin
      save_game_without_rescue(index)
    rescue
       delete_save_file(index)
       false
    end
    saving_window.dispose
    return true
  end
end
#==============================================================================
# ■ Window_Yes_Or_No
#------------------------------------------------------------------------------
#  提供“是”、“否”两个选项的窗口(替换、删除存档用)
#==============================================================================
class Window_Yes_Or_No < Window_HorzCommand
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(yes, no)
    @yes = yes
    @no = no
    super(130, 0)
    self.visible = false
    self.active = false
    @index = 0
  end
  #--------------------------------------------------------------------------
  # ● 桁数の取得
  #--------------------------------------------------------------------------
  def col_max
    return 2
  end
  #--------------------------------------------------------------------------
  # ● コマンドリストの作成
  #--------------------------------------------------------------------------
  def make_command_list
    add_command(@yes,   :yes)
    add_command(@no,    :cancel)
  end
  #--------------------------------------------------------------------------
  # ● 決定ボタンが押されたときの処理
  #--------------------------------------------------------------------------
  def process_ok
    Input.update
    call_ok_handler
  end
  #--------------------------------------------------------------------------
  # ● 按下取消键时的处理
  #--------------------------------------------------------------------------
  def process_cancel
    Input.update
    call_cancel_handler
  end
  #--------------------------------------------------------------------------
  # ● 启用窗口
  #--------------------------------------------------------------------------
  def activate
    temp = self.y + self.height - Graphics.height
    if temp > 0
      self.y -= (temp + 12)
    end
    self.active = true
    self
  end
end
#==============================================================================
# ■ Window_Saving
#------------------------------------------------------------------------------
#  显示保存信息的窗口
#==============================================================================
class Window_Saving < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    w = PS0::Window_SaveFile_Plus::SAVE_NOW.length * 16 + 32
    x = (Graphics.width - w)/2
    y = (Graphics.height - fitting_height(1))/2
    super(x, y, w, fitting_height(1))
    self.visible = PS0::Window_SaveFile_Plus::SHOW_SAVE_NOW
    draw_text_ex(4, 0, PS0::Window_SaveFile_Plus::SAVE_NOW)
  end
end
#==============================================================================
# ■ Window_SaveManagerCommand
#------------------------------------------------------------------------------
#  存档管理窗口
#==============================================================================
class Window_SaveManagerCommand < Window_Command
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize(*args)
    @copy, @move, @delete, @cancel = args[0..3]
    super(130, 0)
    self.visible = false
    self.active = false
    @index = 0
  end
  #--------------------------------------------------------------------------
  # ● 获取窗口的宽度
  #--------------------------------------------------------------------------
  def window_width
    return 100
  end
  #--------------------------------------------------------------------------
  # ● 获取项目数
  #--------------------------------------------------------------------------
  def item_max
    return 4
  end
  #--------------------------------------------------------------------------
  # ● 生成指令列表
  #--------------------------------------------------------------------------
  def make_command_list
    add_command(@copy,   :copy  )
    add_command(@move,   :move  )
    add_command(@delete, :delete)
    add_command(@cancel, :cancel)
  end
  #--------------------------------------------------------------------------
  # ● 按下确定键时的处理
  #--------------------------------------------------------------------------
  def process_ok
    Input.update
    call_ok_handler
  end
  #--------------------------------------------------------------------------
  # ● 启用窗口
  #--------------------------------------------------------------------------
  def activate
    temp = self.y + self.height - Graphics.height
    if temp > 0
      self.y -= (temp + 12)
    end
    self.active = true
    self
  end
end
#==============================================================================
# ■ Window_FileCommand
#------------------------------------------------------------------------------
#  截图存档左侧的选择窗口。
#==============================================================================
class Window_FileCommand < Window_Command
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0)
  end
  #--------------------------------------------------------------------------
  # ● ウィンドウ幅の取得
  #--------------------------------------------------------------------------
  def window_height
    return Graphics.height-fitting_height(1)
  end
  #--------------------------------------------------------------------------
  # ● 表示行数の取得
  #--------------------------------------------------------------------------
  def visible_line_number
    item_max
  end
  #--------------------------------------------------------------------------
  # ● コマンドリストの作成
  #--------------------------------------------------------------------------
  def make_command_list
    add_main_commands
  end
  #--------------------------------------------------------------------------
  # ● 主要コマンドをリストに追加
  #--------------------------------------------------------------------------
  def add_main_commands
    for i in 1..PS0::Window_SaveFile_Plus::MAX_SAVE
      if i < 10
        text = Vocab::File + " 0" + i.to_s
      else
        text = Vocab::File + " " + i.to_s
      end
      add_command(text, :file)
    end
  end
  #--------------------------------------------------------------------------
  # ● 決定ボタンが押されたときの処理
  #--------------------------------------------------------------------------
  def process_ok
  end
end
#==============================================================================
# ■ Window_SaveFile
#------------------------------------------------------------------------------
#  セーブ画面およびロード画面で表示する、セーブファイルのウィンドウです。
#==============================================================================
class Window_SaveFile < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #     index : セーブファイルのインデックス
  #--------------------------------------------------------------------------
  def initialize(index)
    super(160, 0, Graphics.width-160, Graphics.height-fitting_height(1))
    @file_index = index
    @selected = true
    refresh
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    change_color(normal_color)
    w = (self.width-PS0::Window_SaveFile_Plus::Thumbnail_Width-16)/2
    h = (self.height-PS0::Window_SaveFile_Plus::Thumbnail_Height-16)/2
    width  = w + PS0::Window_SaveFile_Plus::Thumbnail_ox
    height = h + PS0::Window_SaveFile_Plus::Thumbnail_oy
    draw_shadow(width+5, height+5)
    draw_text((self.width-32-PS0::Window_SaveFile_Plus::NO_DATA.length*16)/2,
              self.height/2-32, PS0::Window_SaveFile_Plus::NO_DATA.length*32,
              line_height, PS0::Window_SaveFile_Plus::NO_DATA)
    draw_party_characters(32, Graphics.height-fitting_height(1)-32)
    draw_playtime(-10, contents.height - line_height-10, contents.width - 4, 2)
    draw_snapshoot(width, height)
  end
  #--------------------------------------------------------------------------
  # ● パーティキャラの描画
  #--------------------------------------------------------------------------
  def draw_party_characters(x, y)
    header = DataManager.load_header(@file_index)
    return unless header
    header[:characters].each_with_index do |data, i|
      draw_character(data[0], data[1], x + i * 48, y)
      
    end
  end
  

  #--------------------------------------------------------------------------
  # ● プレイ時間の描画
  #--------------------------------------------------------------------------
  def draw_playtime(x, y, width, align)
    header = DataManager.load_header(@file_index)
    return unless header
    draw_text(x, y, width, line_height, header[:playtime_s], 2)
  end
  #--------------------------------------------------------------------------
  # ● 绘制截图
  #--------------------------------------------------------------------------
  def draw_snapshoot(x, y)
    header = DataManager.load_header(@file_index)
    return unless header
    bitmap = header[:snapshoot]
    contents.blt(x, y, bitmap, bitmap.rect)
    bitmap.dispose
  end
  #--------------------------------------------------------------------------
  # ● 绘制阴影
  #--------------------------------------------------------------------------
  def draw_shadow(x, y)
    header = DataManager.load_header(@file_index)
    return unless header
    contents.fill_rect(x, y, PS0::Window_SaveFile_Plus::Thumbnail_Width,
                             PS0::Window_SaveFile_Plus::Thumbnail_Height, Color.new(0, 0, 0))
    contents.blur
  end
end
#==============================================================================
# ■ Scene_File
#------------------------------------------------------------------------------
#  セーブ画面とロード画面の共通処理を行うクラスです。
#==============================================================================
class Scene_File < Scene_MenuBase
  #--------------------------------------------------------------------------
  # ● 開始処理
  #--------------------------------------------------------------------------
  def start
    super
    create_help_window
    create_savefile_viewport
    create_command_window
    create_savefile_window
    create_manager_window
    create_replace_window
    create_delete_window
  end
  #--------------------------------------------------------------------------
  # ● 終了処理
  #--------------------------------------------------------------------------
  def terminate
    super
    @savefile_viewport.dispose
    @savefile_window.dispose
    @command_window.dispose
    @window_manager.dispose
    @window_replace.dispose
    @window_delete.dispose
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    super
    update_savefile_selection
  end
  #--------------------------------------------------------------------------
  # ● 创建替换窗口
  #--------------------------------------------------------------------------
  def create_replace_window
    @window_replace = Window_Yes_Or_No.new("替换", "取消")
    @window_replace.set_handler(:yes,    method(:do_replace))
    @window_replace.set_handler(:cancel, method(:do_cancel))
  end
  #--------------------------------------------------------------------------
  # ● 创建删除窗口
  #--------------------------------------------------------------------------
  def create_delete_window
    @window_delete  = Window_Yes_Or_No.new("删除", "取消")
    @window_delete.set_handler(:yes,    method(:do_delete))
    @window_delete.set_handler(:cancel, method(:do_return_manager))
    @window_delete.x += 40
  end
  #--------------------------------------------------------------------------
  # ● 创建管理窗口
  #--------------------------------------------------------------------------
  def create_manager_window
    @window_manager = Window_SaveManagerCommand.new("复制", "移动", "删除", "取消")
    @window_manager.set_handler(:copy  , method(:on_copy?))
    @window_manager.set_handler(:move  , method(:on_move?))
    @window_manager.set_handler(:delete, method(:on_delete?))
    @window_manager.set_handler(:cancel, method(:do_cancel))
  end
  #--------------------------------------------------------------------------
  # ● ヘルプウィンドウの作成
  #--------------------------------------------------------------------------
  def create_help_window
    @help_window = Window_Help.new(1)
    @help_window.set_text(help_window_text)
  end
  #--------------------------------------------------------------------------
  # ● ヘルプウィンドウのテキストを取得
  #--------------------------------------------------------------------------
  def help_window_text
    return ""
  end
  #--------------------------------------------------------------------------
  # ● セーブファイルビューポートの作成
  #--------------------------------------------------------------------------
  def create_savefile_viewport
    @savefile_viewport = Viewport.new
    @savefile_viewport.rect.y = @help_window.height
    @savefile_viewport.rect.height -= @help_window.height
  end
  #--------------------------------------------------------------------------
  # ● セーブファイルウィンドウの作成
  #--------------------------------------------------------------------------
  def create_savefile_window
    @savefile_window = Window_SaveFile.new(@index)
    @savefile_window.viewport = @savefile_viewport
  end
  #--------------------------------------------------------------------------
  # ● 生成存档列表窗口
  #--------------------------------------------------------------------------
  def create_command_window
    @command_window = Window_FileCommand.new
    @command_window.index = first_savefile_index
    @index = @command_window.index
    @command_window.viewport = @savefile_viewport
    @command_window.set_handler(:file,      method(:on_savefile_ok))
  end
  #--------------------------------------------------------------------------
  # ● セーブファイル選択の更新
  #--------------------------------------------------------------------------
  def update_savefile_selection
    if @source_index != nil
      if Input.trigger?(:C)
        if @index == @source_index
          Sound.play_buzzer
        elsif FileTest.exist?(DataManager.make_filename(@index))
          Graphics.freeze
          @command_window.deactivate
          @window_replace.y = 72 + @index * 24
          @window_replace.activate
          @window_replace.visible = true
          @window_replace.refresh
          Sound.play_ok
          Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
        else
          return on_copy_ok
        end
      elsif Input.trigger?(:B)
        return do_return_manager
      end
    else
      if Input.trigger?(:C)
        if self.is_a?(Scene_Save) and FileTest.exist?(DataManager.make_filename(@index))
          Graphics.freeze
          @command_window.deactivate
          @window_replace.y = 72 + @index * 24
          @window_replace.activate
          @window_replace.visible = true
          @window_replace.refresh
          Sound.play_ok
          Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
        else
          return on_savefile_ok
        end
      elsif Input.trigger?(:B)
        return on_savefile_cancel
      elsif Input.trigger?(:F5)
        unless @window_manager.active == true or
               @window_delete.active == true or
               @window_replace.active == true
          return on_manager?
        end
      end
    end
    @need_refresh = true if @index != @command_window.index
    if @need_refresh
      Graphics.freeze
      @index = @command_window.index
      @savefile_window.dispose
      create_savefile_window
      @need_refresh = false
      Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
    end
  end
  #--------------------------------------------------------------------------
  # ● セーブファイル[決定]
  #--------------------------------------------------------------------------
  def on_savefile_ok
  end
  #--------------------------------------------------------------------------
  # ● セーブファイル[キャンセル]
  #--------------------------------------------------------------------------
  def on_savefile_cancel
    Sound.play_cancel
    return_scene
  end
  #--------------------------------------------------------------------------
  # ● セーブファイル[決定]
  #--------------------------------------------------------------------------
  def on_copy_ok
    Graphics.freeze
    source_name = DataManager.make_filename(@source_index)
    new_name    = DataManager.make_filename(@index)
    case @source_type
    when "copy"
      # 复制存档文件(API)
      Win32API.new('kernel32',"CopyFileA",'ppl','').call(source_name,new_name,0)
    when "move"
      # 重命名存档
      File.rename(source_name, new_name)
    end
    # 返回
    @help_window.set_text(help_window_text)
    @source_index = nil
    do_return_savelist
  end
  #--------------------------------------------------------------------------
  # ● セーブファイル[复制]
  #--------------------------------------------------------------------------
  def on_copy?
    Graphics.freeze
    @help_window.set_text(PS0::Window_SaveFile_Plus::HELP_COPY)
    @source_index = @index
    @source_type = "copy"
    do_return_savelist
  end
  #--------------------------------------------------------------------------
  # ● セーブファイル[移动]
  #--------------------------------------------------------------------------
  def on_move?
    Graphics.freeze
    @help_window.set_text(PS0::Window_SaveFile_Plus::HELP_MOVE)
    @source_index = @index
    @source_type = "move"
    do_return_savelist
  end
  #--------------------------------------------------------------------------
  # ● セーブファイル[管理]
  #--------------------------------------------------------------------------
  def on_manager?
    if FileTest.exist?(DataManager.make_filename(@index))
      Graphics.freeze
      @command_window.deactivate
      @window_manager.y = 72 + @index * 24
      @window_manager.activate
      @window_manager.visible = true
      @window_manager.refresh
      Sound.play_ok
      Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
    else
      Sound.play_buzzer
    end
  end
  #--------------------------------------------------------------------------
  # ● セーブファイル[删除]
  #--------------------------------------------------------------------------
  def on_delete?
    Graphics.freeze
    @window_manager.deactivate
    @command_window.deactivate
    @window_delete.y = 72 + 72 + @index * 24
    @window_delete.activate
    @window_delete.visible = true
    @window_delete.refresh
    Sound.play_ok
    Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  end
  #--------------------------------------------------------------------------
  # ● 删除
  #--------------------------------------------------------------------------
  def do_delete
    Graphics.freeze
    File.delete(DataManager.make_filename(@index))
    @window_delete.index  = 0
    @window_manager.index = 0
    @window_delete.visible  = false
    @window_manager.visible = false
    @window_delete.deactivate
    @window_manager.deactivate
    @command_window.activate
    @need_refresh = true
    Sound.play_save
    if DataManager.save_file_exists?
      Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
    else
      return_scene
    end
  end
  #--------------------------------------------------------------------------
  # ● 替换
  #--------------------------------------------------------------------------
  def do_replace
    Graphics.freeze
    if @source_index != nil
      return on_copy_ok
    else
      return on_savefile_ok
    end
    @window_replace.visible = false
    @window_replace.deactivate
    @need_refresh = true
  end
  #--------------------------------------------------------------------------
  # ● 取消
  #--------------------------------------------------------------------------
  def do_cancel
    Graphics.freeze
    Sound.play_cancel
    @window_delete.index  = 0
    @window_replace.index = 0
    @window_manager.index = 0
    @window_delete.visible  = false
    @window_replace.visible = false
    @window_manager.visible = false
    @window_delete.deactivate
    @window_replace.deactivate
    @window_manager.deactivate
    @command_window.activate
    Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  end
  #--------------------------------------------------------------------------
  # ● 返回管理菜单
  #--------------------------------------------------------------------------
  def do_return_manager
    Graphics.freeze
    @help_window.set_text(help_window_text)
    @command_window.index = @source_index unless @source_index == nil
    @source_index = nil
    @source_type = nil
    @command_window.deactivate
    @window_delete.index  = 0
    @window_replace.index = 0
    @window_delete.visible  = false
    @window_replace.visible = false
    @window_delete.deactivate
    @window_replace.deactivate
    @window_manager.y = 72 + @index * 24
    @window_manager.activate
    @window_manager.visible = true
    @window_manager.refresh
    Sound.play_cancel
    Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  end
  #--------------------------------------------------------------------------
  # ● 返回文件列表(复制、移动 用)
  #--------------------------------------------------------------------------
  def do_return_savelist
    @window_manager.visible = false
    @window_manager.deactivate
    @command_window.activate
    @need_refresh = true
    Sound.play_ok
  end
end
#==============================================================================
# [PS0] End of Script
#==============================================================================
[/pre]
梦石
0
星屑
702
在线时间
326 小时
注册时间
2013-5-31
回帖
67
发表于 2015-7-12 10:37:51 | 显示全部楼层
有实际样图不?草图涂鸦也行。

点评

补充:我好像懂了,我试试。  发表于 2015-7-12 10:39
回复

使用道具 举报

梦石
0
星屑
702
在线时间
326 小时
注册时间
2013-5-31
回帖
67
发表于 2015-7-12 11:49:13 | 显示全部楼层

  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 = "NN"

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

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

  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_Party
  110. #==============================================================================
  111. class Game_Party
  112.   #获取每个行走图的角色等级
  113.   def levels
  114.     battle_members.collect do |actor|
  115.       actor.level
  116.     end
  117.   end
  118. end
  119. #==============================================================================
  120. # ■ Game_Temp
  121. #==============================================================================
  122. class Game_Temp
  123.   attr_accessor :save_bitmap
  124.   attr_accessor :save_snapshoot
  125.   alias new_initialize initialize
  126.   def initialize
  127.     new_initialize
  128.     @save_bitmap = Bitmap.new(1, 1)
  129.     @save_snapshoot = Bitmap.new(1, 1)
  130.   end
  131. end
  132. #==============================================================================
  133. # ■ SceneManager
  134. #==============================================================================
  135. module SceneManager
  136.   def self.snapshot_for_save
  137.     $game_temp.save_bitmap = Graphics.snap_to_bitmap
  138.     unless FileTest.exist?(PS0::Window_SaveFile_Plus::SAVE_DIR)
  139.       Dir.mkdir(PS0::Window_SaveFile_Plus::SAVE_DIR)
  140.     end
  141.   end
  142. end
  143. #==============================================================================
  144. # ■ Scene_Map
  145. #==============================================================================
  146. class Scene_Map < Scene_Base
  147.   alias save_terminate terminate
  148.   def terminate
  149.     SceneManager.snapshot_for_save
  150.     save_terminate
  151.   end
  152. end
  153. #==============================================================================
  154. # ■ DataManager
  155. #==============================================================================
  156. module DataManager
  157.   def self.save_file_exists?
  158.     !Dir.glob(PS0::Window_SaveFile_Plus::SAVE_DIR + 'Save*.rvdata2').empty?
  159.   end
  160.   def self.make_filename(index)
  161.     sprintf(PS0::Window_SaveFile_Plus::SAVE_DIR + "Save%02d.rvdata2", index + 1)
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # ● セーブヘッダの作成
  165.   #--------------------------------------------------------------------------
  166.   def self.make_save_header
  167.     d_rect = Rect.new(0, 0, PS0::Window_SaveFile_Plus::Thumbnail_Width,
  168.                             PS0::Window_SaveFile_Plus::Thumbnail_Height)
  169.     case PS0::Window_SaveFile_Plus::Zoom_Type
  170.     when "NN"
  171.       s_rect = $game_temp.save_bitmap.rect
  172.       $game_temp.save_snapshoot = Bitmap.new(d_rect.width, d_rect.height)
  173.       $game_temp.save_snapshoot.stretch_blt(d_rect, $game_temp.save_bitmap, s_rect)
  174.     when "NZ"
  175.       x = [$game_player.screen_x - d_rect.width/2, 0].max
  176.       x = [x, Graphics.width - d_rect.width].min
  177.       y = [$game_player.screen_y - d_rect.height/2, 0].max
  178.       y = [y, Graphics.height - d_rect.height].min
  179.       s_rect = Rect.new(x, y, d_rect.width, d_rect.height)
  180.       $game_temp.save_snapshoot = Bitmap.new(d_rect.width, d_rect.height)
  181.       $game_temp.save_snapshoot.blt(0, 0, $game_temp.save_bitmap, s_rect)
  182.     end
  183.     header = {}
  184.     header[:characters] = $game_party.characters_for_savefile
  185.     header[:playtime_s] = $game_system.playtime_s
  186.     header[:snapshoot]  = $game_temp.save_snapshoot
  187.     header[:levels] = $game_party.levels
  188.     header
  189.   end
  190.   #--------------------------------------------------------------------------
  191.   # ● セーブの実行
  192.   #--------------------------------------------------------------------------
  193.   def self.save_game(index)
  194.     saving_window = Window_Saving.new
  195.     Graphics.update
  196.     begin
  197.       save_game_without_rescue(index)
  198.     rescue
  199.        delete_save_file(index)
  200.        false
  201.     end
  202.     saving_window.dispose
  203.     return true
  204.   end
  205. end
  206. #==============================================================================
  207. # ■ Window_Yes_Or_No
  208. #------------------------------------------------------------------------------
  209. #  提供“是”、“否”两个选项的窗口(替换、删除存档用)
  210. #==============================================================================
  211. class Window_Yes_Or_No < Window_HorzCommand
  212.   #--------------------------------------------------------------------------
  213.   # ● オブジェクト初期化
  214.   #--------------------------------------------------------------------------
  215.   def initialize(yes, no)
  216.     @yes = yes
  217.     @no = no
  218.     super(130, 0)
  219.     self.visible = false
  220.     self.active = false
  221.     @index = 0
  222.   end
  223.   #--------------------------------------------------------------------------
  224.   # ● 桁数の取得
  225.   #--------------------------------------------------------------------------
  226.   def col_max
  227.     return 2
  228.   end
  229.   #--------------------------------------------------------------------------
  230.   # ● コマンドリストの作成
  231.   #--------------------------------------------------------------------------
  232.   def make_command_list
  233.     add_command(@yes,   :yes)
  234.     add_command(@no,    :cancel)
  235.   end
  236.   #--------------------------------------------------------------------------
  237.   # ● 決定ボタンが押されたときの処理
  238.   #--------------------------------------------------------------------------
  239.   def process_ok
  240.     Input.update
  241.     call_ok_handler
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # ● 按下取消键时的处理
  245.   #--------------------------------------------------------------------------
  246.   def process_cancel
  247.     Input.update
  248.     call_cancel_handler
  249.   end
  250.   #--------------------------------------------------------------------------
  251.   # ● 启用窗口
  252.   #--------------------------------------------------------------------------
  253.   def activate
  254.     temp = self.y + self.height - Graphics.height
  255.     if temp > 0
  256.       self.y -= (temp + 12)
  257.     end
  258.     self.active = true
  259.     self
  260.   end
  261. end
  262. #==============================================================================
  263. # ■ Window_Saving
  264. #------------------------------------------------------------------------------
  265. #  显示保存信息的窗口
  266. #==============================================================================
  267. class Window_Saving < Window_Base
  268.   #--------------------------------------------------------------------------
  269.   # ● オブジェクト初期化
  270.   #--------------------------------------------------------------------------
  271.   def initialize
  272.     w = PS0::Window_SaveFile_Plus::SAVE_NOW.length * 16 + 32
  273.     x = (Graphics.width - w)/2
  274.     y = (Graphics.height - fitting_height(1))/2
  275.     super(x, y, w, fitting_height(1))
  276.     self.visible = PS0::Window_SaveFile_Plus::SHOW_SAVE_NOW
  277.     draw_text_ex(4, 0, PS0::Window_SaveFile_Plus::SAVE_NOW)
  278.   end
  279. end
  280. #==============================================================================
  281. # ■ Window_SaveManagerCommand
  282. #------------------------------------------------------------------------------
  283. #  存档管理窗口
  284. #==============================================================================
  285. class Window_SaveManagerCommand < Window_Command
  286.   #--------------------------------------------------------------------------
  287.   # ● 初始化对象
  288.   #--------------------------------------------------------------------------
  289.   def initialize(*args)
  290.     @copy, @move, @delete, @cancel = args[0..3]
  291.     super(130, 0)
  292.     self.visible = false
  293.     self.active = false
  294.     @index = 0
  295.   end
  296.   #--------------------------------------------------------------------------
  297.   # ● 获取窗口的宽度
  298.   #--------------------------------------------------------------------------
  299.   def window_width
  300.     return 100
  301.   end
  302.   #--------------------------------------------------------------------------
  303.   # ● 获取项目数
  304.   #--------------------------------------------------------------------------
  305.   def item_max
  306.     return 4
  307.   end
  308.   #--------------------------------------------------------------------------
  309.   # ● 生成指令列表
  310.   #--------------------------------------------------------------------------
  311.   def make_command_list
  312.     add_command(@copy,   :copy  )
  313.     add_command(@move,   :move  )
  314.     add_command(@delete, :delete)
  315.     add_command(@cancel, :cancel)
  316.   end
  317.   #--------------------------------------------------------------------------
  318.   # ● 按下确定键时的处理
  319.   #--------------------------------------------------------------------------
  320.   def process_ok
  321.     Input.update
  322.     call_ok_handler
  323.   end
  324.   #--------------------------------------------------------------------------
  325.   # ● 启用窗口
  326.   #--------------------------------------------------------------------------
  327.   def activate
  328.     temp = self.y + self.height - Graphics.height
  329.     if temp > 0
  330.       self.y -= (temp + 12)
  331.     end
  332.     self.active = true
  333.     self
  334.   end
  335. end
  336. #==============================================================================
  337. # ■ Window_FileCommand
  338. #------------------------------------------------------------------------------
  339. #  截图存档左侧的选择窗口。
  340. #==============================================================================
  341. class Window_FileCommand < Window_Command
  342.   #--------------------------------------------------------------------------
  343.   # ● オブジェクト初期化
  344.   #--------------------------------------------------------------------------
  345.   def initialize
  346.     super(0, 0)
  347.   end
  348.   #--------------------------------------------------------------------------
  349.   # ● ウィンドウ幅の取得
  350.   #--------------------------------------------------------------------------
  351.   def window_height
  352.     return Graphics.height-fitting_height(1)
  353.   end
  354.   #--------------------------------------------------------------------------
  355.   # ● 表示行数の取得
  356.   #--------------------------------------------------------------------------
  357.   def visible_line_number
  358.     item_max
  359.   end
  360.   #--------------------------------------------------------------------------
  361.   # ● コマンドリストの作成
  362.   #--------------------------------------------------------------------------
  363.   def make_command_list
  364.     add_main_commands
  365.   end
  366.   #--------------------------------------------------------------------------
  367.   # ● 主要コマンドをリストに追加
  368.   #--------------------------------------------------------------------------
  369.   def add_main_commands
  370.     for i in 1..PS0::Window_SaveFile_Plus::MAX_SAVE
  371.       if i < 10
  372.         text = Vocab::File + " 0" + i.to_s
  373.       else
  374.         text = Vocab::File + " " + i.to_s
  375.       end
  376.       add_command(text, :file)
  377.     end
  378.   end
  379.   #--------------------------------------------------------------------------
  380.   # ● 決定ボタンが押されたときの処理
  381.   #--------------------------------------------------------------------------
  382.   def process_ok
  383.   end
  384. end
  385. #==============================================================================
  386. # ■ Window_SaveFile
  387. #------------------------------------------------------------------------------
  388. #  セーブ画面およびロード画面で表示する、セーブファイルのウィンドウです。
  389. #==============================================================================
  390. class Window_SaveFile < Window_Base
  391.   #--------------------------------------------------------------------------
  392.   # ● オブジェクト初期化
  393.   #     index : セーブファイルのインデックス
  394.   #--------------------------------------------------------------------------
  395.   def initialize(index)
  396.     super(160, 0, Graphics.width-160, Graphics.height-fitting_height(1))
  397.     @file_index = index
  398.     @selected = true
  399.     refresh
  400.   end
  401.   #--------------------------------------------------------------------------
  402.   # ● リフレッシュ
  403.   #--------------------------------------------------------------------------
  404.   def refresh
  405.     contents.clear
  406.     contents.font.size = 12
  407.     change_color(normal_color)
  408.     w = (self.width-PS0::Window_SaveFile_Plus::Thumbnail_Width-16)/2
  409.     h = (self.height-PS0::Window_SaveFile_Plus::Thumbnail_Height-16)/2
  410.     width  = w + PS0::Window_SaveFile_Plus::Thumbnail_ox
  411.     height = h + PS0::Window_SaveFile_Plus::Thumbnail_oy
  412.     draw_shadow(width+5, height+5)
  413.     draw_text((self.width-32-PS0::Window_SaveFile_Plus::NO_DATA.length*16)/2,
  414.               self.height/2-32, PS0::Window_SaveFile_Plus::NO_DATA.length*32,
  415.               line_height, PS0::Window_SaveFile_Plus::NO_DATA)
  416.     draw_party_characters(32, Graphics.height-fitting_height(1)-32)
  417.     draw_playtime(-10, contents.height - line_height-10, contents.width - 4, 2)
  418.     draw_level(32, Graphics.height-fitting_height(1)- 42)
  419.     draw_snapshoot(width, height)
  420.   end
  421.   #--------------------------------------------------------------------------
  422.   # ● パーティキャラの描画
  423.   #--------------------------------------------------------------------------
  424.   def draw_party_characters(x, y)
  425.     header = DataManager.load_header(@file_index)
  426.     return unless header
  427.     header[:characters].each_with_index do |data, i|
  428.       draw_character(data[0], data[1], x + i * 48, y)

  429.     end
  430.   end


  431.   #--------------------------------------------------------------------------
  432.   # ● プレイ時間の描画
  433.   #--------------------------------------------------------------------------
  434.   def draw_playtime(x, y, width, align)
  435.     header = DataManager.load_header(@file_index)
  436.     return unless header
  437.     draw_text(x, y, width, line_height, header[:playtime_s], 2)
  438.   end
  439.   #--------------------------------------------------------------------------
  440.   # ● 绘制截图
  441.   #--------------------------------------------------------------------------
  442.   def draw_snapshoot(x, y)
  443.     header = DataManager.load_header(@file_index)
  444.     return unless header
  445.     bitmap = header[:snapshoot]
  446.     contents.blt(x, y, bitmap, bitmap.rect)
  447.     bitmap.dispose
  448.   end
  449.   #绘制等级
  450.   def draw_level(x, y)
  451.     header = DataManager.load_header(@file_index)
  452.     return unless header
  453.     header[:levels].each_with_index do |data,i|
  454.       draw_text(x + i * 48, y, 64, line_height, "Lv" + data.to_s)
  455.     end
  456.     #draw_text(x, y, width, line_height, header[:levels], 2)
  457.   end
  458.   #--------------------------------------------------------------------------
  459.   # ● 绘制阴影
  460.   #--------------------------------------------------------------------------
  461.   def draw_shadow(x, y)
  462.     header = DataManager.load_header(@file_index)
  463.     return unless header
  464.     contents.fill_rect(x, y, PS0::Window_SaveFile_Plus::Thumbnail_Width,
  465.                              PS0::Window_SaveFile_Plus::Thumbnail_Height, Color.new(0, 0, 0))
  466.     contents.blur
  467.   end
  468. end
  469. #==============================================================================
  470. # ■ Scene_File
  471. #------------------------------------------------------------------------------
  472. #  セーブ画面とロード画面の共通処理を行うクラスです。
  473. #==============================================================================
  474. class Scene_File < Scene_MenuBase
  475.   #--------------------------------------------------------------------------
  476.   # ● 開始処理
  477.   #--------------------------------------------------------------------------
  478.   def start
  479.     super
  480.     create_help_window
  481.     create_savefile_viewport
  482.     create_command_window
  483.     create_savefile_window
  484.     create_manager_window
  485.     create_replace_window
  486.     create_delete_window
  487.   end
  488.   #--------------------------------------------------------------------------
  489.   # ● 終了処理
  490.   #--------------------------------------------------------------------------
  491.   def terminate
  492.     super
  493.     @savefile_viewport.dispose
  494.     @savefile_window.dispose
  495.     @command_window.dispose
  496.     @window_manager.dispose
  497.     @window_replace.dispose
  498.     @window_delete.dispose
  499.   end
  500.   #--------------------------------------------------------------------------
  501.   # ● フレーム更新
  502.   #--------------------------------------------------------------------------
  503.   def update
  504.     super
  505.     update_savefile_selection
  506.   end
  507.   #--------------------------------------------------------------------------
  508.   # ● 创建替换窗口
  509.   #--------------------------------------------------------------------------
  510.   def create_replace_window
  511.     @window_replace = Window_Yes_Or_No.new("替换", "取消")
  512.     @window_replace.set_handler(:yes,    method(:do_replace))
  513.     @window_replace.set_handler(:cancel, method(:do_cancel))
  514.   end
  515.   #--------------------------------------------------------------------------
  516.   # ● 创建删除窗口
  517.   #--------------------------------------------------------------------------
  518.   def create_delete_window
  519.     @window_delete  = Window_Yes_Or_No.new("删除", "取消")
  520.     @window_delete.set_handler(:yes,    method(:do_delete))
  521.     @window_delete.set_handler(:cancel, method(:do_return_manager))
  522.     @window_delete.x += 40
  523.   end
  524.   #--------------------------------------------------------------------------
  525.   # ● 创建管理窗口
  526.   #--------------------------------------------------------------------------
  527.   def create_manager_window
  528.     @window_manager = Window_SaveManagerCommand.new("复制", "移动", "删除", "取消")
  529.     @window_manager.set_handler(:copy  , method(:on_copy?))
  530.     @window_manager.set_handler(:move  , method(:on_move?))
  531.     @window_manager.set_handler(:delete, method(:on_delete?))
  532.     @window_manager.set_handler(:cancel, method(:do_cancel))
  533.   end
  534.   #--------------------------------------------------------------------------
  535.   # ● ヘルプウィンドウの作成
  536.   #--------------------------------------------------------------------------
  537.   def create_help_window
  538.     @help_window = Window_Help.new(1)
  539.     @help_window.set_text(help_window_text)
  540.   end
  541.   #--------------------------------------------------------------------------
  542.   # ● ヘルプウィンドウのテキストを取得
  543.   #--------------------------------------------------------------------------
  544.   def help_window_text
  545.     return ""
  546.   end
  547.   #--------------------------------------------------------------------------
  548.   # ● セーブファイルビューポートの作成
  549.   #--------------------------------------------------------------------------
  550.   def create_savefile_viewport
  551.     @savefile_viewport = Viewport.new
  552.     @savefile_viewport.rect.y = @help_window.height
  553.     @savefile_viewport.rect.height -= @help_window.height
  554.   end
  555.   #--------------------------------------------------------------------------
  556.   # ● セーブファイルウィンドウの作成
  557.   #--------------------------------------------------------------------------
  558.   def create_savefile_window
  559.     @savefile_window = Window_SaveFile.new(@index)
  560.     @savefile_window.viewport = @savefile_viewport
  561.   end
  562.   #--------------------------------------------------------------------------
  563.   # ● 生成存档列表窗口
  564.   #--------------------------------------------------------------------------
  565.   def create_command_window
  566.     @command_window = Window_FileCommand.new
  567.     @command_window.index = first_savefile_index
  568.     @index = @command_window.index
  569.     @command_window.viewport = @savefile_viewport
  570.     @command_window.set_handler(:file,      method(:on_savefile_ok))
  571.   end
  572.   #--------------------------------------------------------------------------
  573.   # ● セーブファイル選択の更新
  574.   #--------------------------------------------------------------------------
  575.   def update_savefile_selection
  576.     if @source_index != nil
  577.       if Input.trigger?(:C)
  578.         if @index == @source_index
  579.           Sound.play_buzzer
  580.         elsif FileTest.exist?(DataManager.make_filename(@index))
  581.           Graphics.freeze
  582.           @command_window.deactivate
  583.           @window_replace.y = 72 + @index * 24
  584.           @window_replace.activate
  585.           @window_replace.visible = true
  586.           @window_replace.refresh
  587.           Sound.play_ok
  588.           Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  589.         else
  590.           return on_copy_ok
  591.         end
  592.       elsif Input.trigger?(:B)
  593.         return do_return_manager
  594.       end
  595.     else
  596.       if Input.trigger?(:C)
  597.         if self.is_a?(Scene_Save) and FileTest.exist?(DataManager.make_filename(@index))
  598.           Graphics.freeze
  599.           @command_window.deactivate
  600.           @window_replace.y = 72 + @index * 24
  601.           @window_replace.activate
  602.           @window_replace.visible = true
  603.           @window_replace.refresh
  604.           Sound.play_ok
  605.           Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  606.         else
  607.           return on_savefile_ok
  608.         end
  609.       elsif Input.trigger?(:B)
  610.         return on_savefile_cancel
  611.       elsif Input.trigger?(:F5)
  612.         unless @window_manager.active == true or
  613.                @window_delete.active == true or
  614.                @window_replace.active == true
  615.           return on_manager?
  616.         end
  617.       end
  618.     end
  619.     @need_refresh = true if @index != @command_window.index
  620.     if @need_refresh
  621.       Graphics.freeze
  622.       @index = @command_window.index
  623.       @savefile_window.dispose
  624.       create_savefile_window
  625.       @need_refresh = false
  626.       Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  627.     end
  628.   end
  629.   #--------------------------------------------------------------------------
  630.   # ● セーブファイル[決定]
  631.   #--------------------------------------------------------------------------
  632.   def on_savefile_ok
  633.   end
  634.   #--------------------------------------------------------------------------
  635.   # ● セーブファイル[キャンセル]
  636.   #--------------------------------------------------------------------------
  637.   def on_savefile_cancel
  638.     Sound.play_cancel
  639.     return_scene
  640.   end
  641.   #--------------------------------------------------------------------------
  642.   # ● セーブファイル[決定]
  643.   #--------------------------------------------------------------------------
  644.   def on_copy_ok
  645.     Graphics.freeze
  646.     source_name = DataManager.make_filename(@source_index)
  647.     new_name    = DataManager.make_filename(@index)
  648.     case @source_type
  649.     when "copy"
  650.       # 复制存档文件(API)
  651.       Win32API.new('kernel32',"CopyFileA",'ppl','').call(source_name,new_name,0)
  652.     when "move"
  653.       # 重命名存档
  654.       File.rename(source_name, new_name)
  655.     end
  656.     # 返回
  657.     @help_window.set_text(help_window_text)
  658.     @source_index = nil
  659.     do_return_savelist
  660.   end
  661.   #--------------------------------------------------------------------------
  662.   # ● セーブファイル[复制]
  663.   #--------------------------------------------------------------------------
  664.   def on_copy?
  665.     Graphics.freeze
  666.     @help_window.set_text(PS0::Window_SaveFile_Plus::HELP_COPY)
  667.     @source_index = @index
  668.     @source_type = "copy"
  669.     do_return_savelist
  670.   end
  671.   #--------------------------------------------------------------------------
  672.   # ● セーブファイル[移动]
  673.   #--------------------------------------------------------------------------
  674.   def on_move?
  675.     Graphics.freeze
  676.     @help_window.set_text(PS0::Window_SaveFile_Plus::HELP_MOVE)
  677.     @source_index = @index
  678.     @source_type = "move"
  679.     do_return_savelist
  680.   end
  681.   #--------------------------------------------------------------------------
  682.   # ● セーブファイル[管理]
  683.   #--------------------------------------------------------------------------
  684.   def on_manager?
  685.     if FileTest.exist?(DataManager.make_filename(@index))
  686.       Graphics.freeze
  687.       @command_window.deactivate
  688.       @window_manager.y = 72 + @index * 24
  689.       @window_manager.activate
  690.       @window_manager.visible = true
  691.       @window_manager.refresh
  692.       Sound.play_ok
  693.       Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  694.     else
  695.       Sound.play_buzzer
  696.     end
  697.   end
  698.   #--------------------------------------------------------------------------
  699.   # ● セーブファイル[删除]
  700.   #--------------------------------------------------------------------------
  701.   def on_delete?
  702.     Graphics.freeze
  703.     @window_manager.deactivate
  704.     @command_window.deactivate
  705.     @window_delete.y = 72 + 72 + @index * 24
  706.     @window_delete.activate
  707.     @window_delete.visible = true
  708.     @window_delete.refresh
  709.     Sound.play_ok
  710.     Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  711.   end
  712.   #--------------------------------------------------------------------------
  713.   # ● 删除
  714.   #--------------------------------------------------------------------------
  715.   def do_delete
  716.     Graphics.freeze
  717.     File.delete(DataManager.make_filename(@index))
  718.     @window_delete.index  = 0
  719.     @window_manager.index = 0
  720.     @window_delete.visible  = false
  721.     @window_manager.visible = false
  722.     @window_delete.deactivate
  723.     @window_manager.deactivate
  724.     @command_window.activate
  725.     @need_refresh = true
  726.     Sound.play_save
  727.     if DataManager.save_file_exists?
  728.       Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  729.     else
  730.       return_scene
  731.     end
  732.   end
  733.   #--------------------------------------------------------------------------
  734.   # ● 替换
  735.   #--------------------------------------------------------------------------
  736.   def do_replace
  737.     Graphics.freeze
  738.     if @source_index != nil
  739.       return on_copy_ok
  740.     else
  741.       return on_savefile_ok
  742.     end
  743.     @window_replace.visible = false
  744.     @window_replace.deactivate
  745.     @need_refresh = true
  746.   end
  747.   #--------------------------------------------------------------------------
  748.   # ● 取消
  749.   #--------------------------------------------------------------------------
  750.   def do_cancel
  751.     Graphics.freeze
  752.     Sound.play_cancel
  753.     @window_delete.index  = 0
  754.     @window_replace.index = 0
  755.     @window_manager.index = 0
  756.     @window_delete.visible  = false
  757.     @window_replace.visible = false
  758.     @window_manager.visible = false
  759.     @window_delete.deactivate
  760.     @window_replace.deactivate
  761.     @window_manager.deactivate
  762.     @command_window.activate
  763.     Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  764.   end
  765.   #--------------------------------------------------------------------------
  766.   # ● 返回管理菜单
  767.   #--------------------------------------------------------------------------
  768.   def do_return_manager
  769.     Graphics.freeze
  770.     @help_window.set_text(help_window_text)
  771.     @command_window.index = @source_index unless @source_index == nil
  772.     @source_index = nil
  773.     @source_type = nil
  774.     @command_window.deactivate
  775.     @window_delete.index  = 0
  776.     @window_replace.index = 0
  777.     @window_delete.visible  = false
  778.     @window_replace.visible = false
  779.     @window_delete.deactivate
  780.     @window_replace.deactivate
  781.     @window_manager.y = 72 + @index * 24
  782.     @window_manager.activate
  783.     @window_manager.visible = true
  784.     @window_manager.refresh
  785.     Sound.play_cancel
  786.     Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  787.   end
  788.   #--------------------------------------------------------------------------
  789.   # ● 返回文件列表(复制、移动 用)
  790.   #--------------------------------------------------------------------------
  791.   def do_return_savelist
  792.     @window_manager.visible = false
  793.     @window_manager.deactivate
  794.     @command_window.activate
  795.     @need_refresh = true
  796.     Sound.play_ok
  797.   end
  798. end
  799. #==============================================================================
  800. # [PS0] End of Script
  801. #==============================================================================
复制代码

评分

参与人数 1梦石 +1 收起 理由
VIPArcher + 1 我很赞同

查看全部评分

回复

使用道具 举报

梦石
0
星屑
17064
在线时间
6059 小时
注册时间
2011-7-18
回帖
153

开拓者

发表于 2015-7-12 11:52:34 | 显示全部楼层
已测试
[pre lang="ruby"]#想修改等级的坐标就修改后面的draw_party_lv(8 , Graphics.height-fitting_height(5) )
#想修改人物的位置就修改后面的draw_party_characters(32, Graphics.height-fitting_height(1)-32)


module DataManager
  
  def self.make_save_header
    d_rect = Rect.new(0, 0, PS0::Window_SaveFile_Plus::Thumbnail_Width,
                            PS0::Window_SaveFile_Plus::Thumbnail_Height)
    case PS0::Window_SaveFile_Plus::Zoom_Type
    when "NN"
      s_rect = $game_temp.save_bitmap.rect
      $game_temp.save_snapshoot = Bitmap.new(d_rect.width, d_rect.height)
      $game_temp.save_snapshoot.stretch_blt(d_rect, $game_temp.save_bitmap, s_rect)
    when "NZ"
      x = [$game_player.screen_x - d_rect.width/2, 0].max
      x = [x, Graphics.width - d_rect.width].min
      y = [$game_player.screen_y - d_rect.height/2, 0].max
      y = [y, Graphics.height - d_rect.height].min
      s_rect = Rect.new(x, y, d_rect.width, d_rect.height)
      $game_temp.save_snapshoot = Bitmap.new(d_rect.width, d_rect.height)
      $game_temp.save_snapshoot.blt(0, 0, $game_temp.save_bitmap, s_rect)
    end
    header = {}
    header[:members] = $game_party.members #######新增
    header[:characters] = $game_party.characters_for_savefile
    header[:playtime_s] = $game_system.playtime_s
    header[:snapshoot]  = $game_temp.save_snapshoot
    header
  end
  
end

class Window_SaveFile
  #alias members_refresh refresh
  def refresh
    #members_refresh
    contents.clear
    change_color(normal_color)
    w = (self.width-PS0::Window_SaveFile_Plus::Thumbnail_Width-16)/2
    h = (self.height-PS0::Window_SaveFile_Plus::Thumbnail_Height-16)/2
    width  = w + PS0::Window_SaveFile_Plus::Thumbnail_ox
    height = h + PS0::Window_SaveFile_Plus::Thumbnail_oy
    draw_shadow(width+5, height+5)
    draw_text((self.width-32-PS0::Window_SaveFile_Plus::NO_DATA.length*16)/2,
              self.height/2-32, PS0::Window_SaveFile_Plus::NO_DATA.length*32,
              line_height, PS0::Window_SaveFile_Plus::NO_DATA)
    draw_party_characters(32, Graphics.height-fitting_height(1)-32)
    draw_playtime(-10, contents.height - line_height-10, contents.width - 4, 2)
    draw_snapshoot(width, height)
    draw_party_lv(8 , Graphics.height-fitting_height(5) ) #######新增
  end

  def draw_party_lv(x, y) #######新增
    header = DataManager.load_header(@file_index)
    return unless header
    @times = 0
    header[:members].collect do |actor|
      draw_text((x + @times * 48), y, 56, line_height, "#{Vocab::level_a}#{actor.level}", 1)
      @times += 1
    end
    @times = 0
  end
  
end[/pre]

评分

参与人数 1梦石 +1 收起 理由
VIPArcher + 1 我很赞同

查看全部评分

这里岚风·雷,任饭、PM理性粉、UT/DR原作粉、(Trans)Furry自萌,半吊子技术一枚_(:з」∠)_    游戏制作交流工(liao)作(tian)室欢迎来玩!
【无偿/有偿】RGSS3(VA)脚本定制 + 合作招募/同好交友    修正Firefox/火狐浏览器的代码框复制问题(油猴脚本)
Click→←Click
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部