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

Project1

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

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

[复制链接]

Lv1.梦旅人

梦石
0
星屑
96
在线时间
81 小时
注册时间
2015-6-30
帖子
48
跳转到指定楼层
1
发表于 2015-7-5 00:44:18 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
RUBY 代码复制
  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.     # 最大存档数(范围正整数)
  42.     MAX_SAVE = 18
  43.  
  44.     # 存档目录(默认值 "Saves/";根目录 "")
  45.     SAVE_DIR = "Saves/"   
  46.  
  47.     # 无存档时显示的文字
  48.     NO_DATA  = "无存档"
  49.  
  50.     # 保存时显示的信息
  51.     SAVE_NOW = "存档中..."
  52.  
  53.     # 复制存档时的帮助文字
  54.     HELP_COPY = "要复制到哪个位置?"
  55.  
  56.     # 移动存档时的帮助文字
  57.     HELP_MOVE = "要移动到哪个位置?"
  58.  
  59.     # 是否显示存档中窗口(true:显示;false:不显示)
  60.     # - 分辨率较大时建议显示
  61.     SHOW_SAVE_NOW = false
  62.  
  63.     # 截图缩放使用的插值算法
  64.     # - "NN" 最邻近(速度最快,质量最差,RM默认算法)
  65.     # - "NZ" 不缩放(速度快,质量好,以主角为中心切边,非全屏)
  66.     Zoom_Type = "NN"
  67.  
  68.     # 双线性插值能获得更好的截图缩放质量,但所需时间较最邻近插值更长。
  69.     # 缩略图尺寸(范围整数,单位像素)
  70.     # - VA默认分辨率(544×416)推荐使用340×260
  71.     # - VA最大分辨率(640×480)推荐使用425×325
  72.     # - 本脚本兼容分辨率解放,窗口大小将自动计算。
  73.     #   请自行计算截图分辨率,注意要确保宽高比一致,
  74.     #   若使用“不缩放”模式则可以不保持一致。
  75.     Thumbnail_Width  = 380 # 宽度
  76.     Thumbnail_Height = 230  # 高度
  77.  
  78.     # 缩略图位置微调(范围整数,单位像素)
  79.     Thumbnail_ox = -2    # 横向
  80.     Thumbnail_oy = -2-44 # 纵向
  81.  
  82.     # 各窗口切换时的渐变帧数
  83.     TRANS_DURATION = 5
  84.  
  85.   end
  86. end
  87. #==============================================================================
  88. # [核心脚本] 快速储存Bitmap的Marshal By 柳之一
  89. #==============================================================================
  90. class Font
  91.   def marshal_dump
  92.   end
  93.   def marshal_load(obj)
  94.   end
  95. end
  96. class Bitmap
  97.   RtlMoveMemory_pi = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
  98.   RtlMoveMemory_ip = Win32API.new('kernel32', 'RtlMoveMemory', 'ipi', 'i')
  99.   def _dump(limit)
  100.     data = "rgba" * width * height
  101.     RtlMoveMemory_pi.call(data, address, data.length)
  102.     [width, height, Zlib::Deflate.deflate(data)].pack("LLa*")
  103.   end
  104.   def self._load(str)
  105.     w, h, zdata = str.unpack("LLa*")
  106.     b = self.new(w, h)
  107.     RtlMoveMemory_ip.call(b.address, Zlib::Inflate.inflate(zdata), w * h * 4)
  108.     return b
  109.   end
  110.   def address
  111.     buffer, ad = "rgba", object_id * 2 + 16
  112.     RtlMoveMemory_pi.call(buffer, ad, 4)
  113.     ad = buffer.unpack("L")[0] + 8
  114.     RtlMoveMemory_pi.call(buffer, ad, 4)
  115.     ad = buffer.unpack("L")[0] + 16
  116.     RtlMoveMemory_pi.call(buffer, ad, 4)
  117.     return buffer.unpack("L")[0]
  118.   end
  119. end
  120. #==============================================================================
  121. # ■ Game_Temp
  122. #==============================================================================
  123. class Game_Temp
  124.   attr_accessor :save_bitmap
  125.   attr_accessor :save_snapshoot
  126.   alias new_initialize initialize
  127.   def initialize
  128.     new_initialize
  129.     @save_bitmap = Bitmap.new(1, 1)
  130.     @save_snapshoot = Bitmap.new(1, 1)
  131.   end
  132. end
  133. #==============================================================================
  134. # ■ SceneManager
  135. #==============================================================================
  136. module SceneManager
  137.   def self.snapshot_for_save
  138.     $game_temp.save_bitmap = Graphics.snap_to_bitmap
  139.     unless FileTest.exist?(PS0::Window_SaveFile_Plus::SAVE_DIR)
  140.       Dir.mkdir(PS0::Window_SaveFile_Plus::SAVE_DIR)
  141.     end
  142.   end
  143. end
  144. #==============================================================================
  145. # ■ Scene_Map
  146. #==============================================================================
  147. class Scene_Map < Scene_Base
  148.   alias save_terminate terminate
  149.   def terminate
  150.     SceneManager.snapshot_for_save
  151.     save_terminate
  152.   end
  153. end
  154. #==============================================================================
  155. # ■ DataManager
  156. #==============================================================================
  157. module DataManager
  158.   def self.save_file_exists?
  159.     !Dir.glob(PS0::Window_SaveFile_Plus::SAVE_DIR + 'Save*.rvdata2').empty?
  160.   end
  161.   def self.make_filename(index)
  162.     sprintf(PS0::Window_SaveFile_Plus::SAVE_DIR + "Save%02d.rvdata2", index + 1)
  163.   end
  164.   #--------------------------------------------------------------------------
  165.   # ● セーブヘッダの作成
  166.   #--------------------------------------------------------------------------
  167.   def self.make_save_header
  168.     d_rect = Rect.new(0, 0, PS0::Window_SaveFile_Plus::Thumbnail_Width,
  169.                             PS0::Window_SaveFile_Plus::Thumbnail_Height)
  170.     case PS0::Window_SaveFile_Plus::Zoom_Type
  171.     when "NN"
  172.       s_rect = $game_temp.save_bitmap.rect
  173.       $game_temp.save_snapshoot = Bitmap.new(d_rect.width, d_rect.height)
  174.       $game_temp.save_snapshoot.stretch_blt(d_rect, $game_temp.save_bitmap, s_rect)
  175.     when "NZ"
  176.       x = [$game_player.screen_x - d_rect.width/2, 0].max
  177.       x = [x, Graphics.width - d_rect.width].min
  178.       y = [$game_player.screen_y - d_rect.height/2, 0].max
  179.       y = [y, Graphics.height - d_rect.height].min
  180.       s_rect = Rect.new(x, y, d_rect.width, d_rect.height)
  181.       $game_temp.save_snapshoot = Bitmap.new(d_rect.width, d_rect.height)
  182.       $game_temp.save_snapshoot.blt(0, 0, $game_temp.save_bitmap, s_rect)
  183.     end
  184.     header = {}
  185.     header[:characters] = $game_party.characters_for_savefile
  186.     header[:playtime_s] = $game_system.playtime_s
  187.     header[:snapshoot]  = $game_temp.save_snapshoot
  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.     change_color(normal_color)
  407.     w = (self.width-PS0::Window_SaveFile_Plus::Thumbnail_Width-16)/2
  408.     h = (self.height-PS0::Window_SaveFile_Plus::Thumbnail_Height-16)/2
  409.     width  = w + PS0::Window_SaveFile_Plus::Thumbnail_ox
  410.     height = h + PS0::Window_SaveFile_Plus::Thumbnail_oy
  411.     draw_shadow(width+5, height+5)
  412.     draw_text((self.width-32-PS0::Window_SaveFile_Plus::NO_DATA.length*16)/2,
  413.               self.height/2-32, PS0::Window_SaveFile_Plus::NO_DATA.length*32,
  414.               line_height, PS0::Window_SaveFile_Plus::NO_DATA)
  415.     draw_party_characters(32, Graphics.height-fitting_height(1)-32)
  416.     draw_playtime(-10, contents.height - line_height-10, contents.width - 4, 2)
  417.     draw_snapshoot(width, height)
  418.   end
  419.   #--------------------------------------------------------------------------
  420.   # ● パーティキャラの描画
  421.   #--------------------------------------------------------------------------
  422.   def draw_party_characters(x, y)
  423.     header = DataManager.load_header(@file_index)
  424.     return unless header
  425.     header[:characters].each_with_index do |data, i|
  426.       draw_character(data[0], data[1], x + i * 48, y)
  427.  
  428.     end
  429.   end
  430.  
  431.  
  432.   #--------------------------------------------------------------------------
  433.   # ● プレイ時間の描画
  434.   #--------------------------------------------------------------------------
  435.   def draw_playtime(x, y, width, align)
  436.     header = DataManager.load_header(@file_index)
  437.     return unless header
  438.     draw_text(x, y, width, line_height, header[:playtime_s], 2)
  439.   end
  440.   #--------------------------------------------------------------------------
  441.   # ● 绘制截图
  442.   #--------------------------------------------------------------------------
  443.   def draw_snapshoot(x, y)
  444.     header = DataManager.load_header(@file_index)
  445.     return unless header
  446.     bitmap = header[:snapshoot]
  447.     contents.blt(x, y, bitmap, bitmap.rect)
  448.     bitmap.dispose
  449.   end
  450.   #--------------------------------------------------------------------------
  451.   # ● 绘制阴影
  452.   #--------------------------------------------------------------------------
  453.   def draw_shadow(x, y)
  454.     header = DataManager.load_header(@file_index)
  455.     return unless header
  456.     contents.fill_rect(x, y, PS0::Window_SaveFile_Plus::Thumbnail_Width,
  457.                              PS0::Window_SaveFile_Plus::Thumbnail_Height, Color.new(0, 0, 0))
  458.     contents.blur
  459.   end
  460. end
  461. #==============================================================================
  462. # ■ Scene_File
  463. #------------------------------------------------------------------------------
  464. #  セーブ画面とロード画面の共通処理を行うクラスです。
  465. #==============================================================================
  466. class Scene_File < Scene_MenuBase
  467.   #--------------------------------------------------------------------------
  468.   # ● 開始処理
  469.   #--------------------------------------------------------------------------
  470.   def start
  471.     super
  472.     create_help_window
  473.     create_savefile_viewport
  474.     create_command_window
  475.     create_savefile_window
  476.     create_manager_window
  477.     create_replace_window
  478.     create_delete_window
  479.   end
  480.   #--------------------------------------------------------------------------
  481.   # ● 終了処理
  482.   #--------------------------------------------------------------------------
  483.   def terminate
  484.     super
  485.     @savefile_viewport.dispose
  486.     @savefile_window.dispose
  487.     @command_window.dispose
  488.     @window_manager.dispose
  489.     @window_replace.dispose
  490.     @window_delete.dispose
  491.   end
  492.   #--------------------------------------------------------------------------
  493.   # ● フレーム更新
  494.   #--------------------------------------------------------------------------
  495.   def update
  496.     super
  497.     update_savefile_selection
  498.   end
  499.   #--------------------------------------------------------------------------
  500.   # ● 创建替换窗口
  501.   #--------------------------------------------------------------------------
  502.   def create_replace_window
  503.     @window_replace = Window_Yes_Or_No.new("替换", "取消")
  504.     @window_replace.set_handler(:yes,    method(:do_replace))
  505.     @window_replace.set_handler(:cancel, method(:do_cancel))
  506.   end
  507.   #--------------------------------------------------------------------------
  508.   # ● 创建删除窗口
  509.   #--------------------------------------------------------------------------
  510.   def create_delete_window
  511.     @window_delete  = Window_Yes_Or_No.new("删除", "取消")
  512.     @window_delete.set_handler(:yes,    method(:do_delete))
  513.     @window_delete.set_handler(:cancel, method(:do_return_manager))
  514.     @window_delete.x += 40
  515.   end
  516.   #--------------------------------------------------------------------------
  517.   # ● 创建管理窗口
  518.   #--------------------------------------------------------------------------
  519.   def create_manager_window
  520.     @window_manager = Window_SaveManagerCommand.new("复制", "移动", "删除", "取消")
  521.     @window_manager.set_handler(:copy  , method(:on_copy?))
  522.     @window_manager.set_handler(:move  , method(:on_move?))
  523.     @window_manager.set_handler(:delete, method(:on_delete?))
  524.     @window_manager.set_handler(:cancel, method(:do_cancel))
  525.   end
  526.   #--------------------------------------------------------------------------
  527.   # ● ヘルプウィンドウの作成
  528.   #--------------------------------------------------------------------------
  529.   def create_help_window
  530.     @help_window = Window_Help.new(1)
  531.     @help_window.set_text(help_window_text)
  532.   end
  533.   #--------------------------------------------------------------------------
  534.   # ● ヘルプウィンドウのテキストを取得
  535.   #--------------------------------------------------------------------------
  536.   def help_window_text
  537.     return ""
  538.   end
  539.   #--------------------------------------------------------------------------
  540.   # ● セーブファイルビューポートの作成
  541.   #--------------------------------------------------------------------------
  542.   def create_savefile_viewport
  543.     @savefile_viewport = Viewport.new
  544.     @savefile_viewport.rect.y = @help_window.height
  545.     @savefile_viewport.rect.height -= @help_window.height
  546.   end
  547.   #--------------------------------------------------------------------------
  548.   # ● セーブファイルウィンドウの作成
  549.   #--------------------------------------------------------------------------
  550.   def create_savefile_window
  551.     @savefile_window = Window_SaveFile.new(@index)
  552.     @savefile_window.viewport = @savefile_viewport
  553.   end
  554.   #--------------------------------------------------------------------------
  555.   # ● 生成存档列表窗口
  556.   #--------------------------------------------------------------------------
  557.   def create_command_window
  558.     @command_window = Window_FileCommand.new
  559.     @command_window.index = first_savefile_index
  560.     @index = @command_window.index
  561.     @command_window.viewport = @savefile_viewport
  562.     @command_window.set_handler(:file,      method(:on_savefile_ok))
  563.   end
  564.   #--------------------------------------------------------------------------
  565.   # ● セーブファイル選択の更新
  566.   #--------------------------------------------------------------------------
  567.   def update_savefile_selection
  568.     if @source_index != nil
  569.       if Input.trigger?(:C)
  570.         if @index == @source_index
  571.           Sound.play_buzzer
  572.         elsif FileTest.exist?(DataManager.make_filename(@index))
  573.           Graphics.freeze
  574.           @command_window.deactivate
  575.           @window_replace.y = 72 + @index * 24
  576.           @window_replace.activate
  577.           @window_replace.visible = true
  578.           @window_replace.refresh
  579.           Sound.play_ok
  580.           Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  581.         else
  582.           return on_copy_ok
  583.         end
  584.       elsif Input.trigger?(:B)
  585.         return do_return_manager
  586.       end
  587.     else
  588.       if Input.trigger?(:C)
  589.         if self.is_a?(Scene_Save) and FileTest.exist?(DataManager.make_filename(@index))
  590.           Graphics.freeze
  591.           @command_window.deactivate
  592.           @window_replace.y = 72 + @index * 24
  593.           @window_replace.activate
  594.           @window_replace.visible = true
  595.           @window_replace.refresh
  596.           Sound.play_ok
  597.           Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  598.         else
  599.           return on_savefile_ok
  600.         end
  601.       elsif Input.trigger?(:B)
  602.         return on_savefile_cancel
  603.       elsif Input.trigger?(:F5)
  604.         unless @window_manager.active == true or
  605.                @window_delete.active == true or
  606.                @window_replace.active == true
  607.           return on_manager?
  608.         end
  609.       end
  610.     end
  611.     @need_refresh = true if @index != @command_window.index
  612.     if @need_refresh
  613.       Graphics.freeze
  614.       @index = @command_window.index
  615.       @savefile_window.dispose
  616.       create_savefile_window
  617.       @need_refresh = false
  618.       Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  619.     end
  620.   end
  621.   #--------------------------------------------------------------------------
  622.   # ● セーブファイル[決定]
  623.   #--------------------------------------------------------------------------
  624.   def on_savefile_ok
  625.   end
  626.   #--------------------------------------------------------------------------
  627.   # ● セーブファイル[キャンセル]
  628.   #--------------------------------------------------------------------------
  629.   def on_savefile_cancel
  630.     Sound.play_cancel
  631.     return_scene
  632.   end
  633.   #--------------------------------------------------------------------------
  634.   # ● セーブファイル[決定]
  635.   #--------------------------------------------------------------------------
  636.   def on_copy_ok
  637.     Graphics.freeze
  638.     source_name = DataManager.make_filename(@source_index)
  639.     new_name    = DataManager.make_filename(@index)
  640.     case @source_type
  641.     when "copy"
  642.       # 复制存档文件(API)
  643.       Win32API.new('kernel32',"CopyFileA",'ppl','').call(source_name,new_name,0)
  644.     when "move"
  645.       # 重命名存档
  646.       File.rename(source_name, new_name)
  647.     end
  648.     # 返回
  649.     @help_window.set_text(help_window_text)
  650.     @source_index = nil
  651.     do_return_savelist
  652.   end
  653.   #--------------------------------------------------------------------------
  654.   # ● セーブファイル[复制]
  655.   #--------------------------------------------------------------------------
  656.   def on_copy?
  657.     Graphics.freeze
  658.     @help_window.set_text(PS0::Window_SaveFile_Plus::HELP_COPY)
  659.     @source_index = @index
  660.     @source_type = "copy"
  661.     do_return_savelist
  662.   end
  663.   #--------------------------------------------------------------------------
  664.   # ● セーブファイル[移动]
  665.   #--------------------------------------------------------------------------
  666.   def on_move?
  667.     Graphics.freeze
  668.     @help_window.set_text(PS0::Window_SaveFile_Plus::HELP_MOVE)
  669.     @source_index = @index
  670.     @source_type = "move"
  671.     do_return_savelist
  672.   end
  673.   #--------------------------------------------------------------------------
  674.   # ● セーブファイル[管理]
  675.   #--------------------------------------------------------------------------
  676.   def on_manager?
  677.     if FileTest.exist?(DataManager.make_filename(@index))
  678.       Graphics.freeze
  679.       @command_window.deactivate
  680.       @window_manager.y = 72 + @index * 24
  681.       @window_manager.activate
  682.       @window_manager.visible = true
  683.       @window_manager.refresh
  684.       Sound.play_ok
  685.       Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  686.     else
  687.       Sound.play_buzzer
  688.     end
  689.   end
  690.   #--------------------------------------------------------------------------
  691.   # ● セーブファイル[删除]
  692.   #--------------------------------------------------------------------------
  693.   def on_delete?
  694.     Graphics.freeze
  695.     @window_manager.deactivate
  696.     @command_window.deactivate
  697.     @window_delete.y = 72 + 72 + @index * 24
  698.     @window_delete.activate
  699.     @window_delete.visible = true
  700.     @window_delete.refresh
  701.     Sound.play_ok
  702.     Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  703.   end
  704.   #--------------------------------------------------------------------------
  705.   # ● 删除
  706.   #--------------------------------------------------------------------------
  707.   def do_delete
  708.     Graphics.freeze
  709.     File.delete(DataManager.make_filename(@index))
  710.     @window_delete.index  = 0
  711.     @window_manager.index = 0
  712.     @window_delete.visible  = false
  713.     @window_manager.visible = false
  714.     @window_delete.deactivate
  715.     @window_manager.deactivate
  716.     @command_window.activate
  717.     @need_refresh = true
  718.     Sound.play_save
  719.     if DataManager.save_file_exists?
  720.       Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  721.     else
  722.       return_scene
  723.     end
  724.   end
  725.   #--------------------------------------------------------------------------
  726.   # ● 替换
  727.   #--------------------------------------------------------------------------
  728.   def do_replace
  729.     Graphics.freeze
  730.     if @source_index != nil
  731.       return on_copy_ok
  732.     else
  733.       return on_savefile_ok
  734.     end
  735.     @window_replace.visible = false
  736.     @window_replace.deactivate
  737.     @need_refresh = true
  738.   end
  739.   #--------------------------------------------------------------------------
  740.   # ● 取消
  741.   #--------------------------------------------------------------------------
  742.   def do_cancel
  743.     Graphics.freeze
  744.     Sound.play_cancel
  745.     @window_delete.index  = 0
  746.     @window_replace.index = 0
  747.     @window_manager.index = 0
  748.     @window_delete.visible  = false
  749.     @window_replace.visible = false
  750.     @window_manager.visible = false
  751.     @window_delete.deactivate
  752.     @window_replace.deactivate
  753.     @window_manager.deactivate
  754.     @command_window.activate
  755.     Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  756.   end
  757.   #--------------------------------------------------------------------------
  758.   # ● 返回管理菜单
  759.   #--------------------------------------------------------------------------
  760.   def do_return_manager
  761.     Graphics.freeze
  762.     @help_window.set_text(help_window_text)
  763.     @command_window.index = @source_index unless @source_index == nil
  764.     @source_index = nil
  765.     @source_type = nil
  766.     @command_window.deactivate
  767.     @window_delete.index  = 0
  768.     @window_replace.index = 0
  769.     @window_delete.visible  = false
  770.     @window_replace.visible = false
  771.     @window_delete.deactivate
  772.     @window_replace.deactivate
  773.     @window_manager.y = 72 + @index * 24
  774.     @window_manager.activate
  775.     @window_manager.visible = true
  776.     @window_manager.refresh
  777.     Sound.play_cancel
  778.     Graphics.transition(PS0::Window_SaveFile_Plus::TRANS_DURATION)
  779.   end
  780.   #--------------------------------------------------------------------------
  781.   # ● 返回文件列表(复制、移动 用)
  782.   #--------------------------------------------------------------------------
  783.   def do_return_savelist
  784.     @window_manager.visible = false
  785.     @window_manager.deactivate
  786.     @command_window.activate
  787.     @need_refresh = true
  788.     Sound.play_ok
  789.   end
  790. end
  791. #==============================================================================
  792. # [PS0] End of Script
  793. #==============================================================================

