Project1

标题: 通关后存挡界面增加 [打印本页]

作者: 熊喵酱    时间: 2013-8-22 07:29
标题: 通关后存挡界面增加
我遊戲完成了的说...
所以現在我的想法是说通關後让完家存檔
然後存完後那个存檔上面就會加个文字或圖標或是更好  圖片..   來表示已經通關
然後以後那挡就不能讀取了...
或是讀取後會從最剛始 (不是二周目  我沒那時間了....)

就是加个"已通關"的標簽...

求教

謝謝了!
作者: chd114    时间: 2013-8-22 13:44
Scene_Load里面添加显示图片吧···
作者: 喵呜喵5    时间: 2013-8-22 14:55
本帖最后由 喵呜喵5 于 2013-8-22 23:56 编辑

  1. =begin
  2. ===============================================================================

  3.   通关存档 By喵呜喵5

  4. ===============================================================================

  5. 【说明】

  6. 在存档界面查看存档时,已经通关的存档会在名字后面显示一个特殊的图标

  7. =end

  8. module M5Save
  9. #==============================================================================
  10. #  设定部分
  11. #==============================================================================
  12.   

  13.   SWI = 1 #这里设置通关后打开的开关,通关以后请打开这个开关
  14.   
  15.   ICO = 125 #这里设置已经通关的存档在存档名之后显示的图标

  16.   
  17. #==============================================================================
  18. #  设定结束
  19. #==============================================================================
  20. #==============================================================================
  21. #  脚本部分
  22. #==============================================================================
  23.   
  24. end
  25. module DataManager  
  26.   def self.make_save_header
  27.     header = {}
  28.     header[:characters] = $game_party.characters_for_savefile
  29.     header[:playtime_s] = $game_system.playtime_s
  30.     header[:clear] = $game_switches[M5Save::SWI]
  31.     header
  32.   end  
  33. end
  34. class Window_SaveFile < Window_Base
  35.   def refresh
  36.     header = DataManager.load_header(@file_index)
  37.     contents.clear
  38.     change_color(normal_color)   
  39.     name = Vocab::File + " #{@file_index + 1}"
  40.     draw_text(4, 0, 200, line_height, name)
  41.     @name_width = text_size(name).width
  42.     if header != nil and header[:clear]
  43.       draw_icon(M5Save::ICO,8+@name_width,-1)
  44.     end
  45.     draw_party_characters(152, 58)
  46.     draw_playtime(0, contents.height - line_height, contents.width - 4, 2)
  47.   end
  48. end
复制代码

作者: 熊喵酱    时间: 2013-8-23 00:55
喵呜喵5 发表于 2013-8-21 23:55

謝謝了! 效果超好的 OWO 大大抱抱wwwww

不过要如何让檔案無法再進入呢?
作者: 喵呜喵5    时间: 2013-8-23 02:03
76213585 发表于 2013-8-23 00:55
謝謝了! 效果超好的 OWO 大大抱抱wwwww

不过要如何让檔案無法再進入呢?

为什么不做成再次访问档案时开始继承了通关存档的新游戏?IB就是这么干的……
作者: 喵呜喵5    时间: 2013-8-23 02:07
76213585 发表于 2013-8-23 00:55
謝謝了! 效果超好的 OWO 大大抱抱wwwww

不过要如何让檔案無法再進入呢?

另外让档案无法再进去很简单啊,通关后传送到一张新地图,地图上有个自动执行的事件:返回标题,接着存档,这样玩家读档后就会直接来到这张地图并触发自动事件了。不过无法读档……没什么意义就是了
作者: 熊喵酱    时间: 2013-8-23 02:15
喵呜喵5 发表于 2013-8-22 11:07
另外让档案无法再进去很简单啊,通关后传送到一张新地图,地图上有个自动执行的事件:返回标题,接着存档 ...

二周目.....
我去試試看好了
作者: 喵呜喵5    时间: 2013-8-23 15:50
@540486098

修改refresh中
  1. draw_icon(M5Save::ICO,8+@name_width,-1)
复制代码
这句即可

比如改成下面这样:
  1. change_color(crisis_color)#修改颜色
  2. draw_text(8+@name_width, 0, 200, line_height, "(已通关)")#描绘文字
  3. change_color(normal_color)#恢复默认颜色
复制代码

作者: 540486098    时间: 2013-8-23 16:06
喵呜喵5 发表于 2013-8-23 15:50
@540486098

