查看: 8841|回复: 8

[已经解决] 怎么样让葱式菜单的存档脚本失效,换成其他的。

[复制链接]
梦石
0
星屑
65
在线时间
3 小时
注册时间
2020-7-20
回帖
5
发表于 2021-2-15 17:53:01 | 显示全部楼层 |阅读模式
悬赏15星屑未解决
就是说想要让葱式菜单自带的截图存档失效,换成下面这个截图存档,看一下图片,就是不要图片上这种存档模式,而是像这个截图脚本所述的那种。

  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 = 20

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

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

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

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

捕获.PNG
...........
梦石
0
星屑
30103
在线时间
5741 小时
注册时间
2016-3-8
回帖
1662
发表于 2021-2-15 18:18:25 | 显示全部楼层
把·CONG'S EASY MENU由第1089行class Scene_File < Scene_MenuBase开始,
至到1374行module DataManager的end作结尾, 全部注释掉就对了
回复

使用道具 举报

梦石
0
星屑
11806
在线时间
623 小时
注册时间
2016-8-25
回帖
1339

R考场第七期纪念奖

发表于 2021-2-16 07:14:33 | 显示全部楼层
禁用存档,然后事件写一个?
回复

使用道具 举报

梦石
0
星屑
65
在线时间
3 小时
注册时间
2020-7-20
回帖
5
 楼主| 发表于 2021-4-4 22:24:32 | 显示全部楼层
好像不行,我的好像是改过的葱式菜单。
...........
回复

使用道具 举报