Lv2.观梦者

梦石
0
星屑
702
在线时间
326 小时
注册时间
2013-5-31
帖子
74
2
发表于 2015-7-12 10:37:51 | 只看该作者
有实际样图不?草图涂鸦也行。

点评

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

使用道具 举报

Lv2.观梦者

梦石
0
星屑
702
在线时间
326 小时
注册时间
2013-5-31
帖子
74
3
发表于 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 我很赞同

查看全部评分

回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
14193
在线时间
5772 小时
注册时间
2011-7-18
帖子
158

开拓者

4
发表于 2015-7-12 11:52:34 | 只看该作者
已测试
RUBY 代码复制
  1. #想修改等级的坐标就修改后面的draw_party_lv(8 , Graphics.height-fitting_height(5) )
  2. #想修改人物的位置就修改后面的draw_party_characters(32, Graphics.height-fitting_height(1)-32)
  3.  
  4.  
  5. module DataManager
  6.  
  7.   def self.make_save_header
  8.     d_rect = Rect.new(0, 0, PS0::Window_SaveFile_Plus::Thumbnail_Width,
  9.                             PS0::Window_SaveFile_Plus::Thumbnail_Height)
  10.     case PS0::Window_SaveFile_Plus::Zoom_Type
  11.     when "NN"
  12.       s_rect = $game_temp.save_bitmap.rect
  13.       $game_temp.save_snapshoot = Bitmap.new(d_rect.width, d_rect.height)
  14.       $game_temp.save_snapshoot.stretch_blt(d_rect, $game_temp.save_bitmap, s_rect)
  15.     when "NZ"
  16.       x = [$game_player.screen_x - d_rect.width/2, 0].max
  17.       x = [x, Graphics.width - d_rect.width].min
  18.       y = [$game_player.screen_y - d_rect.height/2, 0].max
  19.       y = [y, Graphics.height - d_rect.height].min
  20.       s_rect = Rect.new(x, y, d_rect.width, d_rect.height)
  21.       $game_temp.save_snapshoot = Bitmap.new(d_rect.width, d_rect.height)
  22.       $game_temp.save_snapshoot.blt(0, 0, $game_temp.save_bitmap, s_rect)
  23.     end
  24.     header = {}
  25.     header[:members] = $game_party.members #######新增
  26.     header[:characters] = $game_party.characters_for_savefile
  27.     header[:playtime_s] = $game_system.playtime_s
  28.     header[:snapshoot]  = $game_temp.save_snapshoot
  29.     header
  30.   end
  31.  
  32. end
  33.  
  34. class Window_SaveFile
  35.   #alias members_refresh refresh
  36.   def refresh
  37.     #members_refresh
  38.     contents.clear
  39.     change_color(normal_color)
  40.     w = (self.width-PS0::Window_SaveFile_Plus::Thumbnail_Width-16)/2
  41.     h = (self.height-PS0::Window_SaveFile_Plus::Thumbnail_Height-16)/2
  42.     width  = w + PS0::Window_SaveFile_Plus::Thumbnail_ox
  43.     height = h + PS0::Window_SaveFile_Plus::Thumbnail_oy
  44.     draw_shadow(width+5, height+5)
  45.     draw_text((self.width-32-PS0::Window_SaveFile_Plus::NO_DATA.length*16)/2,
  46.               self.height/2-32, PS0::Window_SaveFile_Plus::NO_DATA.length*32,
  47.               line_height, PS0::Window_SaveFile_Plus::NO_DATA)
  48.     draw_party_characters(32, Graphics.height-fitting_height(1)-32)
  49.     draw_playtime(-10, contents.height - line_height-10, contents.width - 4, 2)
  50.     draw_snapshoot(width, height)
  51.     draw_party_lv(8 , Graphics.height-fitting_height(5) ) #######新增
  52.   end
  53.  
  54.   def draw_party_lv(x, y) #######新增
  55.     header = DataManager.load_header(@file_index)
  56.     return unless header
  57.     @times = 0
  58.     header[:members].collect do |actor|
  59.       draw_text((x + @times * 48), y, 56, line_height, "#{Vocab::level_a}#{actor.level}", 1)
  60.       @times += 1
  61.     end
  62.     @times = 0
  63.   end
  64.  
  65. end

评分

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

查看全部评分

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

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-2-18 13:12

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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