修改refresh中这句即可

可以是可以了,但为什么用了你这个脚本,截图存档就无法使用了呢?有没有什么方法可以共存?

QQ图片20130823160222.jpg (113.33 KB, 下载次数: 45)

QQ图片20130823160222.jpg

作者: 喵呜喵5    时间: 2013-8-23 16:32
540486098 发表于 2013-8-23 16:06
可以是可以了,但为什么用了你这个脚本,截图存档就无法使用了呢?有没有什么方法可以共存? ...

你可以把这个脚本放到截图存档之上试试看

如果仍然不行的话,把截图存档给我,我改一改
作者: 540486098    时间: 2013-8-23 17:06
喵呜喵5 发表于 2013-8-23 16:32
你可以把这个脚本放到截图存档之上试试看

如果仍然不行的话,把截图存档给我,我改一改 ...

把通关通关存档放前面时,通关存档就被无视了.....   你发表过的
作者: 喵呜喵5    时间: 2013-8-23 17:46
540486098 发表于 2013-8-23 17:06
把通关通关存档放前面时,通关存档就被无视了.....   你发表过的


修改完成

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

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

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

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

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

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

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

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

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

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

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

  74.     # 各窗口切换时的渐变帧数
  75.     TRANS_DURATION = 5
  76.    
  77.     #在这里设置通关后打开的开关
  78.     M5_SAVE = 1
  79.    
  80.     #在这里设置通关的存档需要显示的文字
  81.     M5_CLEAR = "(已通关!)"
  82.    
  83.   end
  84. end
  85. #==============================================================================
  86. # [核心脚本] 快速储存Bitmap的Marshal By 柳之一
  87. #==============================================================================
  88. class Font
  89.   def marshal_dump
  90.   end
  91.   def marshal_load(obj)
  92.   end
  93. end
  94. class Bitmap
  95.   RtlMoveMemory_pi = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
  96.   RtlMoveMemory_ip = Win32API.new('kernel32', 'RtlMoveMemory', 'ipi', 'i')
  97.   def _dump(limit)
  98.     data = "rgba" * width * height
  99.     RtlMoveMemory_pi.call(data, address, data.length)
  100.     [width, height, Zlib::Deflate.deflate(data)].pack("LLa*")
  101.   end
  102.   def self._load(str)
  103.     w, h, zdata = str.unpack("LLa*")
  104.     b = self.new(w, h)
  105.     RtlMoveMemory_ip.call(b.address, Zlib::Inflate.inflate(zdata), w * h * 4)
  106.     return b
  107.   end
  108.   def address
  109.     buffer, ad = "rgba", object_id * 2 + 16
  110.     RtlMoveMemory_pi.call(buffer, ad, 4)
  111.     ad = buffer.unpack("L")[0] + 8
  112.     RtlMoveMemory_pi.call(buffer, ad, 4)
  113.     ad = buffer.unpack("L")[0] + 16
  114.     RtlMoveMemory_pi.call(buffer, ad, 4)
  115.     return buffer.unpack("L")[0]
  116.   end
  117. end
  118. #==============================================================================
  119. # ■ Game_Temp
  120. #==============================================================================
  121. class Game_Temp
  122.   attr_accessor :save_bitmap
  123.   attr_accessor :save_snapshoot
  124.   alias new_initialize initialize
  125.   def initialize
  126.     new_initialize
  127.     @save_bitmap = Bitmap.new(1, 1)
  128.     @save_snapshoot = Bitmap.new(1, 1)
  129.   end
  130. end
  131. #==============================================================================
  132. # ■ SceneManager
  133. #==============================================================================
  134. module SceneManager
  135.   def self.snapshot_for_save
  136.     $game_temp.save_bitmap = Graphics.snap_to_bitmap
  137.     unless FileTest.exist?(PS0::Window_SaveFile_Plus::SAVE_DIR)
  138.       Dir.mkdir(PS0::Window_SaveFile_Plus::SAVE_DIR)
  139.     end
  140.   end
  141. end
  142. #==============================================================================
  143. # ■ Scene_Map
  144. #==============================================================================
  145. class Scene_Map < Scene_Base
  146.   alias save_terminate terminate
  147.   def terminate
  148.     SceneManager.snapshot_for_save
  149.     save_terminate
  150.   end
  151. end
  152. #==============================================================================
  153. # ■ DataManager
  154. #==============================================================================
  155. module DataManager
  156.   def self.save_file_exists?
  157.     !Dir.glob(PS0::Window_SaveFile_Plus::SAVE_DIR + 'Save*.rvdata2').empty?
  158.   end
  159.   def self.make_filename(index)
  160.     sprintf(PS0::Window_SaveFile_Plus::SAVE_DIR + "Save%02d.rvdata2", index + 1)
  161.   end
  162.   #--------------------------------------------------------------------------
  163.   # ● セーブヘッダの作成
  164.   #--------------------------------------------------------------------------
  165.   def self.make_save_header
  166.     d_rect = Rect.new(0, 0, PS0::Window_SaveFile_Plus::Thumbnail_Width,
  167.                             PS0::Window_SaveFile_Plus::Thumbnail_Height)
  168.     case PS0::Window_SaveFile_Plus::Zoom_Type
  169.     when "NN"
  170.       s_rect = $game_temp.save_bitmap.rect
  171.       $game_temp.save_snapshoot = Bitmap.new(d_rect.width, d_rect.height)
  172.       $game_temp.save_snapshoot.stretch_blt(d_rect, $game_temp.save_bitmap, s_rect)
  173.     when "NZ"
  174.       x = [$game_player.screen_x - d_rect.width/2, 0].max
  175.       x = [x, Graphics.width - d_rect.width].min
  176.       y = [$game_player.screen_y - d_rect.height/2, 0].max
  177.       y = [y, Graphics.height - d_rect.height].min
  178.       s_rect = Rect.new(x, y, d_rect.width, d_rect.height)
  179.       $game_temp.save_snapshoot = Bitmap.new(d_rect.width, d_rect.height)
  180.       $game_temp.save_snapshoot.blt(0, 0, $game_temp.save_bitmap, s_rect)
  181.     end
  182.     header = {}
  183.     header[:characters] = $game_party.characters_for_savefile
  184.     header[:playtime_s] = $game_system.playtime_s
  185.     header[:snapshoot]  = $game_temp.save_snapshoot
  186.     header[:clear] = $game_switches[PS0::Window_SaveFile_Plus::M5_SAVE]
  187.     header
  188.   end
  189.   #--------------------------------------------------------------------------
  190.   # ● セーブの実行
  191.   #--------------------------------------------------------------------------
  192.   def self.save_game(index)
  193.     saving_window = Window_Saving.new
  194.     Graphics.update
  195.     begin
  196.       save_game_without_rescue(index)
  197.     rescue
  198.        delete_save_file(index)
  199.        false
  200.     end
  201.     saving_window.dispose
  202.     return true
  203.   end
  204. end
  205. #==============================================================================
  206. # ■ Window_Yes_Or_No
  207. #------------------------------------------------------------------------------
  208. #  提供“是”、“否”两个选项的窗口(替换、删除存档用)
  209. #==============================================================================
  210. class Window_Yes_Or_No < Window_HorzCommand
  211.   #--------------------------------------------------------------------------
  212.   # ● オブジェクト初期化
  213.   #--------------------------------------------------------------------------
  214.   def initialize(yes, no)
  215.     [url=home.php?mod=space&uid=40913]@yes[/url] = yes
  216.     @no = no
  217.     super(130, 0)
  218.     self.visible = false
  219.     self.active = false
  220.     [url=home.php?mod=space&uid=370741]@Index[/url] = 0
  221.   end
  222.   #--------------------------------------------------------------------------
  223.   # ● 桁数の取得
  224.   #--------------------------------------------------------------------------
  225.   def col_max
  226.     return 2
  227.   end
  228.   #--------------------------------------------------------------------------
  229.   # ● コマンドリストの作成
  230.   #--------------------------------------------------------------------------
  231.   def make_command_list
  232.     add_command(@yes,   :yes)
  233.     add_command(@no,    :cancel)
  234.   end
  235.   #--------------------------------------------------------------------------
  236.   # ● 決定ボタンが押されたときの処理
  237.   #--------------------------------------------------------------------------
  238.   def process_ok
  239.     Input.update
  240.     call_ok_handler
  241.   end
  242.   #--------------------------------------------------------------------------
  243.   # ● 按下取消键时的处理
  244.   #--------------------------------------------------------------------------
  245.   def process_cancel
  246.     Input.update
  247.     call_cancel_handler
  248.   end
  249.   #--------------------------------------------------------------------------
  250.   # ● 启用窗口
  251.   #--------------------------------------------------------------------------
  252.   def activate
  253.     temp = self.y + self.height - Graphics.height
  254.     if temp > 0
  255.       self.y -= (temp + 12)
  256.     end
  257.     self.active = true
  258.     self
  259.   end
  260. end
  261. #==============================================================================
  262. # ■ Window_Saving
  263. #------------------------------------------------------------------------------
  264. #  显示保存信息的窗口
  265. #==============================================================================
  266. class Window_Saving < Window_Base
  267.   #--------------------------------------------------------------------------
  268.   # ● オブジェクト初期化
  269.   #--------------------------------------------------------------------------
  270.   def initialize
  271.     w = PS0::Window_SaveFile_Plus::SAVE_NOW.length * 16 + 32
  272.     x = (Graphics.width - w)/2
  273.     y = (Graphics.height - fitting_height(1))/2
  274.     super(x, y, w, fitting_height(1))
  275.     self.visible = PS0::Window_SaveFile_Plus::SHOW_SAVE_NOW
  276.     draw_text_ex(4, 0, PS0::Window_SaveFile_Plus::SAVE_NOW)
  277.   end
  278. end
  279. #==============================================================================
  280. # ■ Window_SaveManagerCommand
  281. #------------------------------------------------------------------------------
  282. #  存档管理窗口
  283. #==============================================================================
  284. class Window_SaveManagerCommand < Window_Command
  285.   #--------------------------------------------------------------------------
  286.   # ● 初始化对象
  287.   #--------------------------------------------------------------------------
  288.   def initialize(*args)
  289.     @copy, @move, @delete, [url=home.php?mod=space&uid=9053]@cancel[/url] = args[0..3]
  290.     super(130, 0)
  291.     self.visible = false
  292.     self.active = false
  293.     @index = 0
  294.   end
  295.   #--------------------------------------------------------------------------
  296.   # ● 获取窗口的宽度
  297.   #--------------------------------------------------------------------------
  298.   def window_width
  299.     return 100
  300.   end
  301.   #--------------------------------------------------------------------------
  302.   # ● 获取项目数
  303.   #--------------------------------------------------------------------------
  304.   def item_max
  305.     return 4
  306.   end
  307.   #--------------------------------------------------------------------------
  308.   # ● 生成指令列表
  309.   #--------------------------------------------------------------------------
  310.   def make_command_list
  311.     add_command(@copy,   :copy  )
  312.     add_command(@move,   :move  )
  313.     add_command(@delete, :delete)
  314.     add_command(@cancel, :cancel)
  315.   end
  316.   #--------------------------------------------------------------------------
  317.   # ● 按下确定键时的处理
  318.   #--------------------------------------------------------------------------
  319.   def process_ok
  320.     Input.update
  321.     call_ok_handler
  322.   end
  323.   #--------------------------------------------------------------------------
  324.   # ● 启用窗口
  325.   #--------------------------------------------------------------------------
  326.   def activate
  327.     temp = self.y + self.height - Graphics.height
  328.     if temp > 0
  329.       self.y -= (temp + 12)
  330.     end
  331.     self.active = true
  332.     self
  333.   end
  334. end
  335. #==============================================================================
  336. # ■ Window_FileCommand
  337. #------------------------------------------------------------------------------
  338. #  截图存档左侧的选择窗口。
  339. #==============================================================================
  340. class Window_FileCommand < Window_Command
  341.   #--------------------------------------------------------------------------
  342.   # ● オブジェクト初期化
  343.   #--------------------------------------------------------------------------
  344.   def initialize
  345.     super(0, 0)
  346.   end
  347.   #--------------------------------------------------------------------------
  348.   # ● ウィンドウ幅の取得
  349.   #--------------------------------------------------------------------------
  350.   def window_height
  351.     return Graphics.height-fitting_height(1)
  352.   end
  353.   #--------------------------------------------------------------------------
  354.   # ● 表示行数の取得
  355.   #--------------------------------------------------------------------------
  356.   def visible_line_number
  357.     item_max
  358.   end
  359.   #--------------------------------------------------------------------------
  360.   # ● コマンドリストの作成
  361.   #--------------------------------------------------------------------------
  362.   def make_command_list
  363.     add_main_commands
  364.   end
  365.   #--------------------------------------------------------------------------
  366.   # ● 主要コマンドをリストに追加
  367.   #--------------------------------------------------------------------------
  368.   def add_main_commands
  369.     for i in 1..PS0::Window_SaveFile_Plus::MAX_SAVE
  370.       if i < 10
  371.         text = Vocab::File + " 0" + i.to_s
  372.       else
  373.         text = Vocab::File + " " + i.to_s
  374.       end
  375.       add_command(text, :file)
  376.     end
  377.   end
  378.   #--------------------------------------------------------------------------
  379.   # ● 決定ボタンが押されたときの処理
  380.   #--------------------------------------------------------------------------
  381.   def process_ok
  382.   end
  383. end
  384. #==============================================================================
  385. # ■ Window_SaveFile
  386. #------------------------------------------------------------------------------
  387. #  セーブ画面およびロード画面で表示する、セーブファイルのウィンドウです。
  388. #==============================================================================
  389. class Window_SaveFile < Window_Base
  390.   #--------------------------------------------------------------------------
  391.   # ● オブジェクト初期化
  392.   #     index : セーブファイルのインデックス
  393.   #--------------------------------------------------------------------------
  394.   def initialize(index)
  395.     super(160, 0, Graphics.width-160, Graphics.height-fitting_height(1))
  396.     @file_index = index
  397.     @selected = true
  398.     refresh
  399.   end
  400.   #--------------------------------------------------------------------------
  401.   # ● リフレッシュ
  402.   #--------------------------------------------------------------------------
  403.   def refresh
  404.     contents.clear
  405.     change_color(normal_color)
  406.     w = (self.width-PS0::Window_SaveFile_Plus::Thumbnail_Width-16)/2
  407.     h = (self.height-PS0::Window_SaveFile_Plus::Thumbnail_Height-16)/2
  408.     width  = w + PS0::Window_SaveFile_Plus::Thumbnail_ox
  409.     height = h + PS0::Window_SaveFile_Plus::Thumbnail_oy
  410.     draw_shadow(width+5, height+5)
  411.     draw_text((self.width-32-PS0::Window_SaveFile_Plus::NO_DATA.length*16)/2,
  412.               self.height/2-32, PS0::Window_SaveFile_Plus::NO_DATA.length*32,
  413.               line_height, PS0::Window_SaveFile_Plus::NO_DATA)
  414.     draw_party_characters(32, Graphics.height-fitting_height(1)-32)
  415.     draw_playtime(-10, contents.height - line_height-10, contents.width - 4, 2)
  416.     draw_snapshoot(width, height)
  417.     draw_clear_message   
  418.   end
  419.   
  420.   def draw_clear_message
  421.     header = DataManager.load_header(@file_index)
  422.     if header != nil and header[:clear]
  423.       change_color(crisis_color)
  424.       draw_text(0, contents.height - line_height-10, contents.width - 4,\
  425.       line_height ,PS0::Window_SaveFile_Plus::M5_CLEAR,1)
  426.       change_color(normal_color)
  427.     end
  428.   end
  429.   
  430.   #--------------------------------------------------------------------------
  431.   # ● パーティキャラの描画
  432.   #--------------------------------------------------------------------------
  433.   def draw_party_characters(x, y)
  434.     header = DataManager.load_header(@file_index)
  435.     return unless header
  436.     header[:characters].each_with_index do |data, i|
  437.       draw_character(data[0], data[1], x + i * 48, y)
  438.     end
  439.   end  
  440.   #--------------------------------------------------------------------------
  441.   # ● プレイ時間の描画
  442.   #--------------------------------------------------------------------------
  443.   def draw_playtime(x, y, width, align)
  444.     header = DataManager.load_header(@file_index)
  445.     return unless header
  446.     draw_text(x, y, width, line_height, header[:playtime_s], 2)
  447.   end
  448.   #--------------------------------------------------------------------------
  449.   # ● 绘制截图
  450.   #--------------------------------------------------------------------------
  451.   def draw_snapshoot(x, y)
  452.     header = DataManager.load_header(@file_index)
  453.     return unless header
  454.     bitmap = header[:snapshoot]
  455.     contents.blt(x, y, bitmap, bitmap.rect)
  456.     bitmap.dispose
  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. #==============================================================================
复制代码

作者: 540486098    时间: 2013-8-24 12:11
喵呜喵5 发表于 2013-8-23 17:46
修改完成

猫君和我一样懒啊,都不用别名而是直接霸道的修改掉………… ...

怎么办??

QQ图片20130824120538.jpg (18.12 KB, 下载次数: 27)

QQ图片20130824120538.jpg





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1