梦石
0
星屑
65
在线时间
3 小时
注册时间
2020-7-20
回帖
5
 楼主| 发表于 2021-4-4 22:25:43 | 显示全部楼层
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ◇ CONG'S EASY MENU ◇ 葱式解谜用简易菜单
  4. #------------------------------------------------------------------------------
  5. # By Conwsbn
  6. # http://congrm.lofter.com/
  7. #==============================================================================

  8. $imported = {} if $imported.nil?
  9. $imported[:congs_easy_menu] = true

  10. #==============================================================================
  11. # ■ Window_Base
  12. #==============================================================================
  13. class Window_Base < Window
  14.   #--------------------------------------------------------------------------
  15.   # ● 获取统一字体设置
  16.   #--------------------------------------------------------------------------
  17.   def easy_menu_font
  18.     contents.font.name = EASY_MENU_SET::Font_name
  19.     contents.font.size = EASY_MENU_SET::Font_size
  20.     contents.font.outline = EASY_MENU_SET::Font_outline
  21.     contents.font.shadow = EASY_MENU_SET::Font_shadow
  22.     contents.font.bold = EASY_MENU_SET::Font_bold
  23.     contents.font.italic = EASY_MENU_SET::Font_italic
  24.   end
  25. end

  26. #==============================================================================
  27. # ■ Window_Help
  28. #==============================================================================
  29. class Window_Help < Window_Base
  30.   #--------------------------------------------------------------------------
  31.   # ● 初始化对象
  32.   #--------------------------------------------------------------------------
  33.   def initialize(line_number = 2, width = Graphics.width)
  34.     super(0, 0, width, fitting_height(line_number))
  35.     self.windowskin = Cache.system(EASY_MENU_SET::SKIN)
  36.     self.opacity = EASY_MENU_SET::HELP_opacity
  37.   end
  38.   #--------------------------------------------------------------------------
  39.   # ● 设置内容
  40.   #--------------------------------------------------------------------------
  41.   def set_text(text)
  42.     text.gsub!(/\\n/i) { "\n" }
  43.     if text != @text
  44.       @text = text
  45.       refresh
  46.     end
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # ● 清除
  50.   #--------------------------------------------------------------------------
  51.   def clear
  52.     set_text("")
  53.   end
  54.   #--------------------------------------------------------------------------
  55.   # ● 设置物品
  56.   #     item : 技能、物品等
  57.   #--------------------------------------------------------------------------
  58.   def set_item(item)
  59.     set_text(item ? item.description : "")
  60.   end
  61.   #--------------------------------------------------------------------------
  62.   # ● 绘制带有控制符的文本内容
  63.   #--------------------------------------------------------------------------
  64.   def draw_text_ex(x, y, text)
  65.     reset_item_font_settings
  66.     text = convert_escape_characters(text)
  67.     pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
  68.     process_character(text.slice!(0, 1), text, pos) until text.empty?
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # ● 物品帮助字体设置
  72.   #--------------------------------------------------------------------------
  73.   def reset_item_font_settings
  74.     return if @text_line
  75.     contents.font.name = EASY_MENU_SET::HELP_name
  76.     contents.font.size = EASY_MENU_SET::HELP_size
  77.     contents.font.outline = EASY_MENU_SET::HELP_outline
  78.     contents.font.shadow = EASY_MENU_SET::HELP_shadow
  79.     contents.font.bold = EASY_MENU_SET::HELP_bold
  80.     contents.font.italic = EASY_MENU_SET::HELP_italic
  81.     v = EASY_MENU_SET::HELP_color
  82.     change_color(Color.new(v[0], v[1], v[2]))
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   # ● 获取文字颜色
  86.   #--------------------------------------------------------------------------
  87.   def text_color(n)
  88.     v = EASY_MENU_SET::HELP_color
  89.     return Color.new(v[0], v[1], v[2]) if n == 0
  90.     return windowskin.get_pixel(64 + (n % 8) * 8, 96 + (n / 8) * 8)
  91.   end
  92.   #--------------------------------------------------------------------------
  93.   # ● 处理普通文字
  94.   #--------------------------------------------------------------------------
  95.   def process_normal_character(c, pos)
  96.     if (pos[:x] + contents.text_size(c).width) > contents.width
  97.       @text_line = true
  98.       process_new_line(c, pos)
  99.       @text_line = false
  100.       pos[:height] = calc_line_height(c)
  101.     end
  102.     text_width = text_size(c).width
  103.     draw_text(pos[:x], pos[:y], text_width * 2, pos[:height], c)
  104.     pos[:x] += text_width
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ● 刷新
  108.   #--------------------------------------------------------------------------
  109.   def refresh
  110.     contents.clear
  111.     draw_text_ex(4, 0, @text)
  112.   end
  113. end

  114. #==============================================================================
  115. # ■ Window_MenuCommand
  116. #==============================================================================
  117. class Window_MenuCommand < Window_Command
  118.   #--------------------------------------------------------------------------
  119.   # ● 初始化指令选择位置(类方法)
  120.   #--------------------------------------------------------------------------
  121.   def self.init_command_position(type = nil)
  122.     @@last_command_symbol = type
  123.   end
  124.   #--------------------------------------------------------------------------
  125.   # ● 初始化对象
  126.   #--------------------------------------------------------------------------
  127.   def initialize(sub = false)
  128.     @sub = sub
  129.     super(-24, EASY_MENU_SET::COMMAND[1])
  130.     self.opacity = 0
  131.     self.active = false
  132.     @show = false
  133.     @move_rx = @sub_ry = 0
  134.     @last_index = @index
  135.     update_placement unless @sub
  136.     select_last
  137.     refresh
  138.   end
  139.   #--------------------------------------------------------------------------
  140.   # ● 获取标准的边距尺寸
  141.   #--------------------------------------------------------------------------
  142.   def standard_padding
  143.     return 0
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● 显示动画前的设定
  147.   #--------------------------------------------------------------------------
  148.   def update_placement
  149.     self.x = -24 - window_width
  150.     self.contents_opacity = 0
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   # ● 获取窗口的宽度
  154.   #--------------------------------------------------------------------------
  155.   def window_width
  156.     return EASY_MENU_SET::COMMAND[2] + 24 + 24
  157.   end
  158.   #--------------------------------------------------------------------------
  159.   # ● 获取项目的宽度
  160.   #--------------------------------------------------------------------------
  161.   def item_width
  162.     width - 24
  163.   end
  164.   #--------------------------------------------------------------------------
  165.   # ● 获取间隔距离
  166.   #--------------------------------------------------------------------------
  167.   def line_spacing
  168.     return EASY_MENU_SET::COMMAND[4]
  169.   end
  170.   #--------------------------------------------------------------------------
  171.   # ● 获取行高
  172.   #--------------------------------------------------------------------------
  173.   def line_height
  174.     return EASY_MENU_SET::COMMAND[3] + line_spacing
  175.   end
  176.   #--------------------------------------------------------------------------
  177.   # ● 获取指令名称
  178.   #--------------------------------------------------------------------------
  179.   def set_command_name(v)
  180.     @name = []
  181.     for i in 0...EASY_MENU_SET::BUTTON.size
  182.       name = Vocab::item     if v[i][4] == :item
  183.       name = Vocab::key_item if v[i][4] == :key_item
  184.       name = Vocab::save     if v[i][4] == :save
  185.       name = Vocab::continue if v[i][4] == :continue
  186.       name = Vocab::game_end if v[i][4] == :game_end
  187.       @name[i] = v[i][1] ? v[i][1] : name
  188.     end
  189.   end
  190.   #--------------------------------------------------------------------------
  191.   # ● 获取显示状态
  192.   #--------------------------------------------------------------------------
  193.   def set_command_enabled(v)
  194.     @enabled = []
  195.     for i in 0...EASY_MENU_SET::BUTTON.size
  196.       enabled = main_commands_enabled         if v[i][4] == :item
  197.       enabled = main_commands_enabled         if v[i][4] == :key_item
  198.       enabled = save_enabled                  if v[i][4] == :save
  199.       enabled = DataManager.save_file_exists? if v[i][4] == :continue
  200.       enabled = true                          if v[i][4] == :game_end
  201.       @enabled[i] = enabled
  202.     end
  203.   end
  204.   #--------------------------------------------------------------------------
  205.   # ● 获取指令图标
  206.   #--------------------------------------------------------------------------
  207.   def set_command_icon(v)
  208.     @icon = []
  209.     for i in 0...EASY_MENU_SET::BUTTON.size
  210.       @icon[i] = v[i][2] if v[i][2]
  211.     end
  212.   end
  213.   #--------------------------------------------------------------------------
  214.   # ● 获取选项的图标
  215.   #--------------------------------------------------------------------------
  216.   def command_icon(index)
  217.     @list[index][:ext]
  218.   end
  219.   #--------------------------------------------------------------------------
  220.   # ● 生成指令列表
  221.   #--------------------------------------------------------------------------
  222.   def make_command_list
  223.     v = EASY_MENU_SET::BUTTON
  224.     set_command_name(v)
  225.     set_command_icon(v)
  226.     set_command_enabled(v)
  227.     for i in 0...EASY_MENU_SET::BUTTON.size
  228.       add_command(@name[i], v[i][4], @enabled[i], @icon[i]) if v[i][0] or @sub
  229.     end
  230.   end
  231.   #--------------------------------------------------------------------------
  232.   # ● 刷新
  233.   #--------------------------------------------------------------------------
  234.   def refresh
  235.     #clear_command_list
  236.     #make_command_list
  237.     create_contents
  238.     contents.clear
  239.     draw_all_items
  240.   end
  241.   #--------------------------------------------------------------------------
  242.   # ● 绘制项目
  243.   #--------------------------------------------------------------------------
  244.   def draw_item(index)
  245.     return if @sub && @index != index
  246.     easy_menu_font
  247.     rect = item_rect_for_text(index)
  248.     t_size = text_size(command_name(index))
  249.     mx = @index == index ? @sub ? 0 : @move_rx : 0
  250.     my = @sub ? @sub_ry : 0
  251.     ix = item_width - t_size.width - 28 + mx
  252.     iy = (line_height - t_size.height) / 2 + my
  253.     draw_background(index, rect, mx, my)
  254.     rect.x -= 24
  255.     rect.y -= (line_spacing / 2)
  256.     enabled = command_enabled?(index)
  257.     change_color(item_color(index), enabled)
  258.     rt = [rect.x + mx, rect.y + my, rect.width, rect.height]
  259.     draw_text(rt[0], rt[1], rt[2], rt[3], command_name(index), 2)
  260.     draw_icon(command_icon(index), rect.x + ix, rect.y + iy, enabled)
  261.   end
  262.   #--------------------------------------------------------------------------
  263.   # ● 绘制底纹
  264.   #--------------------------------------------------------------------------
  265.   def draw_background(index, rect, x, y)
  266.     lh = line_height - line_spacing
  267.     bit = Cache.system(EASY_MENU_SET::COMMAND[0])
  268.     rx = bit.width - item_width
  269.     rect1 = Rect.new(rx, 0, item_width, 12)
  270.     rect2 = Rect.new(rx, 12, item_width, 12)
  271.     rect3 = Rect.new(rx, 36 - 12, item_width, 12)
  272.     d_rect = Rect.new(rect.x + x, rect.y + 12 + y, item_width, lh - 24)
  273.     self.contents.blt(rect.x + x, rect.y + y, bit, rect1)
  274.     self.contents.stretch_blt(d_rect, bit, rect2)
  275.     self.contents.blt(rect.x + x, rect.y + lh - 12 + y, bit, rect3)
  276.   end
  277.   #--------------------------------------------------------------------------
  278.   # ● 字体颜色扩展
  279.   #--------------------------------------------------------------------------
  280.   def item_color(index)
  281.     co = EASY_MENU_SET::BUTTON[index][3]
  282.     return Color.new(co[0], co[1], co[2]) if @index == index
  283.     return Color.new(co[0], co[1], co[2], 200)
  284.   end
  285.   #--------------------------------------------------------------------------
  286.   # ● 获取项目的绘制矩形
  287.   #--------------------------------------------------------------------------
  288.   def item_rect(index)
  289.     index = 0 if @sub
  290.     rect = Rect.new
  291.     rect.width = 4
  292.     rect.height = 24
  293.     rect.x = index % col_max * (item_width + spacing) + 32
  294.     rect.y = index / col_max * item_height + 4
  295.     rect
  296.   end
  297.   #--------------------------------------------------------------------------
  298.   # ● 获取项目的绘制矩形(内容用)
  299.   #--------------------------------------------------------------------------
  300.   def item_rect_for_text(index)
  301.     index = 0 if @sub
  302.     rect = Rect.new
  303.     rect.width = item_width
  304.     rect.height = item_height
  305.     rect.x = index % col_max * (item_width + spacing)
  306.     rect.y = index / col_max * item_height
  307.     rect
  308.   end
  309.   #--------------------------------------------------------------------------
  310.   # ● 展开动画的标志
  311.   #--------------------------------------------------------------------------
  312.   def show=(show)
  313.     if @show != show
  314.       @show = show
  315.     end
  316.   end
  317.   #--------------------------------------------------------------------------
  318.   # ● 获取动画的标志
  319.   #--------------------------------------------------------------------------
  320.   def show
  321.     return @show
  322.   end
  323.   #--------------------------------------------------------------------------
  324.   # ● 更新画面
  325.   #--------------------------------------------------------------------------
  326.   def update
  327.     super
  328.     if @last_index != @index && !@show
  329.       @move_rx = 0
  330.       @last_index = @index
  331.     end
  332.     update_button if Input.dir4 > 0 or @move_rx < 24
  333.   end
  334.   #--------------------------------------------------------------------------
  335.   # ● 按钮的改变动画
  336.   #--------------------------------------------------------------------------
  337.   def update_button
  338.     @move_rx += 4 if @move_rx < 24
  339.     refresh
  340.   end
  341.   #--------------------------------------------------------------------------
  342.   # ● 按钮的还原动画
  343.   #--------------------------------------------------------------------------
  344.   def hide_button
  345.     @move_rx -= 4 if @move_rx > 0
  346.     refresh
  347.   end
  348.   #--------------------------------------------------------------------------
  349.   # ● 展开动画
  350.   #--------------------------------------------------------------------------
  351.   def open_button_window
  352.     self.x += (window_width + 24) / EASY_MENU_SET::TIME
  353.     self.contents_opacity += 255 / EASY_MENU_SET::TIME
  354.     refresh
  355.     @show = false if self.x >= -24
  356.     self.x = -24 if !@show
  357.     self.contents_opacity = 255 if !@show
  358.   end
  359.   #--------------------------------------------------------------------------
  360.   # ● 关闭动画
  361.   #--------------------------------------------------------------------------
  362.   def close_button_window
  363.     @show = false if self.contents_opacity <= 0
  364.     if @move_rx > 0
  365.       hide_button
  366.     else
  367.       self.x -= (window_width + 24) / EASY_MENU_SET::TIME
  368.       self.contents_opacity -= 255 / EASY_MENU_SET::TIME
  369.       refresh
  370.     end
  371.   end
  372.   #--------------------------------------------------------------------------
  373.   # ● 进入子菜单的关闭动画
  374.   #--------------------------------------------------------------------------
  375.   def close_window_to_sub
  376.     if @move_rx > 0
  377.       hide_button
  378.       @sub_ry = @index / col_max * item_height
  379.     else
  380.       cursor_rect.empty
  381.       @show = false if @sub_ry <= 0
  382.       @sub_ry = 0 if !@show
  383.       @sub = true
  384.       @sub_ry = [(@sub_ry - ((EASY_MENU_SET::COMMAND[3] * index)) / 6), 0].max
  385.       refresh
  386.     end
  387.   end
  388. end

  389. #==============================================================================
  390. # ■ Scene_MenuBase
  391. #==============================================================================
  392. class Scene_MenuBase < Scene_Base
  393.   #--------------------------------------------------------------------------
  394.   # ● 结束处理
  395.   #--------------------------------------------------------------------------
  396.   alias easy_menu_terminate terminate
  397.   def terminate
  398.     easy_menu_terminate
  399.     dispose_rim
  400.     dispose_actor_cg
  401.     dispose_sub_button
  402.   end
  403.   #--------------------------------------------------------------------------
  404.   # ● 生成背景
  405.   #--------------------------------------------------------------------------
  406.   def create_background
  407.     wall = EASY_MENU_SET::WALLPAPER
  408.     co = EASY_MENU_SET::BACKGROUND
  409.     @background_sprite = Sprite.new
  410.     bitmap = wall ? Cache.system(wall) : SceneManager.background_bitmap
  411.     @background_sprite.bitmap = bitmap
  412.     @background_sprite.color.set(co[0], co[1], co[2], co[3]) unless wall
  413.   end
  414.   #--------------------------------------------------------------------------
  415.   # ● 绘制次背景图片
  416.   #--------------------------------------------------------------------------
  417.   def create_rim_background(bitmap, x, y)
  418.     @rim_sprite = Sprite.new
  419.     @rim_sprite.bitmap = Cache.system(bitmap) if bitmap
  420.     @rim_sprite.x = x; @rim_sprite.y = y
  421.     @rim_sprite.z = @background_sprite.z
  422.   end
  423.   #--------------------------------------------------------------------------
  424.   # ● 释放次背景图片
  425.   #--------------------------------------------------------------------------
  426.   def dispose_rim
  427.     return if !@rim_sprite
  428.     @rim_sprite.bitmap.dispose
  429.     @rim_sprite.dispose
  430.   end
  431.   #--------------------------------------------------------------------------
  432.   # ● 生成立绘精灵
  433.   #--------------------------------------------------------------------------
  434.   def create_actor_cg
  435.     v = EASY_MENU_SET::CG
  436.     return unless v[0]
  437.     @actor_cg = Sprite.new
  438.     @actor_cg.bitmap = Cache.system(v[0])
  439.     @actor_cg.x = v[1] + 2 * 7
  440.     @actor_cg.y = v[2]
  441.   end
  442.   #--------------------------------------------------------------------------
  443.   # ● 立绘的坐标判断
  444.   #--------------------------------------------------------------------------
  445.   def cg_x
  446.     v = EASY_MENU_SET::CG
  447.     return v[3] if v[4] == :l
  448.     return -(v[3]) if v[4] == :r
  449.     return 0
  450.   end
  451.   #--------------------------------------------------------------------------
  452.   # ● 释放立绘精灵
  453.   #--------------------------------------------------------------------------
  454.   def dispose_actor_cg
  455.     return if !@actor_cg
  456.     @actor_cg.bitmap.dispose
  457.     @actor_cg.dispose
  458.   end
  459.   #--------------------------------------------------------------------------
  460.   # ● 展开动画的预设坐标
  461.   #--------------------------------------------------------------------------
  462.   def set_menu_xy
  463.     v = EASY_MENU_SET::CG
  464.     xx = 0
  465.     xx = -(EASY_MENU_SET::TIME * v[3]) if v[4] == :l
  466.     xx = EASY_MENU_SET::TIME * v[3] if v[4] == :r
  467.     @actor_cg.x = v[1] + xx
  468.     @actor_cg.opacity = 0
  469.     @rim_sprite.opacity = 0 if @rim_sprite
  470.   end
  471.   #--------------------------------------------------------------------------
  472.   # ● 重绘内用小标题
  473.   #--------------------------------------------------------------------------
  474.   def create_sub_button
  475.     @sub_window = Window_MenuCommand.new(true)
  476.     @sub_window.z = 300
  477.   end
  478.   #--------------------------------------------------------------------------
  479.   # ● 释放内用小标题
  480.   #--------------------------------------------------------------------------
  481.   def dispose_sub_button
  482.     @sub_window.dispose if @sub_window
  483.   end
  484. end

  485. #==============================================================================
  486. # ■ Scene_Menu
  487. #==============================================================================
  488. class Scene_Menu < Scene_MenuBase
  489.   #--------------------------------------------------------------------------
  490.   # ● 开始处理
  491.   #--------------------------------------------------------------------------
  492.   def start
  493.     super
  494.     v = EASY_MENU_SET::MENU_RIM
  495.     create_rim_background(v[0], v[1], v[2]) if v[0]
  496.     create_actor_cg
  497.     create_command_window
  498.     set_menu_xy
  499.     @sub_show = false
  500.   end
  501.   #--------------------------------------------------------------------------
  502.   # ● 开始后处理
  503.   #--------------------------------------------------------------------------
  504.   def post_start
  505.     super
  506.     @command_window.show = true
  507.     begin
  508.       @actor_cg.x += cg_x
  509.       @actor_cg.opacity += (255 / EASY_MENU_SET::TIME)
  510.       @rim_sprite.opacity += (255 / EASY_MENU_SET::TIME) if @rim_sprite
  511.       @command_window.open_button_window
  512.       Graphics.update
  513.     end until @command_window.show == false
  514.     @command_window.activate
  515.     @actor_cg.opacity = 255
  516.   end
  517.   #--------------------------------------------------------------------------
  518.   # ● 结束前处理
  519.   #--------------------------------------------------------------------------
  520.   def pre_terminate
  521.     super
  522.     t = 0
  523.     @command_window.show = true
  524.     begin
  525.       if @sub_show
  526.         t += 1 if t <= 6
  527.         @actor_cg.x += 2 if t <= 6
  528.         @command_window.close_window_to_sub
  529.       else
  530.         @actor_cg.x += -(cg_x)
  531.         @actor_cg.opacity -= 255 / EASY_MENU_SET::TIME
  532.         @rim_sprite.opacity -= 255 / EASY_MENU_SET::TIME if @rim_sprite
  533.         @command_window.close_button_window
  534.       end
  535.       Graphics.update
  536.     end until @command_window.show == false
  537.   end
  538.   #--------------------------------------------------------------------------
  539.   # ● 生成指令窗口
  540.   #--------------------------------------------------------------------------
  541.   def create_command_window
  542.     v = EASY_MENU_SET::BUTTON
  543.     @command_window = Window_MenuCommand.new
  544.     for i in 0...EASY_MENU_SET::BUTTON.size
  545.       type = :command_item     if v[i][4] == :item
  546.       type = :command_key_item if v[i][4] == :key_item
  547.       type = :command_save     if v[i][4] == :save
  548.       type = :command_load     if v[i][4] == :continue
  549.       type = :command_game_end if v[i][4] == :game_end
  550.       @command_window.set_handler(v[i][4], method(type)) if v[i][0]
  551.     end
  552.     @command_window.set_handler(:cancel,    method(:return_scene))
  553.   end
  554.   #--------------------------------------------------------------------------
  555.   # ● 指令“物品”
  556.   #--------------------------------------------------------------------------
  557.   def command_item
  558.     @sub_show = true
  559.     SceneManager.call(Scene_Item)
  560.     SceneManager.scene.prepare(:item)
  561.   end
  562.   #--------------------------------------------------------------------------
  563.   # ● 指令“贵重物品”
  564.   #--------------------------------------------------------------------------
  565.   def command_key_item
  566.     @sub_show = true
  567.     SceneManager.call(Scene_Item)
  568.     SceneManager.scene.prepare(:key_item)
  569.   end
  570.   #--------------------------------------------------------------------------
  571.   # ● 指令“存档”
  572.   #--------------------------------------------------------------------------
  573.   def command_save
  574.     @sub_show = true
  575.     SceneManager.call(Scene_Save)
  576.   end
  577.   #--------------------------------------------------------------------------
  578.   # ● 指令“读档”
  579.   #--------------------------------------------------------------------------
  580.   def command_load
  581.     @sub_show = true
  582.     SceneManager.call(Scene_Load)
  583.   end
  584. end



  585. #==============================================================================
  586. # ■ SceneManager
  587. #==============================================================================
  588. module SceneManager
  589.   #--------------------------------------------------------------------------
  590.   # ● 模块的实例变量
  591.   #--------------------------------------------------------------------------
  592.   @save_bitmap = nil                # 存档用截图
  593.   #--------------------------------------------------------------------------
  594.   # ● 生成背景用的场景截图
  595.   #--------------------------------------------------------------------------
  596.   def self.snapshot_for_background(bitmap_blue = true)
  597.     @background_bitmap.dispose if @background_bitmap
  598.     @background_bitmap = Graphics.snap_to_bitmap
  599.     @background_bitmap.blur if bitmap_blue
  600.   end
  601.   #--------------------------------------------------------------------------
  602.   # ● 生成存档内的截图
  603.   #--------------------------------------------------------------------------
  604.   def self.snapshot_for_save_bitmap
  605.     v = EASY_MENU_SET::FILES_DETAILS_DATA
  606.     @save_bitmap.dispose if @save_bitmap
  607.     @save_bitmap = Bitmap.new(v[0][3], v[0][4])
  608.     rect = Rect.new(0, 0, v[0][3], v[0][4])
  609.     rect.x = $game_player.screen_x - rect.width / 2
  610.     rect.y = $game_player.screen_y - rect.height / 2 - 12
  611.     bitmap = Graphics.snap_to_bitmap
  612.     @save_bitmap.blt(0, 0, bitmap, rect)
  613.     bitmap.dispose
  614.   end
  615.   #--------------------------------------------------------------------------
  616.   # ● 获取存档内的截图
  617.   #--------------------------------------------------------------------------
  618.   def self.saves_bitmap
  619.     @save_bitmap
  620.   end
  621. end

  622. #==============================================================================
  623. # ■ Scene_Map
  624. #==============================================================================
  625. class Scene_Map < Scene_Base
  626.   #--------------------------------------------------------------------------
  627.   # ● 结束处理
  628.   #--------------------------------------------------------------------------
  629.   def terminate
  630.     super
  631.     type = EASY_MENU_SET::BACKGROUND[4]
  632.     type = true if SceneManager.scene_is?(Scene_Battle)
  633.     SceneManager.snapshot_for_background(type)
  634.     SceneManager.snapshot_for_save_bitmap
  635.     dispose_spriteset
  636.     perform_battle_transition if SceneManager.scene_is?(Scene_Battle)
  637.   end
  638. end


  639. #==============================================================================
  640. # ★ 物品界面
  641. #==============================================================================
  642. #==============================================================================
  643. # ■ Window_ItemList
  644. #==============================================================================
  645. class Window_ItemList < Window_Selectable
  646.   #--------------------------------------------------------------------------
  647.   # ● 初始化对象
  648.   #--------------------------------------------------------------------------
  649.   def initialize(x, y, width, height)
  650.     super
  651.     self.windowskin = Cache.system(EASY_MENU_SET::SKIN)
  652.     self.opacity = EASY_MENU_SET::ITEMLIST[2]
  653.     @category = :none
  654.     @data = []
  655.   end
  656.   #--------------------------------------------------------------------------
  657.   # ● 获取标准的边距尺寸
  658.   #--------------------------------------------------------------------------
  659.   def standard_padding
  660.     return 16
  661.   end
  662.   #--------------------------------------------------------------------------
  663.   # ● 获取列数
  664.   #--------------------------------------------------------------------------
  665.   def col_max
  666.     return 1
  667.   end
  668.   #--------------------------------------------------------------------------
  669.   # ● 绘制项目
  670.   #--------------------------------------------------------------------------
  671.   alias easy_menu_draw_item draw_item
  672.   def draw_item(index)
  673.     easy_menu_font
  674.     easy_menu_draw_item(index)
  675.   end
  676.   #--------------------------------------------------------------------------
  677.   # ● 绘制物品个数
  678.   #--------------------------------------------------------------------------
  679.   def draw_item_number(rect, item)
  680.     return if $game_party.item_number(item) <= 1
  681.     draw_text(rect, sprintf("%02d", $game_party.item_number(item)), 2)
  682.   end
  683.   #--------------------------------------------------------------------------
  684.   # ● 绘制物品名称
  685.   #     enabled : 有效的标志。false 的时候使用半透明效果绘制
  686.   #--------------------------------------------------------------------------
  687.   def draw_item_name(item, x, y, enabled = true, width = 172)
  688.     return unless item
  689.     draw_icon(item.icon_index, x, y, enabled)
  690.     change_color(normal_color, enabled)
  691.     draw_text_ex(x + 24, y, item.name)
  692.     #draw_text(x + 24, y, width, line_height, item.name)
  693.   end
  694.   #--------------------------------------------------------------------------
  695.   # ● 重置字体设置
  696.   #--------------------------------------------------------------------------
  697.   def reset_font_settings
  698.     change_color(normal_color)
  699.     easy_menu_font
  700.   end
  701.   #--------------------------------------------------------------------------
  702.   # ● 更新帮助内容
  703.   #--------------------------------------------------------------------------
  704.   def update_help
  705.     @help_window.set_item(item)
  706.     @big_icon.set_item(item.big_icon) if EASY_MENU_SET::BIGICON[0]
  707.   end
  708.   #--------------------------------------------------------------------------
  709.   # ● 设置物品窗口
  710.   #--------------------------------------------------------------------------
  711.   def big_icon=(big_icon)
  712.     @big_icon = big_icon
  713.     update
  714.   end
  715. end

  716. #==============================================================================
  717. # ■ BIG ICON
  718. #==============================================================================
  719. module Cache
  720.   def self.bigicon(filename)
  721.     load_bitmap(EASY_MENU_SET::BIGICON_Cache, filename)
  722.   end
  723. end

  724. #==============================================================================
  725. # ■ RPG::BaseItem
  726. #==============================================================================
  727. class RPG::BaseItem
  728.   #--------------------------------------------------------------------------
  729.   # ● 获取大图标
  730.   #--------------------------------------------------------------------------
  731.   def big_icon
  732.     self.note =~ /\<BigIcon (\w+)\>/i
  733.     $1.nil? ? "" : $1
  734.   end
  735. end

  736. #==============================================================================
  737. # ■ Window_Big_icon
  738. #==============================================================================
  739. class Window_Big_icon < Window_Base
  740.   #--------------------------------------------------------------------------
  741.   # ● 初始化对象
  742.   #--------------------------------------------------------------------------
  743.   def initialize(x, y, width, height)
  744.     super(x, y, width, height)
  745.     self.windowskin = Cache.system(EASY_MENU_SET::SKIN)
  746.     self.opacity = EASY_MENU_SET::BIGICON[6]
  747.   end
  748.   #--------------------------------------------------------------------------
  749.   # ● 设置内容
  750.   #--------------------------------------------------------------------------
  751.   def set_item(icon)
  752.     if icon != @icon
  753.       contents.clear
  754.       bitmap = Cache.bigicon(icon)
  755.       x = (contents.width - bitmap.width) / 2
  756.       y = (contents.height - bitmap.height) / 2
  757.       rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  758.       contents.blt(x, y, bitmap, rect)
  759.       @icon = icon
  760.     end
  761.   end
  762. end

  763. #==============================================================================
  764. # ■ Scene_ItemBase
  765. #==============================================================================
  766. class Scene_ItemBase < Scene_MenuBase
  767.   #--------------------------------------------------------------------------
  768.   # ● 生成角色窗口
  769.   #--------------------------------------------------------------------------
  770.   def create_actor_window
  771.     @actor_window = Window_MenuActor.new
  772.     @actor_window.set_handler(:ok,     method(:on_actor_ok))
  773.     @actor_window.set_handler(:cancel, method(:on_actor_cancel))
  774.   end
  775.   #--------------------------------------------------------------------------
  776.   # ● 显示子窗口
  777.   #--------------------------------------------------------------------------
  778.   alias easy_menu_show_sub_window show_sub_window
  779.   def show_sub_window(window)
  780.     window.y = (Graphics.height - @actor_window.height) / 2
  781.     easy_menu_show_sub_window(window)
  782.     @actor_window.z = 200
  783.   end
  784. end

  785. #==============================================================================
  786. # ■ Scene_Item
  787. #==============================================================================
  788. class Scene_Item < Scene_ItemBase
  789.   #--------------------------------------------------------------------------
  790.   # ● 预处理
  791.   #--------------------------------------------------------------------------
  792.   def prepare(mode = :item)
  793.     @mode = mode
  794.   end
  795.   #--------------------------------------------------------------------------
  796.   # ● 开始处理
  797.   #--------------------------------------------------------------------------
  798.   def start
  799.     super
  800.     v = EASY_MENU_SET::ITEM_RIM
  801.     create_rim_background(v[0], v[1], v[2]) if v[0]
  802.     create_actor_cg unless EASY_MENU_SET::BIGICON[0]
  803.     create_help_window
  804.     create_big_icon_window if EASY_MENU_SET::BIGICON[0]
  805.     create_item_window
  806.     create_sub_button
  807.   end
  808.   #--------------------------------------------------------------------------
  809.   # ● 生成物品窗口
  810.   #--------------------------------------------------------------------------
  811.   def create_item_window
  812.     sp = EASY_MENU_SET::COMMAND[1]
  813.     iy = sp + EASY_MENU_SET::COMMAND[3] - 8
  814.     ih = Graphics.height - @help_window.height - sp - iy
  815.     @item_window = Window_ItemList.new(sp, iy, @help_window.width, ih)
  816.     @item_window.category = @mode
  817.     @item_window.viewport = @viewport
  818.     @item_window.help_window = @help_window
  819.     @item_window.big_icon = @big_icon_window if EASY_MENU_SET::BIGICON[0]
  820.     @item_window.set_handler(:ok,     method(:on_item_ok))
  821.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  822.     @item_window.index = 0
  823.     @item_window.activate
  824.   end
  825.   #--------------------------------------------------------------------------
  826.   # ● 生成帮助窗口
  827.   #--------------------------------------------------------------------------
  828.   def create_help_window
  829.     sp = EASY_MENU_SET::COMMAND[1]
  830.     v = EASY_MENU_SET::ITEMLIST
  831.     w = v[0] > 0 ? v[0] : (Graphics.width / 2 - sp)
  832.     @help_window = Window_Help.new(v[1], w)
  833.     @help_window.viewport = @viewport
  834.     @help_window.x = sp
  835.     @help_window.y = Graphics.height - @help_window.height - sp
  836.   end
  837.   #--------------------------------------------------------------------------
  838.   # ● 生成物品大图标
  839.   #--------------------------------------------------------------------------
  840.   def create_big_icon_window
  841.     sp = EASY_MENU_SET::COMMAND[1]
  842.     v = EASY_MENU_SET::BIGICON
  843.     b = []
  844.     if v[1]
  845.       b[0] = @help_window.width + sp
  846.       b[1] = sp + EASY_MENU_SET::COMMAND[3] - 8
  847.       b[2] = Graphics.width - b[0] - sp
  848.       b[3] = Graphics.height - b[1] - sp
  849.     else
  850.       b = [v[2], v[3], v[4], v[5]]
  851.     end
  852.     @big_icon_window = Window_Big_icon.new(b[0], b[1], b[2], b[3])
  853.     @big_icon_window.viewport = @viewport
  854.   end
  855.   #--------------------------------------------------------------------------
  856.   # ● 物品“取消”
  857.   #--------------------------------------------------------------------------
  858.   def on_item_cancel
  859.     @item_window.unselect
  860.     return_scene
  861.   end
  862. end


  863. #==============================================================================
  864. # ★ 存档界面
  865. #==============================================================================
  866. #==============================================================================
  867. # ■ Window_SaveFileList
  868. #------------------------------------------------------------------------------
  869. #  存档的选项窗口(左)
  870. #==============================================================================
  871. class Window_SaveFileList < Window_Selectable
  872.   #--------------------------------------------------------------------------
  873.   # ● 初始化对象
  874.   #--------------------------------------------------------------------------
  875.   def initialize(x, y, width, height)
  876.     super
  877.     self.windowskin = Cache.system(EASY_MENU_SET::SKIN)
  878.     self.opacity = EASY_MENU_SET::FILESLIST[4]
  879.     @symbol = nil
  880.     refresh
  881.     activate
  882.   end
  883.   #--------------------------------------------------------------------------
  884.   # ● 获取可显示的存档数目
  885.   #--------------------------------------------------------------------------
  886.   def visible_max
  887.     return EASY_MENU_SET::FILESLIST[1]
  888.   end
  889.   #--------------------------------------------------------------------------
  890.   # ● 获取项目的高度
  891.   #--------------------------------------------------------------------------
  892.   def item_height
  893.     (height - standard_padding * 2) / visible_max
  894.   end
  895.   #--------------------------------------------------------------------------
  896.   # ● 存档数量最大值
  897.   #--------------------------------------------------------------------------
  898.   def item_max
  899.     return EASY_MENU_SET::FILES_MAX
  900.   end
  901.   #--------------------------------------------------------------------------
  902.   # ● 绘制项目
  903.   #--------------------------------------------------------------------------
  904.   def draw_item(index)
  905.     header = DataManager.load_header(index)
  906.     rect = item_rect_for_text(index)
  907.     ry = (item_height - line_height) / 2
  908.     easy_menu_font
  909.     v = EASY_MENU_SET::FILESLIST
  910.     change_color(Color.new(v[3][0][0], v[3][0][1], v[3][0][2]), header)
  911.     icon_id = header ? v[2][1] : v[2][0]
  912.     draw_icon(icon_id, rect.x + 4, rect.y + ry)
  913.     text = @symbol == :save ? EASY_MENU_SET::SAVING : EASY_MENU_SET::LOADING
  914.     ing = @index == index && @symbol
  915.     name = ing ? text : (Vocab::File + " #{index + 1}")
  916.     draw_text(rect.x + 28, rect.y + ry, rect.width, line_height, name)
  917.     change_color(Color.new(v[3][1][0], v[3][1][1], v[3][1][2]), header)
  918.     draw_playtime(header, rect.x - 4, rect.y + ry, rect.width, 2)
  919.   end
  920.   #--------------------------------------------------------------------------
  921.   # ● 绘制游戏时间
  922.   #--------------------------------------------------------------------------
  923.   def draw_playtime(header, x, y, width, align)
  924.     text = header ? header[:playtime_s] : "—:—:—"
  925.     draw_text(x, y, width, line_height, text, 2)
  926.   end
  927.   #--------------------------------------------------------------------------
  928.   # ● 设置选择状态
  929.   #--------------------------------------------------------------------------
  930.   def set_files(symbol)
  931.     @symbol = symbol
  932.     refresh
  933.   end
  934. end


  935. #==============================================================================
  936. # ■ Window_FilesDetails
  937. #------------------------------------------------------------------------------
  938. #  存档的详细窗口(右)
  939. #==============================================================================
  940. class Window_FilesDetails < Window_Base
  941.   #--------------------------------------------------------------------------
  942.   # ● 初始化对象
  943.   #--------------------------------------------------------------------------
  944.   def initialize(x, y, width, height)
  945.     super(x, y, width, height)
  946.     self.windowskin = Cache.system(EASY_MENU_SET::SKIN)
  947.     self.opacity = EASY_MENU_SET::FILES_DETAILS[6]
  948.     @bitmaps = []
  949.     @header = []
  950.   end
  951.   #--------------------------------------------------------------------------
  952.   # ● 释放
  953.   #--------------------------------------------------------------------------
  954.   def dispose
  955.     for bitmap in @bitmaps
  956.       next if bitmap == nil or bitmap.disposed?
  957.       bitmap.dispose
  958.     end
  959.     super
  960.   end
  961.   #--------------------------------------------------------------------------
  962.   # ● 设置选择状态
  963.   #--------------------------------------------------------------------------
  964.   def set_select(select)
  965.     return if @select == select
  966.     @select = select
  967.     refresh(@select)
  968.   end
  969.   #--------------------------------------------------------------------------
  970.   # ● 读取文件
  971.   #--------------------------------------------------------------------------
  972.   def read_save_data(index)
  973.     @header[index] = DataManager.load_header(index)
  974.     @bitmaps[index].dispose if @bitmaps[index]
  975.     return unless EASY_MENU_SET::FILES_DETAILS_DATA[0][0]
  976.     @bitmaps[index] = DataManager.load_save_bitmap(index)
  977.   end
  978.   #--------------------------------------------------------------------------
  979.   # ● 刷新
  980.   #--------------------------------------------------------------------------
  981.   def refresh(index)
  982.     contents.clear
  983.     read_save_data(index)
  984.     v = EASY_MENU_SET::FILES_DETAILS_DATA
  985.     draw_background(@header[index], v)
  986.     return unless @header[index]
  987.     draw_save_bitmap(@header[index], index, v)
  988.     draw_party_characters(@header[index], index, v)
  989.     draw_party_faces(@header[index], index, v)
  990.   end
  991.   #--------------------------------------------------------------------------
  992.   # ● 绘制 底图
  993.   #--------------------------------------------------------------------------
  994.   def draw_background(header, v)
  995.     return unless v[3][0]
  996.     return if (!header && v[3][1] == false)
  997.     bitmap = Cache.system(v[3][2])
  998.     contents.blt(v[3][3], v[3][4], bitmap, Rect.new(0, 0, v[3][5], v[3][6]))
  999.   end
  1000.   #--------------------------------------------------------------------------
  1001.   # ● 绘制截图
  1002.   #--------------------------------------------------------------------------
  1003.   def draw_save_bitmap(header, index, v)
  1004.     return unless v[0][0]
  1005.     bitmap = @bitmaps[index]
  1006.     #bx = (width - standard_padding * 2 - bitmap.width) / 2
  1007.     contents.blt(v[0][1], v[0][2], bitmap, bitmap.rect)
  1008.   end
  1009.   #--------------------------------------------------------------------------
  1010.   # ● 绘制队伍角色行走图
  1011.   #--------------------------------------------------------------------------
  1012.   def draw_party_characters(header, index, v)
  1013.     return unless v[1][0]
  1014.     x = v[1][1]
  1015.     y = v[1][2]
  1016.     header[:characters].each_with_index do |data, i|
  1017.       draw_character(data[0], data[1], x + i * 48, y)
  1018.     end
  1019.   end
  1020.   #--------------------------------------------------------------------------
  1021.   # ● 绘制队伍角色脸谱
  1022.   #--------------------------------------------------------------------------
  1023.   def draw_party_faces(header, index, v)
  1024.     return unless v[2][0]
  1025.     x = v[2][1]
  1026.     y = v[2][2]
  1027.     header[:characters].each_with_index do |data, i|
  1028.       bit = Cache.face(data[2])
  1029.       rx = bit.width / 4
  1030.       draw_face(data[2], data[3], x + i * rx, y)
  1031.     end
  1032.   end
  1033.   #--------------------------------------------------------------------------
  1034.   # ● 绘制角色肖像图
  1035.   #     enabled : 有效的标志。false 的时候使用半透明效果绘制
  1036.   #--------------------------------------------------------------------------
  1037.   def draw_face(face_name, face_index, x, y, enabled = true)
  1038.     bitmap = Cache.face(face_name)
  1039.     w = bitmap.width / 4
  1040.     h = bitmap.height / 2
  1041.     rect = Rect.new(face_index % 4 * w, face_index / 4 * h, w, h)
  1042.     contents.blt(x + 4, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  1043.     bitmap.dispose
  1044.   end
  1045. end

  1046. #==============================================================================
  1047. # ■ Scene_File
  1048. #==============================================================================
  1049. class Scene_File < Scene_MenuBase
  1050.   #--------------------------------------------------------------------------
  1051.   # ● 开始处理
  1052.   #--------------------------------------------------------------------------
  1053.   def start
  1054.     super
  1055.     v = EASY_MENU_SET::FILES_RIM
  1056.     create_rim_background(v[0], v[1], v[2]) if v[0]
  1057.     create_actor_cg unless EASY_MENU_SET::FILES_DETAILS[0]
  1058.     create_help_window if EASY_MENU_SET::FILESLIST[5]
  1059.     create_savefile_windows
  1060.     create_details_window if EASY_MENU_SET::FILES_DETAILS[0]
  1061.     create_sub_button
  1062.     init_selection
  1063.   end
  1064.   #--------------------------------------------------------------------------
  1065.   # ● 结束处理
  1066.   #--------------------------------------------------------------------------
  1067.   def terminate
  1068.     super
  1069.   end
  1070.   #--------------------------------------------------------------------------
  1071.   # ● 更新画面
  1072.   #--------------------------------------------------------------------------
  1073.   def update
  1074.     super
  1075.     @details_window.set_select(@savefile_window.index) if @details_window
  1076.   end
  1077.   #--------------------------------------------------------------------------
  1078.   # ● 生成帮助窗口
  1079.   #--------------------------------------------------------------------------
  1080.   def create_help_window
  1081.     sp = EASY_MENU_SET::COMMAND[1]
  1082.     v = EASY_MENU_SET::FILESLIST
  1083.     w = v[0] > 0 ? v[0] : (Graphics.width / 2 - sp)
  1084.     @help_window = Window_Help.new(1, w)
  1085.     @help_window.set_text(help_window_text)
  1086.     @help_window.x = sp
  1087.     @help_window.y = sp + EASY_MENU_SET::COMMAND[3] - 8
  1088.   end
  1089.   #--------------------------------------------------------------------------
  1090.   # ● 获取帮助窗口的文本
  1091.   #--------------------------------------------------------------------------
  1092.   def help_window_text
  1093.     return ""
  1094.   end
  1095.   #--------------------------------------------------------------------------
  1096.   # ● 生成存档文件窗口
  1097.   #--------------------------------------------------------------------------
  1098.   def create_savefile_windows
  1099.     sp = EASY_MENU_SET::COMMAND[1]
  1100.     hy = sp + EASY_MENU_SET::COMMAND[3] - 8
  1101.     sy = @help_window ? (@help_window.y + @help_window.height) : hy
  1102.     v = EASY_MENU_SET::FILESLIST
  1103.     sw = v[0] > 0 ? v[0] : (Graphics.width / 2 - sp)
  1104.     sh = Graphics.height - sy - sp
  1105.     @savefile_window = Window_SaveFileList.new(sp, sy, sw, sh)
  1106.     @savefile_window.set_handler(:ok,     method(:on_savefile_ok))
  1107.     @savefile_window.set_handler(:cancel, method(:on_savefile_cancel))
  1108.   end
  1109.   #--------------------------------------------------------------------------
  1110.   # ● 生成详细文件窗口
  1111.   #--------------------------------------------------------------------------
  1112.   def create_details_window
  1113.     sp = EASY_MENU_SET::COMMAND[1]
  1114.     v = EASY_MENU_SET::FILES_DETAILS
  1115.     d = []
  1116.     if v[1]
  1117.       d[0] = @savefile_window.width + sp
  1118.       d[1] = @help_window.y
  1119.       d[2] = Graphics.width - d[0] - sp
  1120.       d[3] = Graphics.height - d[1] - sp
  1121.     else
  1122.       d = [v[2], v[3], v[4], v[5]]
  1123.     end
  1124.     @details_window = Window_FilesDetails.new(d[0], d[1], d[2], d[3])
  1125.   end
  1126.   #--------------------------------------------------------------------------
  1127.   # ● 初始化选择状态
  1128.   #--------------------------------------------------------------------------
  1129.   def init_selection
  1130.     index = first_savefile_index
  1131.     @savefile_window.select(index)
  1132.     @details_window.set_select(index) if @details_window
  1133.   end
  1134. end


  1135. #==============================================================================
  1136. # ■ Scene_Save
  1137. #==============================================================================
  1138. class Scene_Save < Scene_File
  1139.   #--------------------------------------------------------------------------
  1140.   # ● 开始处理
  1141.   #--------------------------------------------------------------------------
  1142.   def start
  1143.     Window_MenuCommand::init_command_position(:save)
  1144.     super
  1145.   end
  1146.   #--------------------------------------------------------------------------
  1147.   # ● 确定存档文件
  1148.   #--------------------------------------------------------------------------
  1149.   def on_savefile_ok
  1150.     super
  1151.     if DataManager.save_game(@savefile_window.index)
  1152.       on_save_success
  1153.     else
  1154.       Sound.play_buzzer
  1155.     end
  1156.   end
  1157.   #--------------------------------------------------------------------------
  1158.   # ● 存档成功时的处理
  1159.   #--------------------------------------------------------------------------
  1160.   def on_save_success
  1161.     Sound.play_save
  1162.     @savefile_window.set_files(:save)
  1163.     @details_window.refresh(@savefile_window.index) if @details_window
  1164.     Graphics.wait(30)
  1165.     if EASY_MENU_SET::FILES_RETURN
  1166.       return_scene
  1167.     else
  1168.       @savefile_window.set_files(nil)
  1169.       @savefile_window.activate
  1170.     end
  1171.   end
  1172. end


  1173. #==============================================================================
  1174. # ■ Scene_Load
  1175. #==============================================================================
  1176. class Scene_Load < Scene_File
  1177.   #--------------------------------------------------------------------------
  1178.   # ● 开始处理
  1179.   #--------------------------------------------------------------------------
  1180.   def start
  1181.     Window_MenuCommand::init_command_position(:continue)
  1182.     super
  1183.   end
  1184.   #--------------------------------------------------------------------------
  1185.   # ● 确定读档文件
  1186.   #--------------------------------------------------------------------------
  1187.   def on_savefile_ok
  1188.     super
  1189.     if DataManager.load_game(@savefile_window.index)
  1190.       on_load_success
  1191.     else
  1192.       Sound.play_buzzer
  1193.     end
  1194.   end
  1195.   #--------------------------------------------------------------------------
  1196.   # ● 读档成功时的处理
  1197.   #--------------------------------------------------------------------------
  1198.   def on_load_success
  1199.     Sound.play_load
  1200.     @savefile_window.set_files(:continue)
  1201.     Graphics.wait(20)
  1202.     fadeout_all
  1203.     $game_system.on_after_load
  1204.     SceneManager.goto(Scene_Map)
  1205.   end
  1206. end


  1207. #==============================================================================
  1208. # ■ DataManager
  1209. #==============================================================================
  1210. module DataManager
  1211.   #--------------------------------------------------------------------------
  1212.   # ● 判定存档文件是否存在
  1213.   #--------------------------------------------------------------------------
  1214.   def self.save_file_exists?
  1215.     if savefile_folder == ""
  1216.       text = 'Save*.rvdata2'
  1217.     else
  1218.       text = savefile_folder + '/Save*.rvdata2'
  1219.     end
  1220.     !Dir.glob(text).empty?
  1221.   end
  1222.   #--------------------------------------------------------------------------
  1223.   # ● 存档文件的最大数
  1224.   #--------------------------------------------------------------------------
  1225.   def self.savefile_max
  1226.     max = EASY_MENU_SET::FILES_MAX ? EASY_MENU_SET::FILES_MAX : 16
  1227.     return max
  1228.   end
  1229.   #--------------------------------------------------------------------------
  1230.   # ● 生成父文件夹
  1231.   #--------------------------------------------------------------------------
  1232.   def self.savefile_folder
  1233.     return EASY_MENU_SET::FILES_NAME
  1234.   end
  1235.   #--------------------------------------------------------------------------
  1236.   # ● 生成文件名
  1237.   #     index : 文件索引
  1238.   #--------------------------------------------------------------------------
  1239.   def self.make_filename(index)
  1240.     filename = sprintf("Save%02d.rvdata2", index + 1)
  1241.     if savefile_folder == ""
  1242.       return filename
  1243.     else
  1244.       return savefile_folder + "/" + filename
  1245.     end
  1246.   end
  1247.   #--------------------------------------------------------------------------
  1248.   # ● 生成截图
  1249.   #--------------------------------------------------------------------------
  1250.   def self.make_save_bitmap
  1251.     bitmap = set_bitmap_array(SceneManager.saves_bitmap)
  1252.     bitmap
  1253.   end
  1254.   #--------------------------------------------------------------------------
  1255.   # ● 获取截图
  1256.   #--------------------------------------------------------------------------
  1257.   def self.load_save_bitmap(index)
  1258.     begin
  1259.       File.open(make_filename(index), "rb") do |file|
  1260.         Marshal.load(file)
  1261.         return read_bitmap_array(Marshal.load(file))
  1262.       end
  1263.     rescue
  1264.       return nil
  1265.     end
  1266.   end
  1267.   #--------------------------------------------------------------------------
  1268.   # ● 制作截图文件 by 老鹰
  1269.   #--------------------------------------------------------------------------
  1270.   def self.set_bitmap_array(bitmap)
  1271.     data = []
  1272.     bitmap.height.times do |i| # 行号
  1273.       data[i] = []
  1274.       bitmap.width.times do |j| # 列号
  1275.         color = bitmap.get_pixel(j, i)
  1276.         data[i][j] = [color.red, color.green, color.blue]
  1277.       end
  1278.     end
  1279.     data
  1280.   end
  1281.   #--------------------------------------------------------------------------
  1282.   # ● 获取截图文件 by 老鹰
  1283.   #--------------------------------------------------------------------------
  1284.   def self.read_bitmap_array(array)
  1285.     h = array.size # 行数
  1286.     w = array[0].size # 列数
  1287.     bitmap = Bitmap.new(w, h)
  1288.     h.times do |i|
  1289.       w.times do |j|
  1290.         data = array[i][j]
  1291.         color = Color.new(data[0], data[1], data[2])
  1292.         bitmap.set_pixel(j, i, color)
  1293.       end
  1294.     end
  1295.     bitmap
  1296.   end
  1297.   #--------------------------------------------------------------------------
  1298.   # ● 执行存档(没有错误处理)
  1299.   #--------------------------------------------------------------------------
  1300.   def self.save_game_without_rescue(index)
  1301.     unless FileTest.directory?(savefile_folder)
  1302.       Dir::mkdir(savefile_folder)
  1303.     end
  1304.     File.open(make_filename(index), "wb") do |file|
  1305.       $game_system.on_before_save
  1306.       Marshal.dump(make_save_header, file)
  1307.       Marshal.dump(make_save_bitmap, file)
  1308.       Marshal.dump(make_save_contents, file)
  1309.       @last_savefile_index = index
  1310.     end
  1311.     return true
  1312.   end
  1313.   #--------------------------------------------------------------------------
  1314.   # ● 执行读档(没有错误处理)
  1315.   #--------------------------------------------------------------------------
  1316.   def self.load_game_without_rescue(index)
  1317.     File.open(make_filename(index), "rb") do |file|
  1318.       Marshal.load(file)
  1319.       Marshal.load(file)
  1320.       extract_save_contents(Marshal.load(file))
  1321.       reload_map_if_updated
  1322.       @last_savefile_index = index
  1323.     end
  1324.     return true
  1325.   end
  1326. end

  1327. #==============================================================================
  1328. # ■ Game_Party
  1329. #==============================================================================
  1330. class Game_Party < Game_Unit
  1331.   #--------------------------------------------------------------------------
  1332.   # ● 存档文件显示用的角色图像信息
  1333.   #--------------------------------------------------------------------------
  1334.   def characters_for_savefile
  1335.     battle_members.collect do |actor|
  1336.       [actor.character_name, actor.character_index,
  1337.        actor.face_name, actor.face_index]
  1338.     end
  1339.   end
  1340. end


  1341. #==============================================================================
  1342. # ■ Window_MenuStatus
  1343. #==============================================================================
  1344. class Window_MenuStatus < Window_Selectable
  1345.   #--------------------------------------------------------------------------
  1346.   # ● 获取窗口的宽度
  1347.   #--------------------------------------------------------------------------
  1348.   def window_width
  1349.     Graphics.width - 160 - 96
  1350.   end
  1351.   #--------------------------------------------------------------------------
  1352.   # ● 获取窗口的高度
  1353.   #--------------------------------------------------------------------------
  1354.   def window_height
  1355.     Graphics.height > 416 ? 416 : Graphics.height
  1356.   end
  1357. end

  1358. #==============================================================================
  1359. # ■ Window_GameEnd
  1360. #==============================================================================
  1361. class Window_GameEnd < Window_Command
  1362.   #--------------------------------------------------------------------------
  1363.   # ● 初始化对象
  1364.   #--------------------------------------------------------------------------
  1365.   alias easy_menu_initialize initialize
  1366.   def initialize
  1367.     easy_menu_initialize
  1368.     self.windowskin = Cache.system(EASY_MENU_SET::SKIN)
  1369.   end
  1370. end
复制代码
...........
回复

使用道具 举报

梦石
0
星屑
65
在线时间
3 小时
注册时间
2020-7-20
回帖
5
 楼主| 发表于 2021-4-4 22:26:58 | 显示全部楼层
alexncf125 发表于 2021-2-15 18:18
把·CONG'S EASY MENU由第1089行class Scene_File < Scene_MenuBase开始,
至到1374行module DataManager的 ...

我的是这样的,怎么弄?大佬,能教教我吗?
...........
回复

使用道具 举报

梦石
0
星屑
65
在线时间
3 小时
注册时间
2020-7-20
回帖
5
 楼主| 发表于 2021-4-4 22:27:48 | 显示全部楼层
alexncf125 发表于 2021-2-15 18:18
把·CONG'S EASY MENU由第1089行class Scene_File < Scene_MenuBase开始,
至到1374行module DataManager的 ...
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ◇ CONG'S EASY MENU ◇ 葱式解谜用简易菜单
  4. #------------------------------------------------------------------------------
  5. # By Conwsbn
  6. # http://congrm.lofter.com/
  7. #==============================================================================

  8. $imported = {} if $imported.nil?
  9. $imported[:congs_easy_menu] = true

  10. #==============================================================================
  11. # ■ Window_Base
  12. #==============================================================================
  13. class Window_Base < Window
  14.   #--------------------------------------------------------------------------
  15.   # ● 获取统一字体设置
  16.   #--------------------------------------------------------------------------
  17.   def easy_menu_font
  18.     contents.font.name = EASY_MENU_SET::Font_name
  19.     contents.font.size = EASY_MENU_SET::Font_size
  20.     contents.font.outline = EASY_MENU_SET::Font_outline
  21.     contents.font.shadow = EASY_MENU_SET::Font_shadow
  22.     contents.font.bold = EASY_MENU_SET::Font_bold
  23.     contents.font.italic = EASY_MENU_SET::Font_italic
  24.   end
  25. end

  26. #==============================================================================
  27. # ■ Window_Help
  28. #==============================================================================
  29. class Window_Help < Window_Base
  30.   #--------------------------------------------------------------------------
  31.   # ● 初始化对象
  32.   #--------------------------------------------------------------------------
  33.   def initialize(line_number = 2, width = Graphics.width)
  34.     super(0, 0, width, fitting_height(line_number))
  35.     self.windowskin = Cache.system(EASY_MENU_SET::SKIN)
  36.     self.opacity = EASY_MENU_SET::HELP_opacity
  37.   end
  38.   #--------------------------------------------------------------------------
  39.   # ● 设置内容
  40.   #--------------------------------------------------------------------------
  41.   def set_text(text)
  42.     text.gsub!(/\\n/i) { "\n" }
  43.     if text != @text
  44.       @text = text
  45.       refresh
  46.     end
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # ● 清除
  50.   #--------------------------------------------------------------------------
  51.   def clear
  52.     set_text("")
  53.   end
  54.   #--------------------------------------------------------------------------
  55.   # ● 设置物品
  56.   #     item : 技能、物品等
  57.   #--------------------------------------------------------------------------
  58.   def set_item(item)
  59.     set_text(item ? item.description : "")
  60.   end
  61.   #--------------------------------------------------------------------------
  62.   # ● 绘制带有控制符的文本内容
  63.   #--------------------------------------------------------------------------
  64.   def draw_text_ex(x, y, text)
  65.     reset_item_font_settings
  66.     text = convert_escape_characters(text)
  67.     pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
  68.     process_character(text.slice!(0, 1), text, pos) until text.empty?
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # ● 物品帮助字体设置
  72.   #--------------------------------------------------------------------------
  73.   def reset_item_font_settings
  74.     return if @text_line
  75.     contents.font.name = EASY_MENU_SET::HELP_name
  76.     contents.font.size = EASY_MENU_SET::HELP_size
  77.     contents.font.outline = EASY_MENU_SET::HELP_outline
  78.     contents.font.shadow = EASY_MENU_SET::HELP_shadow
  79.     contents.font.bold = EASY_MENU_SET::HELP_bold
  80.     contents.font.italic = EASY_MENU_SET::HELP_italic
  81.     v = EASY_MENU_SET::HELP_color
  82.     change_color(Color.new(v[0], v[1], v[2]))
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   # ● 获取文字颜色
  86.   #--------------------------------------------------------------------------
  87.   def text_color(n)
  88.     v = EASY_MENU_SET::HELP_color
  89.     return Color.new(v[0], v[1], v[2]) if n == 0
  90.     return windowskin.get_pixel(64 + (n % 8) * 8, 96 + (n / 8) * 8)
  91.   end
  92.   #--------------------------------------------------------------------------
  93.   # ● 处理普通文字
  94.   #--------------------------------------------------------------------------
  95.   def process_normal_character(c, pos)
  96.     if (pos[:x] + contents.text_size(c).width) > contents.width
  97.       @text_line = true
  98.       process_new_line(c, pos)
  99.       @text_line = false
  100.       pos[:height] = calc_line_height(c)
  101.     end
  102.     text_width = text_size(c).width
  103.     draw_text(pos[:x], pos[:y], text_width * 2, pos[:height], c)
  104.     pos[:x] += text_width
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ● 刷新
  108.   #--------------------------------------------------------------------------
  109.   def refresh
  110.     contents.clear
  111.     draw_text_ex(4, 0, @text)
  112.   end
  113. end

  114. #==============================================================================
  115. # ■ Window_MenuCommand
  116. #==============================================================================
  117. class Window_MenuCommand < Window_Command
  118.   #--------------------------------------------------------------------------
  119.   # ● 初始化指令选择位置(类方法)
  120.   #--------------------------------------------------------------------------
  121.   def self.init_command_position(type = nil)
  122.     @@last_command_symbol = type
  123.   end
  124.   #--------------------------------------------------------------------------
  125.   # ● 初始化对象
  126.   #--------------------------------------------------------------------------
  127.   def initialize(sub = false)
  128.     @sub = sub
  129.     super(-24, EASY_MENU_SET::COMMAND[1])
  130.     self.opacity = 0
  131.     self.active = false
  132.     @show = false
  133.     @move_rx = @sub_ry = 0
  134.     @last_index = @index
  135.     update_placement unless @sub
  136.     select_last
  137.     refresh
  138.   end
  139.   #--------------------------------------------------------------------------
  140.   # ● 获取标准的边距尺寸
  141.   #--------------------------------------------------------------------------
  142.   def standard_padding
  143.     return 0
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● 显示动画前的设定
  147.   #--------------------------------------------------------------------------
  148.   def update_placement
  149.     self.x = -24 - window_width
  150.     self.contents_opacity = 0
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   # ● 获取窗口的宽度
  154.   #--------------------------------------------------------------------------
  155.   def window_width
  156.     return EASY_MENU_SET::COMMAND[2] + 24 + 24
  157.   end
  158.   #--------------------------------------------------------------------------
  159.   # ● 获取项目的宽度
  160.   #--------------------------------------------------------------------------
  161.   def item_width
  162.     width - 24
  163.   end
  164.   #--------------------------------------------------------------------------
  165.   # ● 获取间隔距离
  166.   #--------------------------------------------------------------------------
  167.   def line_spacing
  168.     return EASY_MENU_SET::COMMAND[4]
  169.   end
  170.   #--------------------------------------------------------------------------
  171.   # ● 获取行高
  172.   #--------------------------------------------------------------------------
  173.   def line_height
  174.     return EASY_MENU_SET::COMMAND[3] + line_spacing
  175.   end
  176.   #--------------------------------------------------------------------------
  177.   # ● 获取指令名称
  178.   #--------------------------------------------------------------------------
  179.   def set_command_name(v)
  180.     @name = []
  181.     for i in 0...EASY_MENU_SET::BUTTON.size
  182.       name = Vocab::item     if v[i][4] == :item
  183.       name = Vocab::key_item if v[i][4] == :key_item
  184.       name = Vocab::save     if v[i][4] == :save
  185.       name = Vocab::continue if v[i][4] == :continue
  186.       name = Vocab::game_end if v[i][4] == :game_end
  187.       @name[i] = v[i][1] ? v[i][1] : name
  188.     end
  189.   end
  190.   #--------------------------------------------------------------------------
  191.   # ● 获取显示状态
  192.   #--------------------------------------------------------------------------
  193.   def set_command_enabled(v)
  194.     @enabled = []
  195.     for i in 0...EASY_MENU_SET::BUTTON.size
  196.       enabled = main_commands_enabled         if v[i][4] == :item
  197.       enabled = main_commands_enabled         if v[i][4] == :key_item
  198.       enabled = save_enabled                  if v[i][4] == :save
  199.       enabled = DataManager.save_file_exists? if v[i][4] == :continue
  200.       enabled = true                          if v[i][4] == :game_end
  201.       @enabled[i] = enabled
  202.     end
  203.   end
  204.   #--------------------------------------------------------------------------
  205.   # ● 获取指令图标
  206.   #--------------------------------------------------------------------------
  207.   def set_command_icon(v)
  208.     @icon = []
  209.     for i in 0...EASY_MENU_SET::BUTTON.size
  210.       @icon[i] = v[i][2] if v[i][2]
  211.     end
  212.   end
  213.   #--------------------------------------------------------------------------
  214.   # ● 获取选项的图标
  215.   #--------------------------------------------------------------------------
  216.   def command_icon(index)
  217.     @list[index][:ext]
  218.   end
  219.   #--------------------------------------------------------------------------
  220.   # ● 生成指令列表
  221.   #--------------------------------------------------------------------------
  222.   def make_command_list
  223.     v = EASY_MENU_SET::BUTTON
  224.     set_command_name(v)
  225.     set_command_icon(v)
  226.     set_command_enabled(v)
  227.     for i in 0...EASY_MENU_SET::BUTTON.size
  228.       add_command(@name[i], v[i][4], @enabled[i], @icon[i]) if v[i][0] or @sub
  229.     end
  230.   end
  231.   #--------------------------------------------------------------------------
  232.   # ● 刷新
  233.   #--------------------------------------------------------------------------
  234.   def refresh
  235.     #clear_command_list
  236.     #make_command_list
  237.     create_contents
  238.     contents.clear
  239.     draw_all_items
  240.   end
  241.   #--------------------------------------------------------------------------
  242.   # ● 绘制项目
  243.   #--------------------------------------------------------------------------
  244.   def draw_item(index)
  245.     return if @sub && @index != index
  246.     easy_menu_font
  247.     rect = item_rect_for_text(index)
  248.     t_size = text_size(command_name(index))
  249.     mx = @index == index ? @sub ? 0 : @move_rx : 0
  250.     my = @sub ? @sub_ry : 0
  251.     ix = item_width - t_size.width - 28 + mx
  252.     iy = (line_height - t_size.height) / 2 + my
  253.     draw_background(index, rect, mx, my)
  254.     rect.x -= 24
  255.     rect.y -= (line_spacing / 2)
  256.     enabled = command_enabled?(index)
  257.     change_color(item_color(index), enabled)
  258.     rt = [rect.x + mx, rect.y + my, rect.width, rect.height]
  259.     draw_text(rt[0], rt[1], rt[2], rt[3], command_name(index), 2)
  260.     draw_icon(command_icon(index), rect.x + ix, rect.y + iy, enabled)
  261.   end
  262.   #--------------------------------------------------------------------------
  263.   # ● 绘制底纹
  264.   #--------------------------------------------------------------------------
  265.   def draw_background(index, rect, x, y)
  266.     lh = line_height - line_spacing
  267.     bit = Cache.system(EASY_MENU_SET::COMMAND[0])
  268.     rx = bit.width - item_width
  269.     rect1 = Rect.new(rx, 0, item_width, 12)
  270.     rect2 = Rect.new(rx, 12, item_width, 12)
  271.     rect3 = Rect.new(rx, 36 - 12, item_width, 12)
  272.     d_rect = Rect.new(rect.x + x, rect.y + 12 + y, item_width, lh - 24)
  273.     self.contents.blt(rect.x + x, rect.y + y, bit, rect1)
  274.     self.contents.stretch_blt(d_rect, bit, rect2)
  275.     self.contents.blt(rect.x + x, rect.y + lh - 12 + y, bit, rect3)
  276.   end
  277.   #--------------------------------------------------------------------------
  278.   # ● 字体颜色扩展
  279.   #--------------------------------------------------------------------------
  280.   def item_color(index)
  281.     co = EASY_MENU_SET::BUTTON[index][3]
  282.     return Color.new(co[0], co[1], co[2]) if @index == index
  283.     return Color.new(co[0], co[1], co[2], 200)
  284.   end
  285.   #--------------------------------------------------------------------------
  286.   # ● 获取项目的绘制矩形
  287.   #--------------------------------------------------------------------------
  288.   def item_rect(index)
  289.     index = 0 if @sub
  290.     rect = Rect.new
  291.     rect.width = 4
  292.     rect.height = 24
  293.     rect.x = index % col_max * (item_width + spacing) + 32
  294.     rect.y = index / col_max * item_height + 4
  295.     rect
  296.   end
  297.   #--------------------------------------------------------------------------
  298.   # ● 获取项目的绘制矩形(内容用)
  299.   #--------------------------------------------------------------------------
  300.   def item_rect_for_text(index)
  301.     index = 0 if @sub
  302.     rect = Rect.new
  303.     rect.width = item_width
  304.     rect.height = item_height
  305.     rect.x = index % col_max * (item_width + spacing)
  306.     rect.y = index / col_max * item_height
  307.     rect
  308.   end
  309.   #--------------------------------------------------------------------------
  310.   # ● 展开动画的标志
  311.   #--------------------------------------------------------------------------
  312.   def show=(show)
  313.     if @show != show
  314.       @show = show
  315.     end
  316.   end
  317.   #--------------------------------------------------------------------------
  318.   # ● 获取动画的标志
  319.   #--------------------------------------------------------------------------
  320.   def show
  321.     return @show
  322.   end
  323.   #--------------------------------------------------------------------------
  324.   # ● 更新画面
  325.   #--------------------------------------------------------------------------
  326.   def update
  327.     super
  328.     if @last_index != @index && !@show
  329.       @move_rx = 0
  330.       @last_index = @index
  331.     end
  332.     update_button if Input.dir4 > 0 or @move_rx < 24
  333.   end
  334.   #--------------------------------------------------------------------------
  335.   # ● 按钮的改变动画
  336.   #--------------------------------------------------------------------------
  337.   def update_button
  338.     @move_rx += 4 if @move_rx < 24
  339.     refresh
  340.   end
  341.   #--------------------------------------------------------------------------
  342.   # ● 按钮的还原动画
  343.   #--------------------------------------------------------------------------
  344.   def hide_button
  345.     @move_rx -= 4 if @move_rx > 0
  346.     refresh
  347.   end
  348.   #--------------------------------------------------------------------------
  349.   # ● 展开动画
  350.   #--------------------------------------------------------------------------
  351.   def open_button_window
  352.     self.x += (window_width + 24) / EASY_MENU_SET::TIME
  353.     self.contents_opacity += 255 / EASY_MENU_SET::TIME
  354.     refresh
  355.     @show = false if self.x >= -24
  356.     self.x = -24 if !@show
  357.     self.contents_opacity = 255 if !@show
  358.   end
  359.   #--------------------------------------------------------------------------
  360.   # ● 关闭动画
  361.   #--------------------------------------------------------------------------
  362.   def close_button_window
  363.     @show = false if self.contents_opacity <= 0
  364.     if @move_rx > 0
  365.       hide_button
  366.     else
  367.       self.x -= (window_width + 24) / EASY_MENU_SET::TIME
  368.       self.contents_opacity -= 255 / EASY_MENU_SET::TIME
  369.       refresh
  370.     end
  371.   end
  372.   #--------------------------------------------------------------------------
  373.   # ● 进入子菜单的关闭动画
  374.   #--------------------------------------------------------------------------
  375.   def close_window_to_sub
  376.     if @move_rx > 0
  377.       hide_button
  378.       @sub_ry = @index / col_max * item_height
  379.     else
  380.       cursor_rect.empty
  381.       @show = false if @sub_ry <= 0
  382.       @sub_ry = 0 if !@show
  383.       @sub = true
  384.       @sub_ry = [(@sub_ry - ((EASY_MENU_SET::COMMAND[3] * index)) / 6), 0].max
  385.       refresh
  386.     end
  387.   end
  388. end

  389. #==============================================================================
  390. # ■ Scene_MenuBase
  391. #==============================================================================
  392. class Scene_MenuBase < Scene_Base
  393.   #--------------------------------------------------------------------------
  394.   # ● 结束处理
  395.   #--------------------------------------------------------------------------
  396.   alias easy_menu_terminate terminate
  397.   def terminate
  398.     easy_menu_terminate
  399.     dispose_rim
  400.     dispose_actor_cg
  401.     dispose_sub_button
  402.   end
  403.   #--------------------------------------------------------------------------
  404.   # ● 生成背景
  405.   #--------------------------------------------------------------------------
  406.   def create_background
  407.     wall = EASY_MENU_SET::WALLPAPER
  408.     co = EASY_MENU_SET::BACKGROUND
  409.     @background_sprite = Sprite.new
  410.     bitmap = wall ? Cache.system(wall) : SceneManager.background_bitmap
  411.     @background_sprite.bitmap = bitmap
  412.     @background_sprite.color.set(co[0], co[1], co[2], co[3]) unless wall
  413.   end
  414.   #--------------------------------------------------------------------------
  415.   # ● 绘制次背景图片
  416.   #--------------------------------------------------------------------------
  417.   def create_rim_background(bitmap, x, y)
  418.     @rim_sprite = Sprite.new
  419.     @rim_sprite.bitmap = Cache.system(bitmap) if bitmap
  420.     @rim_sprite.x = x; @rim_sprite.y = y
  421.     @rim_sprite.z = @background_sprite.z
  422.   end
  423.   #--------------------------------------------------------------------------
  424.   # ● 释放次背景图片
  425.   #--------------------------------------------------------------------------
  426.   def dispose_rim
  427.     return if !@rim_sprite
  428.     @rim_sprite.bitmap.dispose
  429.     @rim_sprite.dispose
  430.   end
  431.   #--------------------------------------------------------------------------
  432.   # ● 生成立绘精灵
  433.   #--------------------------------------------------------------------------
  434.   def create_actor_cg
  435.     v = EASY_MENU_SET::CG
  436.     return unless v[0]
  437.     @actor_cg = Sprite.new
  438.     @actor_cg.bitmap = Cache.system(v[0])
  439.     @actor_cg.x = v[1] + 2 * 7
  440.     @actor_cg.y = v[2]
  441.   end
  442.   #--------------------------------------------------------------------------
  443.   # ● 立绘的坐标判断
  444.   #--------------------------------------------------------------------------
  445.   def cg_x
  446.     v = EASY_MENU_SET::CG
  447.     return v[3] if v[4] == :l
  448.     return -(v[3]) if v[4] == :r
  449.     return 0
  450.   end
  451.   #--------------------------------------------------------------------------
  452.   # ● 释放立绘精灵
  453.   #--------------------------------------------------------------------------
  454.   def dispose_actor_cg
  455.     return if !@actor_cg
  456.     @actor_cg.bitmap.dispose
  457.     @actor_cg.dispose
  458.   end
  459.   #--------------------------------------------------------------------------
  460.   # ● 展开动画的预设坐标
  461.   #--------------------------------------------------------------------------
  462.   def set_menu_xy
  463.     v = EASY_MENU_SET::CG
  464.     xx = 0
  465.     xx = -(EASY_MENU_SET::TIME * v[3]) if v[4] == :l
  466.     xx = EASY_MENU_SET::TIME * v[3] if v[4] == :r
  467.     @actor_cg.x = v[1] + xx
  468.     @actor_cg.opacity = 0
  469.     @rim_sprite.opacity = 0 if @rim_sprite
  470.   end
  471.   #--------------------------------------------------------------------------
  472.   # ● 重绘内用小标题
  473.   #--------------------------------------------------------------------------
  474.   def create_sub_button
  475.     @sub_window = Window_MenuCommand.new(true)
  476.     @sub_window.z = 300
  477.   end
  478.   #--------------------------------------------------------------------------
  479.   # ● 释放内用小标题
  480.   #--------------------------------------------------------------------------
  481.   def dispose_sub_button
  482.     @sub_window.dispose if @sub_window
  483.   end
  484. end

  485. #==============================================================================
  486. # ■ Scene_Menu
  487. #==============================================================================
  488. class Scene_Menu < Scene_MenuBase
  489.   #--------------------------------------------------------------------------
  490.   # ● 开始处理
  491.   #--------------------------------------------------------------------------
  492.   def start
  493.     super
  494.     v = EASY_MENU_SET::MENU_RIM
  495.     create_rim_background(v[0], v[1], v[2]) if v[0]
  496.     create_actor_cg
  497.     create_command_window
  498.     set_menu_xy
  499.     @sub_show = false
  500.   end
  501.   #--------------------------------------------------------------------------
  502.   # ● 开始后处理
  503.   #--------------------------------------------------------------------------
  504.   def post_start
  505.     super
  506.     @command_window.show = true
  507.     begin
  508.       @actor_cg.x += cg_x
  509.       @actor_cg.opacity += (255 / EASY_MENU_SET::TIME)
  510.       @rim_sprite.opacity += (255 / EASY_MENU_SET::TIME) if @rim_sprite
  511.       @command_window.open_button_window
  512.       Graphics.update
  513.     end until @command_window.show == false
  514.     @command_window.activate
  515.     @actor_cg.opacity = 255
  516.   end
  517.   #--------------------------------------------------------------------------
  518.   # ● 结束前处理
  519.   #--------------------------------------------------------------------------
  520.   def pre_terminate
  521.     super
  522.     t = 0
  523.     @command_window.show = true
  524.     begin
  525.       if @sub_show
  526.         t += 1 if t <= 6
  527.         @actor_cg.x += 2 if t <= 6
  528.         @command_window.close_window_to_sub
  529.       else
  530.         @actor_cg.x += -(cg_x)
  531.         @actor_cg.opacity -= 255 / EASY_MENU_SET::TIME
  532.         @rim_sprite.opacity -= 255 / EASY_MENU_SET::TIME if @rim_sprite
  533.         @command_window.close_button_window
  534.       end
  535.       Graphics.update
  536.     end until @command_window.show == false
  537.   end
  538.   #--------------------------------------------------------------------------
  539.   # ● 生成指令窗口
  540.   #--------------------------------------------------------------------------
  541.   def create_command_window
  542.     v = EASY_MENU_SET::BUTTON
  543.     @command_window = Window_MenuCommand.new
  544.     for i in 0...EASY_MENU_SET::BUTTON.size
  545.       type = :command_item     if v[i][4] == :item
  546.       type = :command_key_item if v[i][4] == :key_item
  547.       type = :command_save     if v[i][4] == :save
  548.       type = :command_load     if v[i][4] == :continue
  549.       type = :command_game_end if v[i][4] == :game_end
  550.       @command_window.set_handler(v[i][4], method(type)) if v[i][0]
  551.     end
  552.     @command_window.set_handler(:cancel,    method(:return_scene))
  553.   end
  554.   #--------------------------------------------------------------------------
  555.   # ● 指令“物品”
  556.   #--------------------------------------------------------------------------
  557.   def command_item
  558.     @sub_show = true
  559.     SceneManager.call(Scene_Item)
  560.     SceneManager.scene.prepare(:item)
  561.   end
  562.   #--------------------------------------------------------------------------
  563.   # ● 指令“贵重物品”
  564.   #--------------------------------------------------------------------------
  565.   def command_key_item
  566.     @sub_show = true
  567.     SceneManager.call(Scene_Item)
  568.     SceneManager.scene.prepare(:key_item)
  569.   end
  570.   #--------------------------------------------------------------------------
  571.   # ● 指令“存档”
  572.   #--------------------------------------------------------------------------
  573.   def command_save
  574.     @sub_show = true
  575.     SceneManager.call(Scene_Save)
  576.   end
  577.   #--------------------------------------------------------------------------
  578.   # ● 指令“读档”
  579.   #--------------------------------------------------------------------------
  580.   def command_load
  581.     @sub_show = true
  582.     SceneManager.call(Scene_Load)
  583.   end
  584. end



  585. #==============================================================================
  586. # ■ SceneManager
  587. #==============================================================================
  588. module SceneManager
  589.   #--------------------------------------------------------------------------
  590.   # ● 模块的实例变量
  591.   #--------------------------------------------------------------------------
  592.   @save_bitmap = nil                # 存档用截图
  593.   #--------------------------------------------------------------------------
  594.   # ● 生成背景用的场景截图
  595.   #--------------------------------------------------------------------------
  596.   def self.snapshot_for_background(bitmap_blue = true)
  597.     @background_bitmap.dispose if @background_bitmap
  598.     @background_bitmap = Graphics.snap_to_bitmap
  599.     @background_bitmap.blur if bitmap_blue
  600.   end
  601.   #--------------------------------------------------------------------------
  602.   # ● 生成存档内的截图
  603.   #--------------------------------------------------------------------------
  604.   def self.snapshot_for_save_bitmap
  605.     v = EASY_MENU_SET::FILES_DETAILS_DATA
  606.     @save_bitmap.dispose if @save_bitmap
  607.     @save_bitmap = Bitmap.new(v[0][3], v[0][4])
  608.     rect = Rect.new(0, 0, v[0][3], v[0][4])
  609.     rect.x = $game_player.screen_x - rect.width / 2
  610.     rect.y = $game_player.screen_y - rect.height / 2 - 12
  611.     bitmap = Graphics.snap_to_bitmap
  612.     @save_bitmap.blt(0, 0, bitmap, rect)
  613.     bitmap.dispose
  614.   end
  615.   #--------------------------------------------------------------------------
  616.   # ● 获取存档内的截图
  617.   #--------------------------------------------------------------------------
  618.   def self.saves_bitmap
  619.     @save_bitmap
  620.   end
  621. end

  622. #==============================================================================
  623. # ■ Scene_Map
  624. #==============================================================================
  625. class Scene_Map < Scene_Base
  626.   #--------------------------------------------------------------------------
  627.   # ● 结束处理
  628.   #--------------------------------------------------------------------------
  629.   def terminate
  630.     super
  631.     type = EASY_MENU_SET::BACKGROUND[4]
  632.     type = true if SceneManager.scene_is?(Scene_Battle)
  633.     SceneManager.snapshot_for_background(type)
  634.     SceneManager.snapshot_for_save_bitmap
  635.     dispose_spriteset
  636.     perform_battle_transition if SceneManager.scene_is?(Scene_Battle)
  637.   end
  638. end


  639. #==============================================================================
  640. # ★ 物品界面
  641. #==============================================================================
  642. #==============================================================================
  643. # ■ Window_ItemList
  644. #==============================================================================
  645. class Window_ItemList < Window_Selectable
  646.   #--------------------------------------------------------------------------
  647.   # ● 初始化对象
  648.   #--------------------------------------------------------------------------
  649.   def initialize(x, y, width, height)
  650.     super
  651.     self.windowskin = Cache.system(EASY_MENU_SET::SKIN)
  652.     self.opacity = EASY_MENU_SET::ITEMLIST[2]
  653.     @category = :none
  654.     @data = []
  655.   end
  656.   #--------------------------------------------------------------------------
  657.   # ● 获取标准的边距尺寸
  658.   #--------------------------------------------------------------------------
  659.   def standard_padding
  660.     return 16
  661.   end
  662.   #--------------------------------------------------------------------------
  663.   # ● 获取列数
  664.   #--------------------------------------------------------------------------
  665.   def col_max
  666.     return 1
  667.   end
  668.   #--------------------------------------------------------------------------
  669.   # ● 绘制项目
  670.   #--------------------------------------------------------------------------
  671.   alias easy_menu_draw_item draw_item
  672.   def draw_item(index)
  673.     easy_menu_font
  674.     easy_menu_draw_item(index)
  675.   end
  676.   #--------------------------------------------------------------------------
  677.   # ● 绘制物品个数
  678.   #--------------------------------------------------------------------------
  679.   def draw_item_number(rect, item)
  680.     return if $game_party.item_number(item) <= 1
  681.     draw_text(rect, sprintf("%02d", $game_party.item_number(item)), 2)
  682.   end
  683.   #--------------------------------------------------------------------------
  684.   # ● 绘制物品名称
  685.   #     enabled : 有效的标志。false 的时候使用半透明效果绘制
  686.   #--------------------------------------------------------------------------
  687.   def draw_item_name(item, x, y, enabled = true, width = 172)
  688.     return unless item
  689.     draw_icon(item.icon_index, x, y, enabled)
  690.     change_color(normal_color, enabled)
  691.     draw_text_ex(x + 24, y, item.name)
  692.     #draw_text(x + 24, y, width, line_height, item.name)
  693.   end
  694.   #--------------------------------------------------------------------------
  695.   # ● 重置字体设置
  696.   #--------------------------------------------------------------------------
  697.   def reset_font_settings
  698.     change_color(normal_color)
  699.     easy_menu_font
  700.   end
  701.   #--------------------------------------------------------------------------
  702.   # ● 更新帮助内容
  703.   #--------------------------------------------------------------------------
  704.   def update_help
  705.     @help_window.set_item(item)
  706.     @big_icon.set_item(item.big_icon) if EASY_MENU_SET::BIGICON[0]
  707.   end
  708.   #--------------------------------------------------------------------------
  709.   # ● 设置物品窗口
  710.   #--------------------------------------------------------------------------
  711.   def big_icon=(big_icon)
  712.     @big_icon = big_icon
  713.     update
  714.   end
  715. end

  716. #==============================================================================
  717. # ■ BIG ICON
  718. #==============================================================================
  719. module Cache
  720.   def self.bigicon(filename)
  721.     load_bitmap(EASY_MENU_SET::BIGICON_Cache, filename)
  722.   end
  723. end

  724. #==============================================================================
  725. # ■ RPG::BaseItem
  726. #==============================================================================
  727. class RPG::BaseItem
  728.   #--------------------------------------------------------------------------
  729.   # ● 获取大图标
  730.   #--------------------------------------------------------------------------
  731.   def big_icon
  732.     self.note =~ /\<BigIcon (\w+)\>/i
  733.     $1.nil? ? "" : $1
  734.   end
  735. end

  736. #==============================================================================
  737. # ■ Window_Big_icon
  738. #==============================================================================
  739. class Window_Big_icon < Window_Base
  740.   #--------------------------------------------------------------------------
  741.   # ● 初始化对象
  742.   #--------------------------------------------------------------------------
  743.   def initialize(x, y, width, height)
  744.     super(x, y, width, height)
  745.     self.windowskin = Cache.system(EASY_MENU_SET::SKIN)
  746.     self.opacity = EASY_MENU_SET::BIGICON[6]
  747.   end
  748.   #--------------------------------------------------------------------------
  749.   # ● 设置内容
  750.   #--------------------------------------------------------------------------
  751.   def set_item(icon)
  752.     if icon != @icon
  753.       contents.clear
  754.       bitmap = Cache.bigicon(icon)
  755.       x = (contents.width - bitmap.width) / 2
  756.       y = (contents.height - bitmap.height) / 2
  757.       rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  758.       contents.blt(x, y, bitmap, rect)
  759.       @icon = icon
  760.     end
  761.   end
  762. end

  763. #==============================================================================
  764. # ■ Scene_ItemBase
  765. #==============================================================================
  766. class Scene_ItemBase < Scene_MenuBase
  767.   #--------------------------------------------------------------------------
  768.   # ● 生成角色窗口
  769.   #--------------------------------------------------------------------------
  770.   def create_actor_window
  771.     @actor_window = Window_MenuActor.new
  772.     @actor_window.set_handler(:ok,     method(:on_actor_ok))
  773.     @actor_window.set_handler(:cancel, method(:on_actor_cancel))
  774.   end
  775.   #--------------------------------------------------------------------------
  776.   # ● 显示子窗口
  777.   #--------------------------------------------------------------------------
  778.   alias easy_menu_show_sub_window show_sub_window
  779.   def show_sub_window(window)
  780.     window.y = (Graphics.height - @actor_window.height) / 2
  781.     easy_menu_show_sub_window(window)
  782.     @actor_window.z = 200
  783.   end
  784. end

  785. #==============================================================================
  786. # ■ Scene_Item
  787. #==============================================================================
  788. class Scene_Item < Scene_ItemBase
  789.   #--------------------------------------------------------------------------
  790.   # ● 预处理
  791.   #--------------------------------------------------------------------------
  792.   def prepare(mode = :item)
  793.     @mode = mode
  794.   end
  795.   #--------------------------------------------------------------------------
  796.   # ● 开始处理
  797.   #--------------------------------------------------------------------------
  798.   def start
  799.     super
  800.     v = EASY_MENU_SET::ITEM_RIM
  801.     create_rim_background(v[0], v[1], v[2]) if v[0]
  802.     create_actor_cg unless EASY_MENU_SET::BIGICON[0]
  803.     create_help_window
  804.     create_big_icon_window if EASY_MENU_SET::BIGICON[0]
  805.     create_item_window
  806.     create_sub_button
  807.   end
  808.   #--------------------------------------------------------------------------
  809.   # ● 生成物品窗口
  810.   #--------------------------------------------------------------------------
  811.   def create_item_window
  812.     sp = EASY_MENU_SET::COMMAND[1]
  813.     iy = sp + EASY_MENU_SET::COMMAND[3] - 8
  814.     ih = Graphics.height - @help_window.height - sp - iy
  815.     @item_window = Window_ItemList.new(sp, iy, @help_window.width, ih)
  816.     @item_window.category = @mode
  817.     @item_window.viewport = @viewport
  818.     @item_window.help_window = @help_window
  819.     @item_window.big_icon = @big_icon_window if EASY_MENU_SET::BIGICON[0]
  820.     @item_window.set_handler(:ok,     method(:on_item_ok))
  821.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  822.     @item_window.index = 0
  823.     @item_window.activate
  824.   end
  825.   #--------------------------------------------------------------------------
  826.   # ● 生成帮助窗口
  827.   #--------------------------------------------------------------------------
  828.   def create_help_window
  829.     sp = EASY_MENU_SET::COMMAND[1]
  830.     v = EASY_MENU_SET::ITEMLIST
  831.     w = v[0] > 0 ? v[0] : (Graphics.width / 2 - sp)
  832.     @help_window = Window_Help.new(v[1], w)
  833.     @help_window.viewport = @viewport
  834.     @help_window.x = sp
  835.     @help_window.y = Graphics.height - @help_window.height - sp
  836.   end
  837.   #--------------------------------------------------------------------------
  838.   # ● 生成物品大图标
  839.   #--------------------------------------------------------------------------
  840.   def create_big_icon_window
  841.     sp = EASY_MENU_SET::COMMAND[1]
  842.     v = EASY_MENU_SET::BIGICON
  843.     b = []
  844.     if v[1]
  845.       b[0] = @help_window.width + sp
  846.       b[1] = sp + EASY_MENU_SET::COMMAND[3] - 8
  847.       b[2] = Graphics.width - b[0] - sp
  848.       b[3] = Graphics.height - b[1] - sp
  849.     else
  850.       b = [v[2], v[3], v[4], v[5]]
  851.     end
  852.     @big_icon_window = Window_Big_icon.new(b[0], b[1], b[2], b[3])
  853.     @big_icon_window.viewport = @viewport
  854.   end
  855.   #--------------------------------------------------------------------------
  856.   # ● 物品“取消”
  857.   #--------------------------------------------------------------------------
  858.   def on_item_cancel
  859.     @item_window.unselect
  860.     return_scene
  861.   end
  862. end


  863. #==============================================================================
  864. # ★ 存档界面
  865. #==============================================================================
  866. #==============================================================================
  867. # ■ Window_SaveFileList
  868. #------------------------------------------------------------------------------
  869. #  存档的选项窗口(左)
  870. #==============================================================================
  871. class Window_SaveFileList < Window_Selectable
  872.   #--------------------------------------------------------------------------
  873.   # ● 初始化对象
  874.   #--------------------------------------------------------------------------
  875.   def initialize(x, y, width, height)
  876.     super
  877.     self.windowskin = Cache.system(EASY_MENU_SET::SKIN)
  878.     self.opacity = EASY_MENU_SET::FILESLIST[4]
  879.     @symbol = nil
  880.     refresh
  881.     activate
  882.   end
  883.   #--------------------------------------------------------------------------
  884.   # ● 获取可显示的存档数目
  885.   #--------------------------------------------------------------------------
  886.   def visible_max
  887.     return EASY_MENU_SET::FILESLIST[1]
  888.   end
  889.   #--------------------------------------------------------------------------
  890.   # ● 获取项目的高度
  891.   #--------------------------------------------------------------------------
  892.   def item_height
  893.     (height - standard_padding * 2) / visible_max
  894.   end
  895.   #--------------------------------------------------------------------------
  896.   # ● 存档数量最大值
  897.   #--------------------------------------------------------------------------
  898.   def item_max
  899.     return EASY_MENU_SET::FILES_MAX
  900.   end
  901.   #--------------------------------------------------------------------------
  902.   # ● 绘制项目
  903.   #--------------------------------------------------------------------------
  904.   def draw_item(index)
  905.     header = DataManager.load_header(index)
  906.     rect = item_rect_for_text(index)
  907.     ry = (item_height - line_height) / 2
  908.     easy_menu_font
  909.     v = EASY_MENU_SET::FILESLIST
  910.     change_color(Color.new(v[3][0][0], v[3][0][1], v[3][0][2]), header)
  911.     icon_id = header ? v[2][1] : v[2][0]
  912.     draw_icon(icon_id, rect.x + 4, rect.y + ry)
  913.     text = @symbol == :save ? EASY_MENU_SET::SAVING : EASY_MENU_SET::LOADING
  914.     ing = @index == index && @symbol
  915.     name = ing ? text : (Vocab::File + " #{index + 1}")
  916.     draw_text(rect.x + 28, rect.y + ry, rect.width, line_height, name)
  917.     change_color(Color.new(v[3][1][0], v[3][1][1], v[3][1][2]), header)
  918.     draw_playtime(header, rect.x - 4, rect.y + ry, rect.width, 2)
  919.   end
  920.   #--------------------------------------------------------------------------
  921.   # ● 绘制游戏时间
  922.   #--------------------------------------------------------------------------
  923.   def draw_playtime(header, x, y, width, align)
  924.     text = header ? header[:playtime_s] : "—:—:—"
  925.     draw_text(x, y, width, line_height, text, 2)
  926.   end
  927.   #--------------------------------------------------------------------------
  928.   # ● 设置选择状态
  929.   #--------------------------------------------------------------------------
  930.   def set_files(symbol)
  931.     @symbol = symbol
  932.     refresh
  933.   end
  934. end


  935. #==============================================================================
  936. # ■ Window_FilesDetails
  937. #------------------------------------------------------------------------------
  938. #  存档的详细窗口(右)
  939. #==============================================================================
  940. class Window_FilesDetails < Window_Base
  941.   #--------------------------------------------------------------------------
  942.   # ● 初始化对象
  943.   #--------------------------------------------------------------------------
  944.   def initialize(x, y, width, height)
  945.     super(x, y, width, height)
  946.     self.windowskin = Cache.system(EASY_MENU_SET::SKIN)
  947.     self.opacity = EASY_MENU_SET::FILES_DETAILS[6]
  948.     @bitmaps = []
  949.     @header = []
  950.   end
  951.   #--------------------------------------------------------------------------
  952.   # ● 释放
  953.   #--------------------------------------------------------------------------
  954.   def dispose
  955.     for bitmap in @bitmaps
  956.       next if bitmap == nil or bitmap.disposed?
  957.       bitmap.dispose
  958.     end
  959.     super
  960.   end
  961.   #--------------------------------------------------------------------------
  962.   # ● 设置选择状态
  963.   #--------------------------------------------------------------------------
  964.   def set_select(select)
  965.     return if @select == select
  966.     @select = select
  967.     refresh(@select)
  968.   end
  969.   #--------------------------------------------------------------------------
  970.   # ● 读取文件
  971.   #--------------------------------------------------------------------------
  972.   def read_save_data(index)
  973.     @header[index] = DataManager.load_header(index)
  974.     @bitmaps[index].dispose if @bitmaps[index]
  975.     return unless EASY_MENU_SET::FILES_DETAILS_DATA[0][0]
  976.     @bitmaps[index] = DataManager.load_save_bitmap(index)
  977.   end
  978.   #--------------------------------------------------------------------------
  979.   # ● 刷新
  980.   #--------------------------------------------------------------------------
  981.   def refresh(index)
  982.     contents.clear
  983.     read_save_data(index)
  984.     v = EASY_MENU_SET::FILES_DETAILS_DATA
  985.     draw_background(@header[index], v)
  986.     return unless @header[index]
  987.     draw_save_bitmap(@header[index], index, v)
  988.     draw_party_characters(@header[index], index, v)
  989.     draw_party_faces(@header[index], index, v)
  990.   end
  991.   #--------------------------------------------------------------------------
  992.   # ● 绘制 底图
  993.   #--------------------------------------------------------------------------
  994.   def draw_background(header, v)
  995.     return unless v[3][0]
  996.     return if (!header && v[3][1] == false)
  997.     bitmap = Cache.system(v[3][2])
  998.     contents.blt(v[3][3], v[3][4], bitmap, Rect.new(0, 0, v[3][5], v[3][6]))
  999.   end
  1000.   #--------------------------------------------------------------------------
  1001.   # ● 绘制截图
  1002.   #--------------------------------------------------------------------------
  1003.   def draw_save_bitmap(header, index, v)
  1004.     return unless v[0][0]
  1005.     bitmap = @bitmaps[index]
  1006.     #bx = (width - standard_padding * 2 - bitmap.width) / 2
  1007.     contents.blt(v[0][1], v[0][2], bitmap, bitmap.rect)
  1008.   end
  1009.   #--------------------------------------------------------------------------
  1010.   # ● 绘制队伍角色行走图
  1011.   #--------------------------------------------------------------------------
  1012.   def draw_party_characters(header, index, v)
  1013.     return unless v[1][0]
  1014.     x = v[1][1]
  1015.     y = v[1][2]
  1016.     header[:characters].each_with_index do |data, i|
  1017.       draw_character(data[0], data[1], x + i * 48, y)
  1018.     end
  1019.   end
  1020.   #--------------------------------------------------------------------------
  1021.   # ● 绘制队伍角色脸谱
  1022.   #--------------------------------------------------------------------------
  1023.   def draw_party_faces(header, index, v)
  1024.     return unless v[2][0]
  1025.     x = v[2][1]
  1026.     y = v[2][2]
  1027.     header[:characters].each_with_index do |data, i|
  1028.       bit = Cache.face(data[2])
  1029.       rx = bit.width / 4
  1030.       draw_face(data[2], data[3], x + i * rx, y)
  1031.     end
  1032.   end
  1033.   #--------------------------------------------------------------------------
  1034.   # ● 绘制角色肖像图
  1035.   #     enabled : 有效的标志。false 的时候使用半透明效果绘制
  1036.   #--------------------------------------------------------------------------
  1037.   def draw_face(face_name, face_index, x, y, enabled = true)
  1038.     bitmap = Cache.face(face_name)
  1039.     w = bitmap.width / 4
  1040.     h = bitmap.height / 2
  1041.     rect = Rect.new(face_index % 4 * w, face_index / 4 * h, w, h)
  1042.     contents.blt(x + 4, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  1043.     bitmap.dispose
  1044.   end
  1045. end

  1046. #==============================================================================
  1047. # ■ Scene_File
  1048. #==============================================================================
  1049. class Scene_File < Scene_MenuBase
  1050.   #--------------------------------------------------------------------------
  1051.   # ● 开始处理
  1052.   #--------------------------------------------------------------------------
  1053.   def start
  1054.     super
  1055.     v = EASY_MENU_SET::FILES_RIM
  1056.     create_rim_background(v[0], v[1], v[2]) if v[0]
  1057.     create_actor_cg unless EASY_MENU_SET::FILES_DETAILS[0]
  1058.     create_help_window if EASY_MENU_SET::FILESLIST[5]
  1059.     create_savefile_windows
  1060.     create_details_window if EASY_MENU_SET::FILES_DETAILS[0]
  1061.     create_sub_button
  1062.     init_selection
  1063.   end
  1064.   #--------------------------------------------------------------------------
  1065.   # ● 结束处理
  1066.   #--------------------------------------------------------------------------
  1067.   def terminate
  1068.     super
  1069.   end
  1070.   #--------------------------------------------------------------------------
  1071.   # ● 更新画面
  1072.   #--------------------------------------------------------------------------
  1073.   def update
  1074.     super
  1075.     @details_window.set_select(@savefile_window.index) if @details_window
  1076.   end
  1077.   #--------------------------------------------------------------------------
  1078.   # ● 生成帮助窗口
  1079.   #--------------------------------------------------------------------------
  1080.   def create_help_window
  1081.     sp = EASY_MENU_SET::COMMAND[1]
  1082.     v = EASY_MENU_SET::FILESLIST
  1083.     w = v[0] > 0 ? v[0] : (Graphics.width / 2 - sp)
  1084.     @help_window = Window_Help.new(1, w)
  1085.     @help_window.set_text(help_window_text)
  1086.     @help_window.x = sp
  1087.     @help_window.y = sp + EASY_MENU_SET::COMMAND[3] - 8
  1088.   end
  1089.   #--------------------------------------------------------------------------
  1090.   # ● 获取帮助窗口的文本
  1091.   #--------------------------------------------------------------------------
  1092.   def help_window_text
  1093.     return ""
  1094.   end
  1095.   #--------------------------------------------------------------------------
  1096.   # ● 生成存档文件窗口
  1097.   #--------------------------------------------------------------------------
  1098.   def create_savefile_windows
  1099.     sp = EASY_MENU_SET::COMMAND[1]
  1100.     hy = sp + EASY_MENU_SET::COMMAND[3] - 8
  1101.     sy = @help_window ? (@help_window.y + @help_window.height) : hy
  1102.     v = EASY_MENU_SET::FILESLIST
  1103.     sw = v[0] > 0 ? v[0] : (Graphics.width / 2 - sp)
  1104.     sh = Graphics.height - sy - sp
  1105.     @savefile_window = Window_SaveFileList.new(sp, sy, sw, sh)
  1106.     @savefile_window.set_handler(:ok,     method(:on_savefile_ok))
  1107.     @savefile_window.set_handler(:cancel, method(:on_savefile_cancel))
  1108.   end
  1109.   #--------------------------------------------------------------------------
  1110.   # ● 生成详细文件窗口
  1111.   #--------------------------------------------------------------------------
  1112.   def create_details_window
  1113.     sp = EASY_MENU_SET::COMMAND[1]
  1114.     v = EASY_MENU_SET::FILES_DETAILS
  1115.     d = []
  1116.     if v[1]
  1117.       d[0] = @savefile_window.width + sp
  1118.       d[1] = @help_window.y
  1119.       d[2] = Graphics.width - d[0] - sp
  1120.       d[3] = Graphics.height - d[1] - sp
  1121.     else
  1122.       d = [v[2], v[3], v[4], v[5]]
  1123.     end
  1124.     @details_window = Window_FilesDetails.new(d[0], d[1], d[2], d[3])
  1125.   end
  1126.   #--------------------------------------------------------------------------
  1127.   # ● 初始化选择状态
  1128.   #--------------------------------------------------------------------------
  1129.   def init_selection
  1130.     index = first_savefile_index
  1131.     @savefile_window.select(index)
  1132.     @details_window.set_select(index) if @details_window
  1133.   end
  1134. end


  1135. #==============================================================================
  1136. # ■ Scene_Save
  1137. #==============================================================================
  1138. class Scene_Save < Scene_File
  1139.   #--------------------------------------------------------------------------
  1140.   # ● 开始处理
  1141.   #--------------------------------------------------------------------------
  1142.   def start
  1143.     Window_MenuCommand::init_command_position(:save)
  1144.     super
  1145.   end
  1146.   #--------------------------------------------------------------------------
  1147.   # ● 确定存档文件
  1148.   #--------------------------------------------------------------------------
  1149.   def on_savefile_ok
  1150.     super
  1151.     if DataManager.save_game(@savefile_window.index)
  1152.       on_save_success
  1153.     else
  1154.       Sound.play_buzzer
  1155.     end
  1156.   end
  1157.   #--------------------------------------------------------------------------
  1158.   # ● 存档成功时的处理
  1159.   #--------------------------------------------------------------------------
  1160.   def on_save_success
  1161.     Sound.play_save
  1162.     @savefile_window.set_files(:save)
  1163.     @details_window.refresh(@savefile_window.index) if @details_window
  1164.     Graphics.wait(30)
  1165.     if EASY_MENU_SET::FILES_RETURN
  1166.       return_scene
  1167.     else
  1168.       @savefile_window.set_files(nil)
  1169.       @savefile_window.activate
  1170.     end
  1171.   end
  1172. end


  1173. #==============================================================================
  1174. # ■ Scene_Load
  1175. #==============================================================================
  1176. class Scene_Load < Scene_File
  1177.   #--------------------------------------------------------------------------
  1178.   # ● 开始处理
  1179.   #--------------------------------------------------------------------------
  1180.   def start
  1181.     Window_MenuCommand::init_command_position(:continue)
  1182.     super
  1183.   end
  1184.   #--------------------------------------------------------------------------
  1185.   # ● 确定读档文件
  1186.   #--------------------------------------------------------------------------
  1187.   def on_savefile_ok
  1188.     super
  1189.     if DataManager.load_game(@savefile_window.index)
  1190.       on_load_success
  1191.     else
  1192.       Sound.play_buzzer
  1193.     end
  1194.   end
  1195.   #--------------------------------------------------------------------------
  1196.   # ● 读档成功时的处理
  1197.   #--------------------------------------------------------------------------
  1198.   def on_load_success
  1199.     Sound.play_load
  1200.     @savefile_window.set_files(:continue)
  1201.     Graphics.wait(20)
  1202.     fadeout_all
  1203.     $game_system.on_after_load
  1204.     SceneManager.goto(Scene_Map)
  1205.   end
  1206. end


  1207. #==============================================================================
  1208. # ■ DataManager
  1209. #==============================================================================
  1210. module DataManager
  1211.   #--------------------------------------------------------------------------
  1212.   # ● 判定存档文件是否存在
  1213.   #--------------------------------------------------------------------------
  1214.   def self.save_file_exists?
  1215.     if savefile_folder == ""
  1216.       text = 'Save*.rvdata2'
  1217.     else
  1218.       text = savefile_folder + '/Save*.rvdata2'
  1219.     end
  1220.     !Dir.glob(text).empty?
  1221.   end
  1222.   #--------------------------------------------------------------------------
  1223.   # ● 存档文件的最大数
  1224.   #--------------------------------------------------------------------------
  1225.   def self.savefile_max
  1226.     max = EASY_MENU_SET::FILES_MAX ? EASY_MENU_SET::FILES_MAX : 16
  1227.     return max
  1228.   end
  1229.   #--------------------------------------------------------------------------
  1230.   # ● 生成父文件夹
  1231.   #--------------------------------------------------------------------------
  1232.   def self.savefile_folder
  1233.     return EASY_MENU_SET::FILES_NAME
  1234.   end
  1235.   #--------------------------------------------------------------------------
  1236.   # ● 生成文件名
  1237.   #     index : 文件索引
  1238.   #--------------------------------------------------------------------------
  1239.   def self.make_filename(index)
  1240.     filename = sprintf("Save%02d.rvdata2", index + 1)
  1241.     if savefile_folder == ""
  1242.       return filename
  1243.     else
  1244.       return savefile_folder + "/" + filename
  1245.     end
  1246.   end
  1247.   #--------------------------------------------------------------------------
  1248.   # ● 生成截图
  1249.   #--------------------------------------------------------------------------
  1250.   def self.make_save_bitmap
  1251.     bitmap = set_bitmap_array(SceneManager.saves_bitmap)
  1252.     bitmap
  1253.   end
  1254.   #--------------------------------------------------------------------------
  1255.   # ● 获取截图
  1256.   #--------------------------------------------------------------------------
  1257.   def self.load_save_bitmap(index)
  1258.     begin
  1259.       File.open(make_filename(index), "rb") do |file|
  1260.         Marshal.load(file)
  1261.         return read_bitmap_array(Marshal.load(file))
  1262.       end
  1263.     rescue
  1264.       return nil
  1265.     end
  1266.   end
  1267.   #--------------------------------------------------------------------------
  1268.   # ● 制作截图文件 by 老鹰
  1269.   #--------------------------------------------------------------------------
  1270.   def self.set_bitmap_array(bitmap)
  1271.     data = []
  1272.     bitmap.height.times do |i| # 行号
  1273.       data[i] = []
  1274.       bitmap.width.times do |j| # 列号
  1275.         color = bitmap.get_pixel(j, i)
  1276.         data[i][j] = [color.red, color.green, color.blue]
  1277.       end
  1278.     end
  1279.     data
  1280.   end
  1281.   #--------------------------------------------------------------------------
  1282.   # ● 获取截图文件 by 老鹰
  1283.   #--------------------------------------------------------------------------
  1284.   def self.read_bitmap_array(array)
  1285.     h = array.size # 行数
  1286.     w = array[0].size # 列数
  1287.     bitmap = Bitmap.new(w, h)
  1288.     h.times do |i|
  1289.       w.times do |j|
  1290.         data = array[i][j]
  1291.         color = Color.new(data[0], data[1], data[2])
  1292.         bitmap.set_pixel(j, i, color)
  1293.       end
  1294.     end
  1295.     bitmap
  1296.   end
  1297.   #--------------------------------------------------------------------------
  1298.   # ● 执行存档(没有错误处理)
  1299.   #--------------------------------------------------------------------------
  1300.   def self.save_game_without_rescue(index)
  1301.     unless FileTest.directory?(savefile_folder)
  1302.       Dir::mkdir(savefile_folder)
  1303.     end
  1304.     File.open(make_filename(index), "wb") do |file|
  1305.       $game_system.on_before_save
  1306.       Marshal.dump(make_save_header, file)
  1307.       Marshal.dump(make_save_bitmap, file)
  1308.       Marshal.dump(make_save_contents, file)
  1309.       @last_savefile_index = index
  1310.     end
  1311.     return true
  1312.   end
  1313.   #--------------------------------------------------------------------------
  1314.   # ● 执行读档(没有错误处理)
  1315.   #--------------------------------------------------------------------------
  1316.   def self.load_game_without_rescue(index)
  1317.     File.open(make_filename(index), "rb") do |file|
  1318.       Marshal.load(file)
  1319.       Marshal.load(file)
  1320.       extract_save_contents(Marshal.load(file))
  1321.       reload_map_if_updated
  1322.       @last_savefile_index = index
  1323.     end
  1324.     return true
  1325.   end
  1326. end

  1327. #==============================================================================
  1328. # ■ Game_Party
  1329. #==============================================================================
  1330. class Game_Party < Game_Unit
  1331.   #--------------------------------------------------------------------------
  1332.   # ● 存档文件显示用的角色图像信息
  1333.   #--------------------------------------------------------------------------
  1334.   def characters_for_savefile
  1335.     battle_members.collect do |actor|
  1336.       [actor.character_name, actor.character_index,
  1337.        actor.face_name, actor.face_index]
  1338.     end
  1339.   end
  1340. end


  1341. #==============================================================================
  1342. # ■ Window_MenuStatus
  1343. #==============================================================================
  1344. class Window_MenuStatus < Window_Selectable
  1345.   #--------------------------------------------------------------------------
  1346.   # ● 获取窗口的宽度
  1347.   #--------------------------------------------------------------------------
  1348.   def window_width
  1349.     Graphics.width - 160 - 96
  1350.   end
  1351.   #--------------------------------------------------------------------------
  1352.   # ● 获取窗口的高度
  1353.   #--------------------------------------------------------------------------
  1354.   def window_height
  1355.     Graphics.height > 416 ? 416 : Graphics.height
  1356.   end
  1357. end

  1358. #==============================================================================
  1359. # ■ Window_GameEnd
  1360. #==============================================================================
  1361. class Window_GameEnd < Window_Command
  1362.   #--------------------------------------------------------------------------
  1363.   # ● 初始化对象
  1364.   #--------------------------------------------------------------------------
  1365.   alias easy_menu_initialize initialize
  1366.   def initialize
  1367.     easy_menu_initialize
  1368.     self.windowskin = Cache.system(EASY_MENU_SET::SKIN)
  1369.   end
  1370. end
复制代码
...........
回复

使用道具 举报

梦石
0
星屑
65
在线时间
3 小时
注册时间
2020-7-20
回帖
5
 楼主| 发表于 2021-4-4 22:28:46 | 显示全部楼层
PLeaseS 发表于 2021-2-16 07:14
禁用存档,然后事件写一个?
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ◇ CONG'S EASY MENU ◇ 葱式解谜用简易菜单
  4. #------------------------------------------------------------------------------
  5. # By Conwsbn
  6. # http://congrm.lofter.com/
  7. #==============================================================================

  8. $imported = {} if $imported.nil?
  9. $imported[:congs_easy_menu] = true

  10. #==============================================================================
  11. # ■ Window_Base
  12. #==============================================================================
  13. class Window_Base < Window
  14.   #--------------------------------------------------------------------------
  15.   # ● 获取统一字体设置
  16.   #--------------------------------------------------------------------------
  17.   def easy_menu_font
  18.     contents.font.name = EASY_MENU_SET::Font_name
  19.     contents.font.size = EASY_MENU_SET::Font_size
  20.     contents.font.outline = EASY_MENU_SET::Font_outline
  21.     contents.font.shadow = EASY_MENU_SET::Font_shadow
  22.     contents.font.bold = EASY_MENU_SET::Font_bold
  23.     contents.font.italic = EASY_MENU_SET::Font_italic
  24.   end
  25. end

  26. #==============================================================================
  27. # ■ Window_Help
  28. #==============================================================================
  29. class Window_Help < Window_Base
  30.   #--------------------------------------------------------------------------
  31.   # ● 初始化对象
  32.   #--------------------------------------------------------------------------
  33.   def initialize(line_number = 2, width = Graphics.width)
  34.     super(0, 0, width, fitting_height(line_number))
  35.     self.windowskin = Cache.system(EASY_MENU_SET::SKIN)
  36.     self.opacity = EASY_MENU_SET::HELP_opacity
  37.   end
  38.   #--------------------------------------------------------------------------
  39.   # ● 设置内容
  40.   #--------------------------------------------------------------------------
  41.   def set_text(text)
  42.     text.gsub!(/\\n/i) { "\n" }
  43.     if text != @text
  44.       @text = text
  45.       refresh
  46.     end
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # ● 清除
  50.   #--------------------------------------------------------------------------
  51.   def clear
  52.     set_text("")
  53.   end
  54.   #--------------------------------------------------------------------------
  55.   # ● 设置物品
  56.   #     item : 技能、物品等
  57.   #--------------------------------------------------------------------------
  58.   def set_item(item)
  59.     set_text(item ? item.description : "")
  60.   end
  61.   #--------------------------------------------------------------------------
  62.   # ● 绘制带有控制符的文本内容
  63.   #--------------------------------------------------------------------------
  64.   def draw_text_ex(x, y, text)
  65.     reset_item_font_settings
  66.     text = convert_escape_characters(text)
  67.     pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
  68.     process_character(text.slice!(0, 1), text, pos) until text.empty?
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # ● 物品帮助字体设置
  72.   #--------------------------------------------------------------------------
  73.   def reset_item_font_settings
  74.     return if @text_line
  75.     contents.font.name = EASY_MENU_SET::HELP_name
  76.     contents.font.size = EASY_MENU_SET::HELP_size
  77.     contents.font.outline = EASY_MENU_SET::HELP_outline
  78.     contents.font.shadow = EASY_MENU_SET::HELP_shadow
  79.     contents.font.bold = EASY_MENU_SET::HELP_bold
  80.     contents.font.italic = EASY_MENU_SET::HELP_italic
  81.     v = EASY_MENU_SET::HELP_color
  82.     change_color(Color.new(v[0], v[1], v[2]))
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   # ● 获取文字颜色
  86.   #--------------------------------------------------------------------------
  87.   def text_color(n)
  88.     v = EASY_MENU_SET::HELP_color
  89.     return Color.new(v[0], v[1], v[2]) if n == 0
  90.     return windowskin.get_pixel(64 + (n % 8) * 8, 96 + (n / 8) * 8)
  91.   end
  92.   #--------------------------------------------------------------------------
  93.   # ● 处理普通文字
  94.   #--------------------------------------------------------------------------
  95.   def process_normal_character(c, pos)
  96.     if (pos[:x] + contents.text_size(c).width) > contents.width
  97.       @text_line = true
  98.       process_new_line(c, pos)
  99.       @text_line = false
  100.       pos[:height] = calc_line_height(c)
  101.     end
  102.     text_width = text_size(c).width
  103.     draw_text(pos[:x], pos[:y], text_width * 2, pos[:height], c)
  104.     pos[:x] += text_width
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ● 刷新
  108.   #--------------------------------------------------------------------------
  109.   def refresh
  110.     contents.clear
  111.     draw_text_ex(4, 0, @text)
  112.   end
  113. end

  114. #==============================================================================
  115. # ■ Window_MenuCommand
  116. #==============================================================================
  117. class Window_MenuCommand < Window_Command
  118.   #--------------------------------------------------------------------------
  119.   # ● 初始化指令选择位置(类方法)
  120.   #--------------------------------------------------------------------------
  121.   def self.init_command_position(type = nil)
  122.     @@last_command_symbol = type
  123.   end
  124.   #--------------------------------------------------------------------------
  125.   # ● 初始化对象
  126.   #--------------------------------------------------------------------------
  127.   def initialize(sub = false)
  128.     @sub = sub
  129.     super(-24, EASY_MENU_SET::COMMAND[1])
  130.     self.opacity = 0
  131.     self.active = false
  132.     @show = false
  133.     @move_rx = @sub_ry = 0
  134.     @last_index = @index
  135.     update_placement unless @sub
  136.     select_last
  137.     refresh
  138.   end
  139.   #--------------------------------------------------------------------------
  140.   # ● 获取标准的边距尺寸
  141.   #--------------------------------------------------------------------------
  142.   def standard_padding
  143.     return 0
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● 显示动画前的设定
  147.   #--------------------------------------------------------------------------
  148.   def update_placement
  149.     self.x = -24 - window_width
  150.     self.contents_opacity = 0
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   # ● 获取窗口的宽度
  154.   #--------------------------------------------------------------------------
  155.   def window_width
  156.     return EASY_MENU_SET::COMMAND[2] + 24 + 24
  157.   end
  158.   #--------------------------------------------------------------------------
  159.   # ● 获取项目的宽度
  160.   #--------------------------------------------------------------------------
  161.   def item_width
  162.     width - 24
  163.   end
  164.   #--------------------------------------------------------------------------
  165.   # ● 获取间隔距离
  166.   #--------------------------------------------------------------------------
  167.   def line_spacing
  168.     return EASY_MENU_SET::COMMAND[4]
  169.   end
  170.   #--------------------------------------------------------------------------
  171.   # ● 获取行高
  172.   #--------------------------------------------------------------------------
  173.   def line_height
  174.     return EASY_MENU_SET::COMMAND[3] + line_spacing
  175.   end
  176.   #--------------------------------------------------------------------------
  177.   # ● 获取指令名称
  178.   #--------------------------------------------------------------------------
  179.   def set_command_name(v)
  180.     @name = []
  181.     for i in 0...EASY_MENU_SET::BUTTON.size
  182.       name = Vocab::item     if v[i][4] == :item
  183.       name = Vocab::key_item if v[i][4] == :key_item
  184.       name = Vocab::save     if v[i][4] == :save
  185.       name = Vocab::continue if v[i][4] == :continue
  186.       name = Vocab::game_end if v[i][4] == :game_end
  187.       @name[i] = v[i][1] ? v[i][1] : name
  188.     end
  189.   end
  190.   #--------------------------------------------------------------------------
  191.   # ● 获取显示状态
  192.   #--------------------------------------------------------------------------
  193.   def set_command_enabled(v)
  194.     @enabled = []
  195.     for i in 0...EASY_MENU_SET::BUTTON.size
  196.       enabled = main_commands_enabled         if v[i][4] == :item
  197.       enabled = main_commands_enabled         if v[i][4] == :key_item
  198.       enabled = save_enabled                  if v[i][4] == :save
  199.       enabled = DataManager.save_file_exists? if v[i][4] == :continue
  200.       enabled = true                          if v[i][4] == :game_end
  201.       @enabled[i] = enabled
  202.     end
  203.   end
  204.   #--------------------------------------------------------------------------
  205.   # ● 获取指令图标
  206.   #--------------------------------------------------------------------------
  207.   def set_command_icon(v)
  208.     @icon = []
  209.     for i in 0...EASY_MENU_SET::BUTTON.size
  210.       @icon[i] = v[i][2] if v[i][2]
  211.     end
  212.   end
  213.   #--------------------------------------------------------------------------
  214.   # ● 获取选项的图标
  215.   #--------------------------------------------------------------------------
  216.   def command_icon(index)
  217.     @list[index][:ext]
  218.   end
  219.   #--------------------------------------------------------------------------
  220.   # ● 生成指令列表
  221.   #--------------------------------------------------------------------------
  222.   def make_command_list
  223.     v = EASY_MENU_SET::BUTTON
  224.     set_command_name(v)
  225.     set_command_icon(v)
  226.     set_command_enabled(v)
  227.     for i in 0...EASY_MENU_SET::BUTTON.size
  228.       add_command(@name[i], v[i][4], @enabled[i], @icon[i]) if v[i][0] or @sub
  229.     end
  230.   end
  231.   #--------------------------------------------------------------------------
  232.   # ● 刷新
  233.   #--------------------------------------------------------------------------
  234.   def refresh
  235.     #clear_command_list
  236.     #make_command_list
  237.     create_contents
  238.     contents.clear
  239.     draw_all_items
  240.   end
  241.   #--------------------------------------------------------------------------
  242.   # ● 绘制项目
  243.   #--------------------------------------------------------------------------
  244.   def draw_item(index)
  245.     return if @sub && @index != index
  246.     easy_menu_font
  247.     rect = item_rect_for_text(index)
  248.     t_size = text_size(command_name(index))
  249.     mx = @index == index ? @sub ? 0 : @move_rx : 0
  250.     my = @sub ? @sub_ry : 0
  251.     ix = item_width - t_size.width - 28 + mx
  252.     iy = (line_height - t_size.height) / 2 + my
  253.     draw_background(index, rect, mx, my)
  254.     rect.x -= 24
  255.     rect.y -= (line_spacing / 2)
  256.     enabled = command_enabled?(index)
  257.     change_color(item_color(index), enabled)
  258.     rt = [rect.x + mx, rect.y + my, rect.width, rect.height]
  259.     draw_text(rt[0], rt[1], rt[2], rt[3], command_name(index), 2)
  260.     draw_icon(command_icon(index), rect.x + ix, rect.y + iy, enabled)
  261.   end
  262.   #--------------------------------------------------------------------------
  263.   # ● 绘制底纹
  264.   #--------------------------------------------------------------------------
  265.   def draw_background(index, rect, x, y)
  266.     lh = line_height - line_spacing
  267.     bit = Cache.system(EASY_MENU_SET::COMMAND[0])
  268.     rx = bit.width - item_width
  269.     rect1 = Rect.new(rx, 0, item_width, 12)
  270.     rect2 = Rect.new(rx, 12, item_width, 12)
  271.     rect3 = Rect.new(rx, 36 - 12, item_width, 12)
  272.     d_rect = Rect.new(rect.x + x, rect.y + 12 + y, item_width, lh - 24)
  273.     self.contents.blt(rect.x + x, rect.y + y, bit, rect1)
  274.     self.contents.stretch_blt(d_rect, bit, rect2)
  275.     self.contents.blt(rect.x + x, rect.y + lh - 12 + y, bit, rect3)
  276.   end
  277.   #--------------------------------------------------------------------------
  278.   # ● 字体颜色扩展
  279.   #--------------------------------------------------------------------------
  280.   def item_color(index)
  281.     co = EASY_MENU_SET::BUTTON[index][3]
  282.     return Color.new(co[0], co[1], co[2]) if @index == index
  283.     return Color.new(co[0], co[1], co[2], 200)
  284.   end
  285.   #--------------------------------------------------------------------------
  286.   # ● 获取项目的绘制矩形
  287.   #--------------------------------------------------------------------------
  288.   def item_rect(index)
  289.     index = 0 if @sub
  290.     rect = Rect.new
  291.     rect.width = 4
  292.     rect.height = 24
  293.     rect.x = index % col_max * (item_width + spacing) + 32
  294.     rect.y = index / col_max * item_height + 4
  295.     rect
  296.   end
  297.   #--------------------------------------------------------------------------
  298.   # ● 获取项目的绘制矩形(内容用)
  299.   #--------------------------------------------------------------------------
  300.   def item_rect_for_text(index)
  301.     index = 0 if @sub
  302.     rect = Rect.new
  303.     rect.width = item_width
  304.     rect.height = item_height
  305.     rect.x = index % col_max * (item_width + spacing)
  306.     rect.y = index / col_max * item_height
  307.     rect
  308.   end
  309.   #--------------------------------------------------------------------------
  310.   # ● 展开动画的标志
  311.   #--------------------------------------------------------------------------
  312.   def show=(show)
  313.     if @show != show
  314.       @show = show
  315.     end
  316.   end
  317.   #--------------------------------------------------------------------------
  318.   # ● 获取动画的标志
  319.   #--------------------------------------------------------------------------
  320.   def show
  321.     return @show
  322.   end
  323.   #--------------------------------------------------------------------------
  324.   # ● 更新画面
  325.   #--------------------------------------------------------------------------
  326.   def update
  327.     super
  328.     if @last_index != @index && !@show
  329.       @move_rx = 0
  330.       @last_index = @index
  331.     end
  332.     update_button if Input.dir4 > 0 or @move_rx < 24
  333.   end
  334.   #--------------------------------------------------------------------------
  335.   # ● 按钮的改变动画
  336.   #--------------------------------------------------------------------------
  337.   def update_button
  338.     @move_rx += 4 if @move_rx < 24
  339.     refresh
  340.   end
  341.   #--------------------------------------------------------------------------
  342.   # ● 按钮的还原动画
  343.   #--------------------------------------------------------------------------
  344.   def hide_button
  345.     @move_rx -= 4 if @move_rx > 0
  346.     refresh
  347.   end
  348.   #--------------------------------------------------------------------------
  349.   # ● 展开动画
  350.   #--------------------------------------------------------------------------
  351.   def open_button_window
  352.     self.x += (window_width + 24) / EASY_MENU_SET::TIME
  353.     self.contents_opacity += 255 / EASY_MENU_SET::TIME
  354.     refresh
  355.     @show = false if self.x >= -24
  356.     self.x = -24 if !@show
  357.     self.contents_opacity = 255 if !@show
  358.   end
  359.   #--------------------------------------------------------------------------
  360.   # ● 关闭动画
  361.   #--------------------------------------------------------------------------
  362.   def close_button_window
  363.     @show = false if self.contents_opacity <= 0
  364.     if @move_rx > 0
  365.       hide_button
  366.     else
  367.       self.x -= (window_width + 24) / EASY_MENU_SET::TIME
  368.       self.contents_opacity -= 255 / EASY_MENU_SET::TIME
  369.       refresh
  370.     end
  371.   end
  372.   #--------------------------------------------------------------------------
  373.   # ● 进入子菜单的关闭动画
  374.   #--------------------------------------------------------------------------
  375.   def close_window_to_sub
  376.     if @move_rx > 0
  377.       hide_button
  378.       @sub_ry = @index / col_max * item_height
  379.     else
  380.       cursor_rect.empty
  381.       @show = false if @sub_ry <= 0
  382.       @sub_ry = 0 if !@show
  383.       @sub = true
  384.       @sub_ry = [(@sub_ry - ((EASY_MENU_SET::COMMAND[3] * index)) / 6), 0].max
  385.       refresh
  386.     end
  387.   end
  388. end

  389. #==============================================================================
  390. # ■ Scene_MenuBase
  391. #==============================================================================
  392. class Scene_MenuBase < Scene_Base
  393.   #--------------------------------------------------------------------------
  394.   # ● 结束处理
  395.   #--------------------------------------------------------------------------
  396.   alias easy_menu_terminate terminate
  397.   def terminate
  398.     easy_menu_terminate
  399.     dispose_rim
  400.     dispose_actor_cg
  401.     dispose_sub_button
  402.   end
  403.   #--------------------------------------------------------------------------
  404.   # ● 生成背景
  405.   #--------------------------------------------------------------------------
  406.   def create_background
  407.     wall = EASY_MENU_SET::WALLPAPER
  408.     co = EASY_MENU_SET::BACKGROUND
  409.     @background_sprite = Sprite.new
  410.     bitmap = wall ? Cache.system(wall) : SceneManager.background_bitmap
  411.     @background_sprite.bitmap = bitmap
  412.     @background_sprite.color.set(co[0], co[1], co[2], co[3]) unless wall
  413.   end
  414.   #--------------------------------------------------------------------------
  415.   # ● 绘制次背景图片
  416.   #--------------------------------------------------------------------------
  417.   def create_rim_background(bitmap, x, y)
  418.     @rim_sprite = Sprite.new
  419.     @rim_sprite.bitmap = Cache.system(bitmap) if bitmap
  420.     @rim_sprite.x = x; @rim_sprite.y = y
  421.     @rim_sprite.z = @background_sprite.z
  422.   end
  423.   #--------------------------------------------------------------------------
  424.   # ● 释放次背景图片
  425.   #--------------------------------------------------------------------------
  426.   def dispose_rim
  427.     return if !@rim_sprite
  428.     @rim_sprite.bitmap.dispose
  429.     @rim_sprite.dispose
  430.   end
  431.   #--------------------------------------------------------------------------
  432.   # ● 生成立绘精灵
  433.   #--------------------------------------------------------------------------
  434.   def create_actor_cg
  435.     v = EASY_MENU_SET::CG
  436.     return unless v[0]
  437.     @actor_cg = Sprite.new
  438.     @actor_cg.bitmap = Cache.system(v[0])
  439.     @actor_cg.x = v[1] + 2 * 7
  440.     @actor_cg.y = v[2]
  441.   end
  442.   #--------------------------------------------------------------------------
  443.   # ● 立绘的坐标判断
  444.   #--------------------------------------------------------------------------
  445.   def cg_x
  446.     v = EASY_MENU_SET::CG
  447.     return v[3] if v[4] == :l
  448.     return -(v[3]) if v[4] == :r
  449.     return 0
  450.   end
  451.   #--------------------------------------------------------------------------
  452.   # ● 释放立绘精灵
  453.   #--------------------------------------------------------------------------
  454.   def dispose_actor_cg
  455.     return if !@actor_cg
  456.     @actor_cg.bitmap.dispose
  457.     @actor_cg.dispose
  458.   end
  459.   #--------------------------------------------------------------------------
  460.   # ● 展开动画的预设坐标
  461.   #--------------------------------------------------------------------------
  462.   def set_menu_xy
  463.     v = EASY_MENU_SET::CG
  464.     xx = 0
  465.     xx = -(EASY_MENU_SET::TIME * v[3]) if v[4] == :l
  466.     xx = EASY_MENU_SET::TIME * v[3] if v[4] == :r
  467.     @actor_cg.x = v[1] + xx
  468.     @actor_cg.opacity = 0
  469.     @rim_sprite.opacity = 0 if @rim_sprite
  470.   end
  471.   #--------------------------------------------------------------------------
  472.   # ● 重绘内用小标题
  473.   #--------------------------------------------------------------------------
  474.   def create_sub_button
  475.     @sub_window = Window_MenuCommand.new(true)
  476.     @sub_window.z = 300
  477.   end
  478.   #--------------------------------------------------------------------------
  479.   # ● 释放内用小标题
  480.   #--------------------------------------------------------------------------
  481.   def dispose_sub_button
  482.     @sub_window.dispose if @sub_window
  483.   end
  484. end

  485. #==============================================================================
  486. # ■ Scene_Menu
  487. #==============================================================================
  488. class Scene_Menu < Scene_MenuBase
  489.   #--------------------------------------------------------------------------
  490.   # ● 开始处理
  491.   #--------------------------------------------------------------------------
  492.   def start
  493.     super
  494.     v = EASY_MENU_SET::MENU_RIM
  495.     create_rim_background(v[0], v[1], v[2]) if v[0]
  496.     create_actor_cg
  497.     create_command_window
  498.     set_menu_xy
  499.     @sub_show = false
  500.   end
  501.   #--------------------------------------------------------------------------
  502.   # ● 开始后处理
  503.   #--------------------------------------------------------------------------
  504.   def post_start
  505.     super
  506.     @command_window.show = true
  507.     begin
  508.       @actor_cg.x += cg_x
  509.       @actor_cg.opacity += (255 / EASY_MENU_SET::TIME)
  510.       @rim_sprite.opacity += (255 / EASY_MENU_SET::TIME) if @rim_sprite
  511.       @command_window.open_button_window
  512.       Graphics.update
  513.     end until @command_window.show == false
  514.     @command_window.activate
  515.     @actor_cg.opacity = 255
  516.   end
  517.   #--------------------------------------------------------------------------
  518.   # ● 结束前处理
  519.   #--------------------------------------------------------------------------
  520.   def pre_terminate
  521.     super
  522.     t = 0
  523.     @command_window.show = true
  524.     begin
  525.       if @sub_show
  526.         t += 1 if t <= 6
  527.         @actor_cg.x += 2 if t <= 6
  528.         @command_window.close_window_to_sub
  529.       else
  530.         @actor_cg.x += -(cg_x)
  531.         @actor_cg.opacity -= 255 / EASY_MENU_SET::TIME
  532.         @rim_sprite.opacity -= 255 / EASY_MENU_SET::TIME if @rim_sprite
  533.         @command_window.close_button_window
  534.       end
  535.       Graphics.update
  536.     end until @command_window.show == false
  537.   end
  538.   #--------------------------------------------------------------------------
  539.   # ● 生成指令窗口
  540.   #--------------------------------------------------------------------------
  541.   def create_command_window
  542.     v = EASY_MENU_SET::BUTTON
  543.     @command_window = Window_MenuCommand.new
  544.     for i in 0...EASY_MENU_SET::BUTTON.size
  545.       type = :command_item     if v[i][4] == :item
  546.       type = :command_key_item if v[i][4] == :key_item
  547.       type = :command_save     if v[i][4] == :save
  548.       type = :command_load     if v[i][4] == :continue
  549.       type = :command_game_end if v[i][4] == :game_end
  550.       @command_window.set_handler(v[i][4], method(type)) if v[i][0]
  551.     end
  552.     @command_window.set_handler(:cancel,    method(:return_scene))
  553.   end
  554.   #--------------------------------------------------------------------------
  555.   # ● 指令“物品”
  556.   #--------------------------------------------------------------------------
  557.   def command_item
  558.     @sub_show = true
  559.     SceneManager.call(Scene_Item)
  560.     SceneManager.scene.prepare(:item)
  561.   end
  562.   #--------------------------------------------------------------------------
  563.   # ● 指令“贵重物品”
  564.   #--------------------------------------------------------------------------
  565.   def command_key_item
  566.     @sub_show = true
  567.     SceneManager.call(Scene_Item)
  568.     SceneManager.scene.prepare(:key_item)
  569.   end
  570.   #--------------------------------------------------------------------------
  571.   # ● 指令“存档”
  572.   #--------------------------------------------------------------------------
  573.   def command_save
  574.     @sub_show = true
  575.     SceneManager.call(Scene_Save)
  576.   end
  577.   #--------------------------------------------------------------------------
  578.   # ● 指令“读档”
  579.   #--------------------------------------------------------------------------
  580.   def command_load
  581.     @sub_show = true
  582.     SceneManager.call(Scene_Load)
  583.   end
  584. end



  585. #==============================================================================
  586. # ■ SceneManager
  587. #==============================================================================
  588. module SceneManager
  589.   #--------------------------------------------------------------------------
  590.   # ● 模块的实例变量
  591.   #--------------------------------------------------------------------------
  592.   @save_bitmap = nil                # 存档用截图
  593.   #--------------------------------------------------------------------------
  594.   # ● 生成背景用的场景截图
  595.   #--------------------------------------------------------------------------
  596.   def self.snapshot_for_background(bitmap_blue = true)
  597.     @background_bitmap.dispose if @background_bitmap
  598.     @background_bitmap = Graphics.snap_to_bitmap
  599.     @background_bitmap.blur if bitmap_blue
  600.   end
  601.   #--------------------------------------------------------------------------
  602.   # ● 生成存档内的截图
  603.   #--------------------------------------------------------------------------
  604.   def self.snapshot_for_save_bitmap
  605.     v = EASY_MENU_SET::FILES_DETAILS_DATA
  606.     @save_bitmap.dispose if @save_bitmap
  607.     @save_bitmap = Bitmap.new(v[0][3], v[0][4])
  608.     rect = Rect.new(0, 0, v[0][3], v[0][4])
  609.     rect.x = $game_player.screen_x - rect.width / 2
  610.     rect.y = $game_player.screen_y - rect.height / 2 - 12
  611.     bitmap = Graphics.snap_to_bitmap
  612.     @save_bitmap.blt(0, 0, bitmap, rect)
  613.     bitmap.dispose
  614.   end
  615.   #--------------------------------------------------------------------------
  616.   # ● 获取存档内的截图
  617.   #--------------------------------------------------------------------------
  618.   def self.saves_bitmap
  619.     @save_bitmap
  620.   end
  621. end

  622. #==============================================================================
  623. # ■ Scene_Map
  624. #==============================================================================
  625. class Scene_Map < Scene_Base
  626.   #--------------------------------------------------------------------------
  627.   # ● 结束处理
  628.   #--------------------------------------------------------------------------
  629.   def terminate
  630.     super
  631.     type = EASY_MENU_SET::BACKGROUND[4]
  632.     type = true if SceneManager.scene_is?(Scene_Battle)
  633.     SceneManager.snapshot_for_background(type)
  634.     SceneManager.snapshot_for_save_bitmap
  635.     dispose_spriteset
  636.     perform_battle_transition if SceneManager.scene_is?(Scene_Battle)
  637.   end
  638. end


  639. #==============================================================================
  640. # ★ 物品界面
  641. #==============================================================================
  642. #==============================================================================
  643. # ■ Window_ItemList
  644. #==============================================================================
  645. class Window_ItemList < Window_Selectable
  646.   #--------------------------------------------------------------------------
  647.   # ● 初始化对象
  648.   #--------------------------------------------------------------------------
  649.   def initialize(x, y, width, height)
  650.     super
  651.     self.windowskin = Cache.system(EASY_MENU_SET::SKIN)
  652.     self.opacity = EASY_MENU_SET::ITEMLIST[2]
  653.     @category = :none
  654.     @data = []
  655.   end
  656.   #--------------------------------------------------------------------------
  657.   # ● 获取标准的边距尺寸
  658.   #--------------------------------------------------------------------------
  659.   def standard_padding
  660.     return 16
  661.   end
  662.   #--------------------------------------------------------------------------
  663.   # ● 获取列数
  664.   #--------------------------------------------------------------------------
  665.   def col_max
  666.     return 1
  667.   end
  668.   #--------------------------------------------------------------------------
  669.   # ● 绘制项目
  670.   #--------------------------------------------------------------------------
  671.   alias easy_menu_draw_item draw_item
  672.   def draw_item(index)
  673.     easy_menu_font
  674.     easy_menu_draw_item(index)
  675.   end
  676.   #--------------------------------------------------------------------------
  677.   # ● 绘制物品个数
  678.   #--------------------------------------------------------------------------
  679.   def draw_item_number(rect, item)
  680.     return if $game_party.item_number(item) <= 1
  681.     draw_text(rect, sprintf("%02d", $game_party.item_number(item)), 2)
  682.   end
  683.   #--------------------------------------------------------------------------
  684.   # ● 绘制物品名称
  685.   #     enabled : 有效的标志。false 的时候使用半透明效果绘制
  686.   #--------------------------------------------------------------------------
  687.   def draw_item_name(item, x, y, enabled = true, width = 172)
  688.     return unless item
  689.     draw_icon(item.icon_index, x, y, enabled)
  690.     change_color(normal_color, enabled)
  691.     draw_text_ex(x + 24, y, item.name)
  692.     #draw_text(x + 24, y, width, line_height, item.name)
  693.   end
  694.   #--------------------------------------------------------------------------
  695.   # ● 重置字体设置
  696.   #--------------------------------------------------------------------------
  697.   def reset_font_settings
  698.     change_color(normal_color)
  699.     easy_menu_font
  700.   end
  701.   #--------------------------------------------------------------------------
  702.   # ● 更新帮助内容
  703.   #--------------------------------------------------------------------------
  704.   def update_help
  705.     @help_window.set_item(item)
  706.     @big_icon.set_item(item.big_icon) if EASY_MENU_SET::BIGICON[0]
  707.   end
  708.   #--------------------------------------------------------------------------
  709.   # ● 设置物品窗口
  710.   #--------------------------------------------------------------------------
  711.   def big_icon=(big_icon)
  712.     @big_icon = big_icon
  713.     update
  714.   end
  715. end

  716. #==============================================================================
  717. # ■ BIG ICON
  718. #==============================================================================
  719. module Cache
  720.   def self.bigicon(filename)
  721.     load_bitmap(EASY_MENU_SET::BIGICON_Cache, filename)
  722.   end
  723. end

  724. #==============================================================================
  725. # ■ RPG::BaseItem
  726. #==============================================================================
  727. class RPG::BaseItem
  728.   #--------------------------------------------------------------------------
  729.   # ● 获取大图标
  730.   #--------------------------------------------------------------------------
  731.   def big_icon
  732.     self.note =~ /\<BigIcon (\w+)\>/i
  733.     $1.nil? ? "" : $1
  734.   end
  735. end

  736. #==============================================================================
  737. # ■ Window_Big_icon
  738. #==============================================================================
  739. class Window_Big_icon < Window_Base
  740.   #--------------------------------------------------------------------------
  741.   # ● 初始化对象
  742.   #--------------------------------------------------------------------------
  743.   def initialize(x, y, width, height)
  744.     super(x, y, width, height)
  745.     self.windowskin = Cache.system(EASY_MENU_SET::SKIN)
  746.     self.opacity = EASY_MENU_SET::BIGICON[6]
  747.   end
  748.   #--------------------------------------------------------------------------
  749.   # ● 设置内容
  750.   #--------------------------------------------------------------------------
  751.   def set_item(icon)
  752.     if icon != @icon
  753.       contents.clear
  754.       bitmap = Cache.bigicon(icon)
  755.       x = (contents.width - bitmap.width) / 2
  756.       y = (contents.height - bitmap.height) / 2
  757.       rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  758.       contents.blt(x, y, bitmap, rect)
  759.       @icon = icon
  760.     end
  761.   end
  762. end

  763. #==============================================================================
  764. # ■ Scene_ItemBase
  765. #==============================================================================
  766. class Scene_ItemBase < Scene_MenuBase
  767.   #--------------------------------------------------------------------------
  768.   # ● 生成角色窗口
  769.   #--------------------------------------------------------------------------
  770.   def create_actor_window
  771.     @actor_window = Window_MenuActor.new
  772.     @actor_window.set_handler(:ok,     method(:on_actor_ok))
  773.     @actor_window.set_handler(:cancel, method(:on_actor_cancel))
  774.   end
  775.   #--------------------------------------------------------------------------
  776.   # ● 显示子窗口
  777.   #--------------------------------------------------------------------------
  778.   alias easy_menu_show_sub_window show_sub_window
  779.   def show_sub_window(window)
  780.     window.y = (Graphics.height - @actor_window.height) / 2
  781.     easy_menu_show_sub_window(window)
  782.     @actor_window.z = 200
  783.   end
  784. end

  785. #==============================================================================
  786. # ■ Scene_Item
  787. #==============================================================================
  788. class Scene_Item < Scene_ItemBase
  789.   #--------------------------------------------------------------------------
  790.   # ● 预处理
  791.   #--------------------------------------------------------------------------
  792.   def prepare(mode = :item)
  793.     @mode = mode
  794.   end
  795.   #--------------------------------------------------------------------------
  796.   # ● 开始处理
  797.   #--------------------------------------------------------------------------
  798.   def start
  799.     super
  800.     v = EASY_MENU_SET::ITEM_RIM
  801.     create_rim_background(v[0], v[1], v[2]) if v[0]
  802.     create_actor_cg unless EASY_MENU_SET::BIGICON[0]
  803.     create_help_window
  804.     create_big_icon_window if EASY_MENU_SET::BIGICON[0]
  805.     create_item_window
  806.     create_sub_button
  807.   end
  808.   #--------------------------------------------------------------------------
  809.   # ● 生成物品窗口
  810.   #--------------------------------------------------------------------------
  811.   def create_item_window
  812.     sp = EASY_MENU_SET::COMMAND[1]
  813.     iy = sp + EASY_MENU_SET::COMMAND[3] - 8
  814.     ih = Graphics.height - @help_window.height - sp - iy
  815.     @item_window = Window_ItemList.new(sp, iy, @help_window.width, ih)
  816.     @item_window.category = @mode
  817.     @item_window.viewport = @viewport
  818.     @item_window.help_window = @help_window
  819.     @item_window.big_icon = @big_icon_window if EASY_MENU_SET::BIGICON[0]
  820.     @item_window.set_handler(:ok,     method(:on_item_ok))
  821.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  822.     @item_window.index = 0
  823.     @item_window.activate
  824.   end
  825.   #--------------------------------------------------------------------------
  826.   # ● 生成帮助窗口
  827.   #--------------------------------------------------------------------------
  828.   def create_help_window
  829.     sp = EASY_MENU_SET::COMMAND[1]
  830.     v = EASY_MENU_SET::ITEMLIST
  831.     w = v[0] > 0 ? v[0] : (Graphics.width / 2 - sp)
  832.     @help_window = Window_Help.new(v[1], w)
  833.     @help_window.viewport = @viewport
  834.     @help_window.x = sp
  835.     @help_window.y = Graphics.height - @help_window.height - sp
  836.   end
  837.   #--------------------------------------------------------------------------
  838.   # ● 生成物品大图标
  839.   #--------------------------------------------------------------------------
  840.   def create_big_icon_window
  841.     sp = EASY_MENU_SET::COMMAND[1]
  842.     v = EASY_MENU_SET::BIGICON
  843.     b = []
  844.     if v[1]
  845.       b[0] = @help_window.width + sp
  846.       b[1] = sp + EASY_MENU_SET::COMMAND[3] - 8
  847.       b[2] = Graphics.width - b[0] - sp
  848.       b[3] = Graphics.height - b[1] - sp
  849.     else
  850.       b = [v[2], v[3], v[4], v[5]]
  851.     end
  852.     @big_icon_window = Window_Big_icon.new(b[0], b[1], b[2], b[3])
  853.     @big_icon_window.viewport = @viewport
  854.   end
  855.   #--------------------------------------------------------------------------
  856.   # ● 物品“取消”
  857.   #--------------------------------------------------------------------------
  858.   def on_item_cancel
  859.     @item_window.unselect
  860.     return_scene
  861.   end
  862. end


  863. #==============================================================================
  864. # ★ 存档界面
  865. #==============================================================================
  866. #==============================================================================
  867. # ■ Window_SaveFileList
  868. #------------------------------------------------------------------------------
  869. #  存档的选项窗口(左)
  870. #==============================================================================
  871. class Window_SaveFileList < Window_Selectable
  872.   #--------------------------------------------------------------------------
  873.   # ● 初始化对象
  874.   #--------------------------------------------------------------------------
  875.   def initialize(x, y, width, height)
  876.     super
  877.     self.windowskin = Cache.system(EASY_MENU_SET::SKIN)
  878.     self.opacity = EASY_MENU_SET::FILESLIST[4]
  879.     @symbol = nil
  880.     refresh
  881.     activate
  882.   end
  883.   #--------------------------------------------------------------------------
  884.   # ● 获取可显示的存档数目
  885.   #--------------------------------------------------------------------------
  886.   def visible_max
  887.     return EASY_MENU_SET::FILESLIST[1]
  888.   end
  889.   #--------------------------------------------------------------------------
  890.   # ● 获取项目的高度
  891.   #--------------------------------------------------------------------------
  892.   def item_height
  893.     (height - standard_padding * 2) / visible_max
  894.   end
  895.   #--------------------------------------------------------------------------
  896.   # ● 存档数量最大值
  897.   #--------------------------------------------------------------------------
  898.   def item_max
  899.     return EASY_MENU_SET::FILES_MAX
  900.   end
  901.   #--------------------------------------------------------------------------
  902.   # ● 绘制项目
  903.   #--------------------------------------------------------------------------
  904.   def draw_item(index)
  905.     header = DataManager.load_header(index)
  906.     rect = item_rect_for_text(index)
  907.     ry = (item_height - line_height) / 2
  908.     easy_menu_font
  909.     v = EASY_MENU_SET::FILESLIST
  910.     change_color(Color.new(v[3][0][0], v[3][0][1], v[3][0][2]), header)
  911.     icon_id = header ? v[2][1] : v[2][0]
  912.     draw_icon(icon_id, rect.x + 4, rect.y + ry)
  913.     text = @symbol == :save ? EASY_MENU_SET::SAVING : EASY_MENU_SET::LOADING
  914.     ing = @index == index && @symbol
  915.     name = ing ? text : (Vocab::File + " #{index + 1}")
  916.     draw_text(rect.x + 28, rect.y + ry, rect.width, line_height, name)
  917.     change_color(Color.new(v[3][1][0], v[3][1][1], v[3][1][2]), header)
  918.     draw_playtime(header, rect.x - 4, rect.y + ry, rect.width, 2)
  919.   end
  920.   #--------------------------------------------------------------------------
  921.   # ● 绘制游戏时间
  922.   #--------------------------------------------------------------------------
  923.   def draw_playtime(header, x, y, width, align)
  924.     text = header ? header[:playtime_s] : "—:—:—"
  925.     draw_text(x, y, width, line_height, text, 2)
  926.   end
  927.   #--------------------------------------------------------------------------
  928.   # ● 设置选择状态
  929.   #--------------------------------------------------------------------------
  930.   def set_files(symbol)
  931.     @symbol = symbol
  932.     refresh
  933.   end
  934. end


  935. #==============================================================================
  936. # ■ Window_FilesDetails
  937. #------------------------------------------------------------------------------
  938. #  存档的详细窗口(右)
  939. #==============================================================================
  940. class Window_FilesDetails < Window_Base
  941.   #--------------------------------------------------------------------------
  942.   # ● 初始化对象
  943.   #--------------------------------------------------------------------------
  944.   def initialize(x, y, width, height)
  945.     super(x, y, width, height)
  946.     self.windowskin = Cache.system(EASY_MENU_SET::SKIN)
  947.     self.opacity = EASY_MENU_SET::FILES_DETAILS[6]
  948.     @bitmaps = []
  949.     @header = []
  950.   end
  951.   #--------------------------------------------------------------------------
  952.   # ● 释放
  953.   #--------------------------------------------------------------------------
  954.   def dispose
  955.     for bitmap in @bitmaps
  956.       next if bitmap == nil or bitmap.disposed?
  957.       bitmap.dispose
  958.     end
  959.     super
  960.   end
  961.   #--------------------------------------------------------------------------
  962.   # ● 设置选择状态
  963.   #--------------------------------------------------------------------------
  964.   def set_select(select)
  965.     return if @select == select
  966.     @select = select
  967.     refresh(@select)
  968.   end
  969.   #--------------------------------------------------------------------------
  970.   # ● 读取文件
  971.   #--------------------------------------------------------------------------
  972.   def read_save_data(index)
  973.     @header[index] = DataManager.load_header(index)
  974.     @bitmaps[index].dispose if @bitmaps[index]
  975.     return unless EASY_MENU_SET::FILES_DETAILS_DATA[0][0]
  976.     @bitmaps[index] = DataManager.load_save_bitmap(index)
  977.   end
  978.   #--------------------------------------------------------------------------
  979.   # ● 刷新
  980.   #--------------------------------------------------------------------------
  981.   def refresh(index)
  982.     contents.clear
  983.     read_save_data(index)
  984.     v = EASY_MENU_SET::FILES_DETAILS_DATA
  985.     draw_background(@header[index], v)
  986.     return unless @header[index]
  987.     draw_save_bitmap(@header[index], index, v)
  988.     draw_party_characters(@header[index], index, v)
  989.     draw_party_faces(@header[index], index, v)
  990.   end
  991.   #--------------------------------------------------------------------------
  992.   # ● 绘制 底图
  993.   #--------------------------------------------------------------------------
  994.   def draw_background(header, v)
  995.     return unless v[3][0]
  996.     return if (!header && v[3][1] == false)
  997.     bitmap = Cache.system(v[3][2])
  998.     contents.blt(v[3][3], v[3][4], bitmap, Rect.new(0, 0, v[3][5], v[3][6]))
  999.   end
  1000.   #--------------------------------------------------------------------------
  1001.   # ● 绘制截图
  1002.   #--------------------------------------------------------------------------
  1003.   def draw_save_bitmap(header, index, v)
  1004.     return unless v[0][0]
  1005.     bitmap = @bitmaps[index]
  1006.     #bx = (width - standard_padding * 2 - bitmap.width) / 2
  1007.     contents.blt(v[0][1], v[0][2], bitmap, bitmap.rect)
  1008.   end
  1009.   #--------------------------------------------------------------------------
  1010.   # ● 绘制队伍角色行走图
  1011.   #--------------------------------------------------------------------------
  1012.   def draw_party_characters(header, index, v)
  1013.     return unless v[1][0]
  1014.     x = v[1][1]
  1015.     y = v[1][2]
  1016.     header[:characters].each_with_index do |data, i|
  1017.       draw_character(data[0], data[1], x + i * 48, y)
  1018.     end
  1019.   end
  1020.   #--------------------------------------------------------------------------
  1021.   # ● 绘制队伍角色脸谱
  1022.   #--------------------------------------------------------------------------
  1023.   def draw_party_faces(header, index, v)
  1024.     return unless v[2][0]
  1025.     x = v[2][1]
  1026.     y = v[2][2]
  1027.     header[:characters].each_with_index do |data, i|
  1028.       bit = Cache.face(data[2])
  1029.       rx = bit.width / 4
  1030.       draw_face(data[2], data[3], x + i * rx, y)
  1031.     end
  1032.   end
  1033.   #--------------------------------------------------------------------------
  1034.   # ● 绘制角色肖像图
  1035.   #     enabled : 有效的标志。false 的时候使用半透明效果绘制
  1036.   #--------------------------------------------------------------------------
  1037.   def draw_face(face_name, face_index, x, y, enabled = true)
  1038.     bitmap = Cache.face(face_name)
  1039.     w = bitmap.width / 4
  1040.     h = bitmap.height / 2
  1041.     rect = Rect.new(face_index % 4 * w, face_index / 4 * h, w, h)
  1042.     contents.blt(x + 4, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  1043.     bitmap.dispose
  1044.   end
  1045. end

  1046. #==============================================================================
  1047. # ■ Scene_File
  1048. #==============================================================================
  1049. class Scene_File < Scene_MenuBase
  1050.   #--------------------------------------------------------------------------
  1051.   # ● 开始处理
  1052.   #--------------------------------------------------------------------------
  1053.   def start
  1054.     super
  1055.     v = EASY_MENU_SET::FILES_RIM
  1056.     create_rim_background(v[0], v[1], v[2]) if v[0]
  1057.     create_actor_cg unless EASY_MENU_SET::FILES_DETAILS[0]
  1058.     create_help_window if EASY_MENU_SET::FILESLIST[5]
  1059.     create_savefile_windows
  1060.     create_details_window if EASY_MENU_SET::FILES_DETAILS[0]
  1061.     create_sub_button
  1062.     init_selection
  1063.   end
  1064.   #--------------------------------------------------------------------------
  1065.   # ● 结束处理
  1066.   #--------------------------------------------------------------------------
  1067.   def terminate
  1068.     super
  1069.   end
  1070.   #--------------------------------------------------------------------------
  1071.   # ● 更新画面
  1072.   #--------------------------------------------------------------------------
  1073.   def update
  1074.     super
  1075.     @details_window.set_select(@savefile_window.index) if @details_window
  1076.   end
  1077.   #--------------------------------------------------------------------------
  1078.   # ● 生成帮助窗口
  1079.   #--------------------------------------------------------------------------
  1080.   def create_help_window
  1081.     sp = EASY_MENU_SET::COMMAND[1]
  1082.     v = EASY_MENU_SET::FILESLIST
  1083.     w = v[0] > 0 ? v[0] : (Graphics.width / 2 - sp)
  1084.     @help_window = Window_Help.new(1, w)
  1085.     @help_window.set_text(help_window_text)
  1086.     @help_window.x = sp
  1087.     @help_window.y = sp + EASY_MENU_SET::COMMAND[3] - 8
  1088.   end
  1089.   #--------------------------------------------------------------------------
  1090.   # ● 获取帮助窗口的文本
  1091.   #--------------------------------------------------------------------------
  1092.   def help_window_text
  1093.     return ""
  1094.   end
  1095.   #--------------------------------------------------------------------------
  1096.   # ● 生成存档文件窗口
  1097.   #--------------------------------------------------------------------------
  1098.   def create_savefile_windows
  1099.     sp = EASY_MENU_SET::COMMAND[1]
  1100.     hy = sp + EASY_MENU_SET::COMMAND[3] - 8
  1101.     sy = @help_window ? (@help_window.y + @help_window.height) : hy
  1102.     v = EASY_MENU_SET::FILESLIST
  1103.     sw = v[0] > 0 ? v[0] : (Graphics.width / 2 - sp)
  1104.     sh = Graphics.height - sy - sp
  1105.     @savefile_window = Window_SaveFileList.new(sp, sy, sw, sh)
  1106.     @savefile_window.set_handler(:ok,     method(:on_savefile_ok))
  1107.     @savefile_window.set_handler(:cancel, method(:on_savefile_cancel))
  1108.   end
  1109.   #--------------------------------------------------------------------------
  1110.   # ● 生成详细文件窗口
  1111.   #--------------------------------------------------------------------------
  1112.   def create_details_window
  1113.     sp = EASY_MENU_SET::COMMAND[1]
  1114.     v = EASY_MENU_SET::FILES_DETAILS
  1115.     d = []
  1116.     if v[1]
  1117.       d[0] = @savefile_window.width + sp
  1118.       d[1] = @help_window.y
  1119.       d[2] = Graphics.width - d[0] - sp
  1120.       d[3] = Graphics.height - d[1] - sp
  1121.     else
  1122.       d = [v[2], v[3], v[4], v[5]]
  1123.     end
  1124.     @details_window = Window_FilesDetails.new(d[0], d[1], d[2], d[3])
  1125.   end
  1126.   #--------------------------------------------------------------------------
  1127.   # ● 初始化选择状态
  1128.   #--------------------------------------------------------------------------
  1129.   def init_selection
  1130.     index = first_savefile_index
  1131.     @savefile_window.select(index)
  1132.     @details_window.set_select(index) if @details_window
  1133.   end
  1134. end


  1135. #==============================================================================
  1136. # ■ Scene_Save
  1137. #==============================================================================
  1138. class Scene_Save < Scene_File
  1139.   #--------------------------------------------------------------------------
  1140.   # ● 开始处理
  1141.   #--------------------------------------------------------------------------
  1142.   def start
  1143.     Window_MenuCommand::init_command_position(:save)
  1144.     super
  1145.   end
  1146.   #--------------------------------------------------------------------------
  1147.   # ● 确定存档文件
  1148.   #--------------------------------------------------------------------------
  1149.   def on_savefile_ok
  1150.     super
  1151.     if DataManager.save_game(@savefile_window.index)
  1152.       on_save_success
  1153.     else
  1154.       Sound.play_buzzer
  1155.     end
  1156.   end
  1157.   #--------------------------------------------------------------------------
  1158.   # ● 存档成功时的处理
  1159.   #--------------------------------------------------------------------------
  1160.   def on_save_success
  1161.     Sound.play_save
  1162.     @savefile_window.set_files(:save)
  1163.     @details_window.refresh(@savefile_window.index) if @details_window
  1164.     Graphics.wait(30)
  1165.     if EASY_MENU_SET::FILES_RETURN
  1166.       return_scene
  1167.     else
  1168.       @savefile_window.set_files(nil)
  1169.       @savefile_window.activate
  1170.     end
  1171.   end
  1172. end


  1173. #==============================================================================
  1174. # ■ Scene_Load
  1175. #==============================================================================
  1176. class Scene_Load < Scene_File
  1177.   #--------------------------------------------------------------------------
  1178.   # ● 开始处理
  1179.   #--------------------------------------------------------------------------
  1180.   def start
  1181.     Window_MenuCommand::init_command_position(:continue)
  1182.     super
  1183.   end
  1184.   #--------------------------------------------------------------------------
  1185.   # ● 确定读档文件
  1186.   #--------------------------------------------------------------------------
  1187.   def on_savefile_ok
  1188.     super
  1189.     if DataManager.load_game(@savefile_window.index)
  1190.       on_load_success
  1191.     else
  1192.       Sound.play_buzzer
  1193.     end
  1194.   end
  1195.   #--------------------------------------------------------------------------
  1196.   # ● 读档成功时的处理
  1197.   #--------------------------------------------------------------------------
  1198.   def on_load_success
  1199.     Sound.play_load
  1200.     @savefile_window.set_files(:continue)
  1201.     Graphics.wait(20)
  1202.     fadeout_all
  1203.     $game_system.on_after_load
  1204.     SceneManager.goto(Scene_Map)
  1205.   end
  1206. end


  1207. #==============================================================================
  1208. # ■ DataManager
  1209. #==============================================================================
  1210. module DataManager
  1211.   #--------------------------------------------------------------------------
  1212.   # ● 判定存档文件是否存在
  1213.   #--------------------------------------------------------------------------
  1214.   def self.save_file_exists?
  1215.     if savefile_folder == ""
  1216.       text = 'Save*.rvdata2'
  1217.     else
  1218.       text = savefile_folder + '/Save*.rvdata2'
  1219.     end
  1220.     !Dir.glob(text).empty?
  1221.   end
  1222.   #--------------------------------------------------------------------------
  1223.   # ● 存档文件的最大数
  1224.   #--------------------------------------------------------------------------
  1225.   def self.savefile_max
  1226.     max = EASY_MENU_SET::FILES_MAX ? EASY_MENU_SET::FILES_MAX : 16
  1227.     return max
  1228.   end
  1229.   #--------------------------------------------------------------------------
  1230.   # ● 生成父文件夹
  1231.   #--------------------------------------------------------------------------
  1232.   def self.savefile_folder
  1233.     return EASY_MENU_SET::FILES_NAME
  1234.   end
  1235.   #--------------------------------------------------------------------------
  1236.   # ● 生成文件名
  1237.   #     index : 文件索引
  1238.   #--------------------------------------------------------------------------
  1239.   def self.make_filename(index)
  1240.     filename = sprintf("Save%02d.rvdata2", index + 1)
  1241.     if savefile_folder == ""
  1242.       return filename
  1243.     else
  1244.       return savefile_folder + "/" + filename
  1245.     end
  1246.   end
  1247.   #--------------------------------------------------------------------------
  1248.   # ● 生成截图
  1249.   #--------------------------------------------------------------------------
  1250.   def self.make_save_bitmap
  1251.     bitmap = set_bitmap_array(SceneManager.saves_bitmap)
  1252.     bitmap
  1253.   end
  1254.   #--------------------------------------------------------------------------
  1255.   # ● 获取截图
  1256.   #--------------------------------------------------------------------------
  1257.   def self.load_save_bitmap(index)
  1258.     begin
  1259.       File.open(make_filename(index), "rb") do |file|
  1260.         Marshal.load(file)
  1261.         return read_bitmap_array(Marshal.load(file))
  1262.       end
  1263.     rescue
  1264.       return nil
  1265.     end
  1266.   end
  1267.   #--------------------------------------------------------------------------
  1268.   # ● 制作截图文件 by 老鹰
  1269.   #--------------------------------------------------------------------------
  1270.   def self.set_bitmap_array(bitmap)
  1271.     data = []
  1272.     bitmap.height.times do |i| # 行号
  1273.       data[i] = []
  1274.       bitmap.width.times do |j| # 列号
  1275.         color = bitmap.get_pixel(j, i)
  1276.         data[i][j] = [color.red, color.green, color.blue]
  1277.       end
  1278.     end
  1279.     data
  1280.   end
  1281.   #--------------------------------------------------------------------------
  1282.   # ● 获取截图文件 by 老鹰
  1283.   #--------------------------------------------------------------------------
  1284.   def self.read_bitmap_array(array)
  1285.     h = array.size # 行数
  1286.     w = array[0].size # 列数
  1287.     bitmap = Bitmap.new(w, h)
  1288.     h.times do |i|
  1289.       w.times do |j|
  1290.         data = array[i][j]
  1291.         color = Color.new(data[0], data[1], data[2])
  1292.         bitmap.set_pixel(j, i, color)
  1293.       end
  1294.     end
  1295.     bitmap
  1296.   end
  1297.   #--------------------------------------------------------------------------
  1298.   # ● 执行存档(没有错误处理)
  1299.   #--------------------------------------------------------------------------
  1300.   def self.save_game_without_rescue(index)
  1301.     unless FileTest.directory?(savefile_folder)
  1302.       Dir::mkdir(savefile_folder)
  1303.     end
  1304.     File.open(make_filename(index), "wb") do |file|
  1305.       $game_system.on_before_save
  1306.       Marshal.dump(make_save_header, file)
  1307.       Marshal.dump(make_save_bitmap, file)
  1308.       Marshal.dump(make_save_contents, file)
  1309.       @last_savefile_index = index
  1310.     end
  1311.     return true
  1312.   end
  1313.   #--------------------------------------------------------------------------
  1314.   # ● 执行读档(没有错误处理)
  1315.   #--------------------------------------------------------------------------
  1316.   def self.load_game_without_rescue(index)
  1317.     File.open(make_filename(index), "rb") do |file|
  1318.       Marshal.load(file)
  1319.       Marshal.load(file)
  1320.       extract_save_contents(Marshal.load(file))
  1321.       reload_map_if_updated
  1322.       @last_savefile_index = index
  1323.     end
  1324.     return true
  1325.   end
  1326. end

  1327. #==============================================================================
  1328. # ■ Game_Party
  1329. #==============================================================================
  1330. class Game_Party < Game_Unit
  1331.   #--------------------------------------------------------------------------
  1332.   # ● 存档文件显示用的角色图像信息
  1333.   #--------------------------------------------------------------------------
  1334.   def characters_for_savefile
  1335.     battle_members.collect do |actor|
  1336.       [actor.character_name, actor.character_index,
  1337.        actor.face_name, actor.face_index]
  1338.     end
  1339.   end
  1340. end


  1341. #==============================================================================
  1342. # ■ Window_MenuStatus
  1343. #==============================================================================
  1344. class Window_MenuStatus < Window_Selectable
  1345.   #--------------------------------------------------------------------------
  1346.   # ● 获取窗口的宽度
  1347.   #--------------------------------------------------------------------------
  1348.   def window_width
  1349.     Graphics.width - 160 - 96
  1350.   end
  1351.   #--------------------------------------------------------------------------
  1352.   # ● 获取窗口的高度
  1353.   #--------------------------------------------------------------------------
  1354.   def window_height
  1355.     Graphics.height > 416 ? 416 : Graphics.height
  1356.   end
  1357. end

  1358. #==============================================================================
  1359. # ■ Window_GameEnd
  1360. #==============================================================================
  1361. class Window_GameEnd < Window_Command
  1362.   #--------------------------------------------------------------------------
  1363.   # ● 初始化对象
  1364.   #--------------------------------------------------------------------------
  1365.   alias easy_menu_initialize initialize
  1366.   def initialize
  1367.     easy_menu_initialize
  1368.     self.windowskin = Cache.system(EASY_MENU_SET::SKIN)
  1369.   end
  1370. end
复制代码


大佬能教我一下吗?我这个好像不太一样,怎么弄才能让那个存档方面失效?
...........
回复

使用道具 举报

梦石
0
星屑
30103
在线时间
5741 小时
注册时间
2016-3-8
回帖
1662
发表于 2021-4-4 23:00:33 | 显示全部楼层
最初の結果 发表于 2021-4-4 22:26
我的是这样的,怎么弄?大佬,能教教我吗?

那请你去下载最新版本替换掉旧版后, 再按2L的方法注释
https://rpg.blue/thread-476318-1-1.html
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部