查看: 5706|回复: 19

[已经解决] 想在Yanfly大佬的存档脚本的基础上改一下(自娱自乐不商业)

[复制链接]
梦石
0
星屑
567
在线时间
151 小时
注册时间
2018-9-25
回帖
25
发表于 2019-9-8 11:18:30 | 显示全部楼层 |阅读模式
悬赏47星屑已解决
本帖最后由 VIPArcher 于 2019-9-9 00:39 编辑

想在Yanfly大佬的存档脚本的基础上加个是否覆盖存档的存档提示-(已经搜了站内有关存档提示的脚本&扒下以前玩的游戏的存档提示的脚本(它们没用Yanfly大佬的存档脚本),但都跟这个冲突)
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - 存档系统 v1.03
  4. # -- 最后更新: 2012.07.22
  5. # -- 使用难度: 普通
  6. # -- 需要脚本: 无
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-SaveEngine"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.07.22 - Fixed: Location Drawing.
  15. # 2012.01.23 - Anti-crash method added for removed maps.
  16. # 2011.12.26 - Compatibility Update: New Game+
  17. # 2011.12.26 - Started Script and Finished.
  18. #
  19. #==============================================================================
  20. # ▼ 介绍
  21. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  22. # 本脚本为玩家提供一个新式存档界面,可以直接在存档界面读档或删除存档。同时为玩家
  23. # 显示更多的存档信息,例如地点、所持金钱以及其他任何你想要显示的变量。
  24. #
  25. # 如果你第一次使用此脚本,查看旧存档文件可能会出现丢失部分存档数据的情况,这时候
  26. # 需要你重新读档并再次存档。
  27. #
  28. #==============================================================================
  29. # ▼ 安装方式
  30. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  31. # 打开脚本编辑器,将本脚本拷贝/复制到一个在▼ 插件脚本之下▼ Main之上的新
  32. # 脚本页/槽中.记得保存你的工程以使脚本生效.
  33. #
  34. #==============================================================================
  35. # ▼ 兼容性
  36. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  37. # 本脚本仅为RPG Maker VX Ace编写.极不可能在无任何修改的情况下运行于RPG Maker VX.
  38. #
  39. #==============================================================================

  40. module YEA
  41.   module SAVE
  42.    
  43.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  44.     # - 存档文件窗口设置 -
  45.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

  46.     MAX_FILES = 16         # 最大存档数. 默认: 16
  47.     SLOT_NAME = "Save %s"  # 存档文件文本.
  48.    
  49.     # These are the icons
  50.     SAVE_ICON  = 368       # 已存档的图标
  51.     EMPTY_ICON = 375       # 未存档的图标
  52.    
  53.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  54.     # - 指令窗口设置 -
  55.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

  56.     ACTION_LOAD   = "载入"           # 载入的文本.
  57.     ACTION_SAVE   = "存档"           # 存档的文本.
  58.     ACTION_DELETE = "删除"           # 删除的文本.
  59.     DELETE_SOUND  = RPG::SE.new("Collapse3", 100, 100) # 删除的音效.
  60.    
  61.     # 在帮助窗口中显示的文本.
  62.     SELECT_HELP = "请选择一个存档文件."
  63.     LOAD_HELP   = "从已保存数据中载入."
  64.     SAVE_HELP   = "保存当前游戏数据."
  65.     DELETE_HELP = "删除全部已保存数据."
  66.    
  67.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  68.     # - 游戏状态窗口文本 -
  69.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

  70.     EMPTY_TEXT = "无存档数据"      # 无存档数据的文本.
  71.     PLAYTIME   = "游戏时间"        # 显示游戏时间的文本.
  72.     TOTAL_SAVE = "存档次数: "      # 存档次数的文本.
  73.     TOTAL_GOLD = "总金钱数: "      # 总金钱数的文本.
  74.     LOCATION   = "地点: "          # 地点的文本.
  75.    
  76.     # 在数组中填入你想要显示变量数值的变量ID,0为不显示
  77.     COLUMN1_VARIABLES = [381, 390, 495]
  78.     COLUMN2_VARIABLES = [707, 5, 6]
  79.    
  80.   end # SAVE
  81. end # YEA

  82. #==============================================================================
  83. # ▼ 编辑以下内容可能会出现电脑损坏、死机,电脑主人脑袋爆炸、昏迷、死亡或口臭
  84. # 所以编辑了后果自负。
  85. #==============================================================================

  86. #==============================================================================
  87. # ■ Icon
  88. #==============================================================================

  89. module Icon
  90.   
  91.   #--------------------------------------------------------------------------
  92.   # self.save_icon
  93.   #--------------------------------------------------------------------------
  94.   def self.save_icon; return YEA::SAVE::SAVE_ICON; end
  95.   
  96.   #--------------------------------------------------------------------------
  97.   # self.empty_icon
  98.   #--------------------------------------------------------------------------
  99.   def self.empty_icon; return YEA::SAVE::EMPTY_ICON; end
  100.    
  101. end # Icon

  102. #==============================================================================
  103. # ■ Numeric
  104. #==============================================================================

  105. class Numeric
  106.   
  107.   #--------------------------------------------------------------------------
  108.   # new method: group_digits
  109.   #--------------------------------------------------------------------------
  110.   unless $imported["YEA-CoreEngine"]
  111.   def group; return self.to_s; end
  112.   end # $imported["YEA-CoreEngine"]
  113.    
  114. end # Numeric

  115. #==============================================================================
  116. # ■ DataManager
  117. #==============================================================================

  118. module DataManager
  119.   
  120.   #--------------------------------------------------------------------------
  121.   # overwrite method: savefile_max
  122.   #--------------------------------------------------------------------------
  123.   def self.savefile_max
  124.     return YEA::SAVE::MAX_FILES
  125.   end
  126.   
  127.   #--------------------------------------------------------------------------
  128.   # overwrite method: self.make_save_header
  129.   #--------------------------------------------------------------------------
  130.   def self.make_save_header
  131.     header = {}
  132.     header[:characters]    = $game_party.characters_for_savefile
  133.     header[:playtime_s]    = $game_system.playtime_s
  134.     header[:system]        = Marshal.load(Marshal.dump($game_system))
  135.     header[:timer]         = Marshal.load(Marshal.dump($game_timer))
  136.     header[:message]       = Marshal.load(Marshal.dump($game_message))
  137.     header[:switches]      = Marshal.load(Marshal.dump($game_switches))
  138.     header[:variables]     = Marshal.load(Marshal.dump($game_variables))
  139.     header[:self_switches] = Marshal.load(Marshal.dump($game_self_switches))
  140.     header[:actors]        = Marshal.load(Marshal.dump($game_actors))
  141.     header[:party]         = Marshal.load(Marshal.dump($game_party))
  142.     header[:troop]         = Marshal.load(Marshal.dump($game_troop))
  143.     header[:map]           = Marshal.load(Marshal.dump($game_map))
  144.     header[:player]        = Marshal.load(Marshal.dump($game_player))
  145.     header
  146.   end
  147.   
  148. end # DataManager

  149. #==============================================================================
  150. # ■ Window_MenuCommand
  151. #==============================================================================

  152. class Window_MenuCommand < Window_Command
  153.   
  154.   #--------------------------------------------------------------------------
  155.   # overwrite method: save_enabled
  156.   #--------------------------------------------------------------------------
  157.   def save_enabled; return true; end
  158.   
  159. end # Window_MenuCommand

  160. #==============================================================================
  161. # ■ Window_FileList
  162. #==============================================================================

  163. class Window_FileList < Window_Selectable
  164.   
  165.   #--------------------------------------------------------------------------
  166.   # initialize
  167.   #--------------------------------------------------------------------------
  168.   def initialize(dx, dy)
  169.     super(dx, dy, 128, Graphics.height - dy)
  170.     refresh
  171.     activate
  172.     select(SceneManager.scene.first_savefile_index)
  173.   end
  174.   
  175.   #--------------------------------------------------------------------------
  176.   # item_max
  177.   #--------------------------------------------------------------------------
  178.   def item_max; return DataManager.savefile_max; end
  179.   
  180.   #--------------------------------------------------------------------------
  181.   # current_item_enabled?
  182.   #--------------------------------------------------------------------------
  183.   def current_item_enabled?
  184.     header = DataManager.load_header(index)
  185.     return false if header.nil? && SceneManager.scene_is?(Scene_Load)
  186.     return true
  187.   end
  188.   
  189.   #--------------------------------------------------------------------------
  190.   # refresh
  191.   #--------------------------------------------------------------------------
  192.   def refresh
  193.     create_contents
  194.     draw_all_items
  195.   end
  196.   
  197.   #--------------------------------------------------------------------------
  198.   # draw_item
  199.   #--------------------------------------------------------------------------
  200.   def draw_item(index)
  201.     header = DataManager.load_header(index)
  202.     enabled = !header.nil?
  203.     rect = item_rect(index)
  204.     rect.width -= 4
  205.     draw_icon(save_icon?(header), rect.x, rect.y, enabled)
  206.     change_color(normal_color, enabled)
  207.     text = sprintf(YEA::SAVE::SLOT_NAME, (index + 1).group)
  208.     draw_text(rect.x+24, rect.y, rect.width-24, line_height, text)
  209.   end
  210.   
  211.   #--------------------------------------------------------------------------
  212.   # save_icon?
  213.   #--------------------------------------------------------------------------
  214.   def save_icon?(header)
  215.     return Icon.empty_icon if header.nil?
  216.     return Icon.save_icon
  217.   end
  218.   
  219. end # Window_FileList

  220. #==============================================================================
  221. # ■ Window_FileStatus
  222. #==============================================================================

  223. class Window_FileStatus < Window_Base
  224.   
  225.   #--------------------------------------------------------------------------
  226.   # initialize
  227.   #--------------------------------------------------------------------------
  228.   def initialize(dx, dy, file_window)
  229.     super(dx, dy, Graphics.width - dx, Graphics.height - dy)
  230.     @file_window = file_window
  231.     @current_index = @file_window.index
  232.     refresh
  233.   end
  234.   
  235.   #--------------------------------------------------------------------------
  236.   # update
  237.   #--------------------------------------------------------------------------
  238.   def update
  239.     super
  240.     return if @file_window.index < 0
  241.     return if @current_index == @file_window.index
  242.     @current_index = @file_window.index
  243.     refresh
  244.   end
  245.   
  246.   #--------------------------------------------------------------------------
  247.   # refresh
  248.   #--------------------------------------------------------------------------
  249.   def refresh
  250.     contents.clear
  251.     reset_font_settings
  252.     @header = DataManager.load_header(@file_window.index)
  253.     if @header.nil?
  254.       draw_empty
  255.     else
  256.       draw_save_contents
  257.     end
  258.   end
  259.   
  260.   #--------------------------------------------------------------------------
  261.   # draw_empty
  262.   #--------------------------------------------------------------------------
  263.   def draw_empty
  264.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  265.     rect = Rect.new(0, 0, contents.width, contents.height)
  266.     contents.fill_rect(rect, colour)
  267.     text = YEA::SAVE::EMPTY_TEXT
  268.     change_color(system_color)
  269.     draw_text(rect, text, 1)
  270.   end
  271.   
  272.   #--------------------------------------------------------------------------
  273.   # draw_save_slot
  274.   #--------------------------------------------------------------------------
  275.   def draw_save_slot(dx, dy, dw)
  276.     reset_font_settings
  277.     change_color(system_color)
  278.     text = sprintf(YEA::SAVE::SLOT_NAME, "")
  279.     draw_text(dx, dy, dw, line_height, text)
  280.     cx = text_size(text).width
  281.     change_color(normal_color)
  282.     draw_text(dx+cx, dy, dw-cx, line_height, (@file_window.index+1).group)
  283.   end
  284.   
  285.   #--------------------------------------------------------------------------
  286.   # draw_save_playtime
  287.   #--------------------------------------------------------------------------
  288.   def draw_save_playtime(dx, dy, dw)
  289.     return if @header[:playtime_s].nil?
  290.     reset_font_settings
  291.     change_color(system_color)
  292.     draw_text(dx, dy, dw, line_height, YEA::SAVE::PLAYTIME, 0)
  293.     change_color(normal_color)
  294.     draw_text(dx, dy, dw, line_height, @header[:playtime_s], 2)
  295.   end
  296.   
  297.   #--------------------------------------------------------------------------
  298.   # draw_save_total_saves
  299.   #--------------------------------------------------------------------------
  300.   def draw_save_total_saves(dx, dy, dw)
  301.     return if @header[:system].nil?
  302.     reset_font_settings
  303.     change_color(system_color)
  304.     text = YEA::SAVE::TOTAL_SAVE
  305.     draw_text(dx, dy, dw, line_height, text)
  306.     cx = text_size(text).width
  307.     change_color(normal_color)
  308.     draw_text(dx+cx, dy, dw-cx, line_height, @header[:system].save_count.group)
  309.   end
  310.   
  311.   #--------------------------------------------------------------------------
  312.   # draw_save_gold
  313.   #--------------------------------------------------------------------------
  314.   def draw_save_gold(dx, dy, dw)
  315.     return if @header[:party].nil?
  316.     reset_font_settings
  317.     change_color(system_color)
  318.     draw_text(dx, dy, dw, line_height, YEA::SAVE::TOTAL_GOLD)
  319.     text = Vocab::currency_unit
  320.     draw_text(dx, dy, dw, line_height, text, 2)
  321.     cx = text_size(text).width
  322.     change_color(normal_color)
  323.     text = @header[:party].gold.group
  324.     draw_text(dx, dy, dw-cx, line_height, text, 2)
  325.   end
  326.   
  327.   #--------------------------------------------------------------------------
  328.   # draw_save_location
  329.   #--------------------------------------------------------------------------
  330.   def draw_save_location(dx, dy, dw)
  331.     return if @header[:map].nil?
  332.     reset_font_settings
  333.     change_color(system_color)
  334.     draw_text(dx, dy, dw, line_height, YEA::SAVE::LOCATION)
  335.     change_color(normal_color)
  336.     cx = text_size(YEA::SAVE::LOCATION).width
  337.     return if $data_mapinfos[@header[:map].map_id].nil?
  338.     text = @header[:map].display_name
  339.     text = $data_mapinfos[@header[:map].map_id].name if text == ""
  340.     draw_text(dx+cx, dy, dw-cx, line_height, text)
  341.   end
  342.   
  343.   #--------------------------------------------------------------------------
  344.   # draw_save_characters
  345.   #--------------------------------------------------------------------------
  346.   def draw_save_characters(dx, dy)
  347.     return if @header[:party].nil?
  348.     reset_font_settings
  349.     make_font_smaller
  350.     dw = (contents.width - dx) / @header[:party].max_battle_members
  351.     dx += dw/2
  352.     for member in @header[:party].battle_members
  353.       next if member.nil?
  354.       member = @header[:actors][member.id]
  355.       change_color(normal_color)
  356.       draw_actor_graphic(member, dx, dy)
  357.       text = member.name
  358.       draw_text(dx-dw/2, dy, dw, line_height, text, 1)
  359.       text = member.level.group
  360.       draw_text(dx-dw/2, dy-line_height, dw-4, line_height, text, 2)
  361.       cx = text_size(text).width
  362.       change_color(system_color)
  363.       text = Vocab::level_a
  364.       draw_text(dx-dw/2, dy-line_height, dw-cx-4, line_height, text, 2)
  365.       dx += dw
  366.     end
  367.   end
  368.   
  369.   #--------------------------------------------------------------------------
  370.   # draw_save_column1
  371.   #--------------------------------------------------------------------------
  372.   def draw_save_column1(dx, dy, dw)
  373.     data = YEA::SAVE::COLUMN1_VARIABLES
  374.     draw_column_data(data, dx, dy, dw)
  375.   end
  376.   
  377.   #--------------------------------------------------------------------------
  378.   # draw_save_column2
  379.   #--------------------------------------------------------------------------
  380.   def draw_save_column2(dx, dy, dw)
  381.     data = YEA::SAVE::COLUMN2_VARIABLES
  382.     draw_column_data(data, dx, dy, dw)
  383.   end
  384.   
  385.   #--------------------------------------------------------------------------
  386.   # draw_column_data
  387.   #--------------------------------------------------------------------------
  388.   def draw_column_data(data, dx, dy, dw)
  389.     return if @header[:variables].nil?
  390.     reset_font_settings
  391.     for variable_id in data
  392.       next if $data_system.variables[variable_id].nil?
  393.       change_color(system_color)
  394.       name = $data_system.variables[variable_id]
  395.       draw_text(dx, dy, dw, line_height, name, 0)
  396.       value = @header[:variables][variable_id].group
  397.       change_color(normal_color)
  398.       draw_text(dx, dy, dw, line_height, value, 2)
  399.       dy += line_height
  400.     end
  401.   end
  402.   
  403.   #--------------------------------------------------------------------------
  404.   # draw_save_contents
  405.   #--------------------------------------------------------------------------
  406.   def draw_save_contents
  407.     draw_save_slot(4, 0, contents.width/2-8)
  408.     draw_save_playtime(contents.width/2+4, 0, contents.width/2-8)
  409.     draw_save_total_saves(4, line_height, contents.width/2-8)
  410.     draw_save_gold(contents.width/2+4, line_height, contents.width/2-8)
  411.     draw_save_location(4, line_height*2, contents.width-8)
  412.     draw_save_characters(0, line_height*5 + line_height/3)
  413.     draw_save_column1(16, line_height*7, contents.width/2-48)
  414.     draw_save_column2(contents.width/2+16, line_height*7, contents.width/2-48)
  415.   end
  416.   
  417. end # Window_FileStatus

  418. #==============================================================================
  419. # ■ Window_FileAction
  420. #==============================================================================

  421. class Window_FileAction < Window_HorzCommand
  422.   
  423.   #--------------------------------------------------------------------------
  424.   # initialize
  425.   #--------------------------------------------------------------------------
  426.   def initialize(dx, dy, file_window)
  427.     @file_window = file_window
  428.     super(dx, dy)
  429.     deactivate
  430.     unselect
  431.   end
  432.   
  433.   #--------------------------------------------------------------------------
  434.   # window_width
  435.   #--------------------------------------------------------------------------
  436.   def window_width; Graphics.width - 128; end
  437.   
  438.   #--------------------------------------------------------------------------
  439.   # col_max
  440.   #--------------------------------------------------------------------------
  441.   def col_max; return 3; end
  442.   
  443.   #--------------------------------------------------------------------------
  444.   # update
  445.   #--------------------------------------------------------------------------
  446.   def update
  447.     super
  448.     return if @file_window.index < 0
  449.     return if @current_index == @file_window.index
  450.     @current_index = @file_window.index
  451.     refresh
  452.   end
  453.   
  454.   #--------------------------------------------------------------------------
  455.   # make_command_list
  456.   #--------------------------------------------------------------------------
  457.   def make_command_list
  458.     @header = DataManager.load_header(@file_window.index)
  459.     add_load_command
  460.     add_save_command
  461.     add_delete_command
  462.   end
  463.   
  464.   #--------------------------------------------------------------------------
  465.   # add_load_command
  466.   #--------------------------------------------------------------------------
  467.   def add_load_command
  468.     add_command(YEA::SAVE::ACTION_LOAD, :load, load_enabled?)
  469.   end
  470.   
  471.   #--------------------------------------------------------------------------
  472.   # load_enabled?
  473.   #--------------------------------------------------------------------------
  474.   def load_enabled?
  475.     return false if @header.nil?
  476.     return true
  477.   end
  478.   
  479.   #--------------------------------------------------------------------------
  480.   # add_save_command
  481.   #--------------------------------------------------------------------------
  482.   def add_save_command
  483.     add_command(YEA::SAVE::ACTION_SAVE, :save, save_enabled?)
  484.   end
  485.   
  486.   #--------------------------------------------------------------------------
  487.   # save_enabled?
  488.   #--------------------------------------------------------------------------
  489.   def save_enabled?
  490.     return false if @header.nil? && SceneManager.scene_is?(Scene_Load)
  491.     return false if SceneManager.scene_is?(Scene_Load)
  492.     return false if $game_system.save_disabled
  493.     return true
  494.   end
  495.   
  496.   #--------------------------------------------------------------------------
  497.   # add_delete_command
  498.   #--------------------------------------------------------------------------
  499.   def add_delete_command
  500.     add_command(YEA::SAVE::ACTION_DELETE, :delete, delete_enabled?)
  501.   end
  502.   
  503.   #--------------------------------------------------------------------------
  504.   # delete_enabled?
  505.   #--------------------------------------------------------------------------
  506.   def delete_enabled?
  507.     return false if @header.nil?
  508.     return true
  509.   end
  510.   
  511.   #--------------------------------------------------------------------------
  512.   # update_help
  513.   #--------------------------------------------------------------------------
  514.   def update_help
  515.     case current_symbol
  516.     when :load; @help_window.set_text(YEA::SAVE::LOAD_HELP)
  517.     when :save; @help_window.set_text(YEA::SAVE::SAVE_HELP)
  518.     when :delete; @help_window.set_text(YEA::SAVE::DELETE_HELP)
  519.     end
  520.   end
  521.   
  522. end # Window_FileAction

  523. #==============================================================================
  524. # ■ Scene_File
  525. #==============================================================================

  526. class Scene_File < Scene_MenuBase
  527.   
  528.   #--------------------------------------------------------------------------
  529.   # overwrite method: start
  530.   #--------------------------------------------------------------------------
  531.   def start
  532.     super
  533.     create_all_windows
  534.   end
  535.   
  536.   #--------------------------------------------------------------------------
  537.   # overwrite method: terminate
  538.   #--------------------------------------------------------------------------
  539.   def terminate
  540.     super
  541.   end
  542.   
  543.   #--------------------------------------------------------------------------
  544.   # overwrite method: update
  545.   #--------------------------------------------------------------------------
  546.   def update
  547.     super
  548.   end
  549.   
  550.   #--------------------------------------------------------------------------
  551.   # new method: create_all_windows
  552.   #--------------------------------------------------------------------------
  553.   def create_all_windows
  554.     create_help_window
  555.     create_file_window
  556.     create_action_window
  557.     create_status_window
  558.   end
  559.   
  560.   #--------------------------------------------------------------------------
  561.   # overwrite method: create_help_window
  562.   #--------------------------------------------------------------------------
  563.   def create_help_window
  564.     @help_window = Window_Help.new
  565.     @help_window.set_text(YEA::SAVE::SELECT_HELP)
  566.   end
  567.   
  568.   #--------------------------------------------------------------------------
  569.   # new method: create_file_window
  570.   #--------------------------------------------------------------------------
  571.   def create_file_window
  572.     wy = @help_window.height
  573.     @file_window = Window_FileList.new(0, wy)
  574.     @file_window.set_handler(:ok, method(:on_file_ok))
  575.     @file_window.set_handler(:cancel, method(:return_scene))
  576.   end
  577.   
  578.   #--------------------------------------------------------------------------
  579.   # new method: create_action_window
  580.   #--------------------------------------------------------------------------
  581.   def create_action_window
  582.     wx = @file_window.width
  583.     wy = @help_window.height
  584.     @action_window = Window_FileAction.new(wx, wy, @file_window)
  585.     @action_window.help_window = @help_window
  586.     @action_window.set_handler(:cancel, method(:on_action_cancel))
  587.     @action_window.set_handler(:load, method(:on_action_load))
  588.     @action_window.set_handler(:save, method(:on_action_save))
  589.     @action_window.set_handler(:delete, method(:on_action_delete))
  590.   end
  591.   
  592.   #--------------------------------------------------------------------------
  593.   # new method: create_status_window
  594.   #--------------------------------------------------------------------------
  595.   def create_status_window
  596.     wx = @action_window.x
  597.     wy = @action_window.y + @action_window.height
  598.     @status_window = Window_FileStatus.new(wx, wy, @file_window)
  599.   end
  600.   
  601.   #--------------------------------------------------------------------------
  602.   # new method: on_file_ok
  603.   #--------------------------------------------------------------------------
  604.   def on_file_ok
  605.     @action_window.activate
  606.     index = SceneManager.scene_is?(Scene_Load) ? 0 : 1
  607.     @action_window.select(index)
  608.   end
  609.   
  610.   #--------------------------------------------------------------------------
  611.   # new method: on_action_cancel
  612.   #--------------------------------------------------------------------------
  613.   def on_action_cancel
  614.     @action_window.unselect
  615.     @file_window.activate
  616.     @help_window.set_text(YEA::SAVE::SELECT_HELP)
  617.   end
  618.   
  619.   #--------------------------------------------------------------------------
  620.   # new method: on_action_load
  621.   #--------------------------------------------------------------------------
  622.   def on_action_load
  623.     if DataManager.load_game(@file_window.index)
  624.       on_load_success
  625.     else
  626.       Sound.play_buzzer
  627.     end
  628.   end
  629.   
  630.   #--------------------------------------------------------------------------
  631.   # overwrite method: on_load_success
  632.   #--------------------------------------------------------------------------
  633.   def on_load_success
  634.     Sound.play_load
  635.     fadeout_all
  636.     $game_system.on_after_load
  637.     SceneManager.goto(Scene_Map)
  638.   end
  639.   
  640.   #--------------------------------------------------------------------------
  641.   # new method: on_action_save
  642.   #--------------------------------------------------------------------------
  643.   def on_action_save
  644.     @action_window.activate
  645.     if DataManager.save_game(@file_window.index)
  646.       on_save_success
  647.       refresh_windows
  648.     else
  649.       Sound.play_buzzer
  650.     end
  651.   end
  652.   
  653.   #--------------------------------------------------------------------------
  654.   # overwrite method: on_save_success
  655.   #--------------------------------------------------------------------------
  656.   def on_save_success; Sound.play_save; end
  657.   
  658.   #--------------------------------------------------------------------------
  659.   # new method: on_action_delete
  660.   #--------------------------------------------------------------------------
  661.   def on_action_delete
  662.     @action_window.activate
  663.     DataManager.delete_save_file(@file_window.index)
  664.     on_delete_success
  665.     refresh_windows
  666.   end
  667.   
  668.   #--------------------------------------------------------------------------
  669.   # new method: on_delete_success
  670.   #--------------------------------------------------------------------------
  671.   def on_delete_success
  672.     YEA::SAVE::DELETE_SOUND.play
  673.   end
  674.   
  675.   #--------------------------------------------------------------------------
  676.   # new method: refresh_windows
  677.   #--------------------------------------------------------------------------
  678.   def refresh_windows
  679.     @file_window.refresh
  680.     @action_window.refresh
  681.     @status_window.refresh
  682.   end
  683.   
  684. end # Scene_File

  685. #==============================================================================
  686. # ■ Scene_Save
  687. #==============================================================================

  688. class Scene_Save < Scene_File
  689.   
  690.   #--------------------------------------------------------------------------
  691.   # overwrite method: on_savefile_ok
  692.   #--------------------------------------------------------------------------
  693.   def on_savefile_ok; super; end
  694.   
  695.   #--------------------------------------------------------------------------
  696.   # overwrite method: on_save_success
  697.   #--------------------------------------------------------------------------
  698.   def on_save_success; super; end
  699.   
  700. end # help_window_text

  701. #==============================================================================
  702. # ■ Scene_Load
  703. #==============================================================================

  704. class Scene_Load < Scene_File
  705.   
  706.   #--------------------------------------------------------------------------
  707.   # overwrite method: on_savefile_ok
  708.   #--------------------------------------------------------------------------
  709.   def on_savefile_ok; super; end
  710.   
  711.   #--------------------------------------------------------------------------
  712.   # overwrite method: on_load_success
  713.   #--------------------------------------------------------------------------
  714.   def on_load_success; super; end
  715.   
  716. end # Scene_Load

  717. #==============================================================================
  718. #
  719. # ■ End of File
  720. #
  721. #==============================================================================
复制代码

就是这个界面

就是这个界面

最佳答案

查看完整内容

新建工程测试通过
梦石
10
星屑
39550
在线时间
1919 小时
注册时间
2010-11-14
回帖
3214

R考场第七期纪念奖

发表于 2019-9-8 11:18:31 | 显示全部楼层
222.gif
新建工程测试通过

新建文本文档.zip (4.77 KB, 下载次数: 88)
用头画头像,用脚写脚本
回复

使用道具 举报

梦石
0
星屑
9917
在线时间
582 小时
注册时间
2017-9-28
回帖
207
发表于 2019-9-9 09:22:33 | 显示全部楼层
  1. # coding: utf-8
  2. # 请将本脚本放置于「Yanfly Engine Ace - 存档系统 v1.03」之后使用

  3. module YEA
  4.   module SAVE
  5.     # 在确认窗口中显示的文本
  6.     OVERRIDE_HELP = '是否覆盖存档?'
  7.   end
  8. end

  9. class Window_Confirm < Window_Base
  10.   attr_reader :index

  11.   def initialize(help_text = '')
  12.     super(0, 0, Graphics.width, fitting_height(2))
  13.     update_placement
  14.     self.arrows_visible = false
  15.     self.openness = 0
  16.     @index = 0
  17.     @handler = {}
  18.     set_text(help_text)
  19.     deactivate
  20.   end

  21.   def update_placement
  22.     self.x = (Graphics.width - width) / 2
  23.     self.y = (Graphics.height - height) / 2
  24.   end

  25.   def current_item
  26.     @index == 0 ? :yes : :no
  27.   end

  28.   def on sym, blk
  29.     @handler[sym] = blk
  30.   end

  31.   def update
  32.     super
  33.     update_cursor
  34.     update_handle
  35.   end

  36.   def active=(active)
  37.     super
  38.     update_cursor_rect
  39.   end

  40.   def index=(index)
  41.     @index = index
  42.     update_cursor_rect
  43.   end

  44.   def update_cursor_rect
  45.     cursor_rect.set(item_rect(@index))
  46.   end

  47.   def update_cursor
  48.     return unless open? && active
  49.     last_index = @index
  50.     cursor_left  if Input.repeat?(:LEFT)
  51.     cursor_right if Input.repeat?(:RIGHT)
  52.     Sound.play_cursor if @index != last_index
  53.   end

  54.   def update_handle
  55.     return unless open? && active
  56.     process_ok     if Input.trigger?(:C)
  57.     process_cancel if Input.trigger?(:B)
  58.   end

  59.   def cursor_left
  60.     self.index = (@index - 1) % 2
  61.   end

  62.   def cursor_right
  63.     self.index = (@index + 1) % 2
  64.   end

  65.   def process_ok
  66.     Sound.play_ok
  67.     Input.update
  68.     deactivate
  69.     handle(current_item)
  70.   end

  71.   def process_cancel
  72.     Sound.play_cancel
  73.     Input.update
  74.     deactivate
  75.     handle(:no)
  76.   end

  77.   def handle sym
  78.     @handler[sym].call if @handler.key?(sym)
  79.   end

  80.   def set_text(text)
  81.     if text != @text
  82.       @text = text
  83.       refresh
  84.     end
  85.   end

  86.   def refresh
  87.     contents.clear
  88.     draw_text_ex(4, 0, @text)
  89.     %w(是 否).each_with_index do |text, i|
  90.       contents.draw_text(item_rect(i), text, 1)
  91.     end
  92.   end

  93.   def item_width
  94.     120
  95.   end

  96.   def spacing
  97.     8
  98.   end

  99.   def item_rect(index)
  100.     x = contents_width - item_width * 2 - spacing
  101.     dx = item_width + spacing
  102.     rect = Rect.new(x + index * dx, line_height, item_width, line_height)
  103.   end
  104. end

  105. class Scene_File
  106.   alias _create_all_windows_confirm create_all_windows
  107.   def create_all_windows
  108.     _create_all_windows_confirm
  109.     create_confirm_window
  110.   end

  111.   def create_confirm_window
  112.     @confirm_window = Window_Confirm.new(YEA::SAVE::OVERRIDE_HELP)
  113.     @confirm_window.on(:yes, method(:on_confirm_yes))
  114.     @confirm_window.on(:no, method(:on_confirm_no))
  115.   end

  116.   alias _on_action_save_confirm on_action_save
  117.   def on_action_save
  118.     if DataManager.load_header(@file_window.index)
  119.       @confirm_window.index = 0
  120.       @confirm_window.activate.open
  121.     else
  122.       _on_action_save_confirm
  123.     end
  124.   end

  125.   def on_confirm_yes
  126.     _on_action_save_confirm
  127.     @confirm_window.close
  128.   end

  129.   def on_confirm_no
  130.     @confirm_window.close
  131.     @action_window.activate
  132.   end
  133. end
复制代码
喵喵喵
回复

使用道具 举报

梦石
0
星屑
487
在线时间
32 小时
注册时间
2019-8-6
回帖
18
发表于 2019-9-10 21:10:52 | 显示全部楼层
请问一下!我运行的时候第二个脚本说出错了qaq

存档"第129行:发生NameError。
undefined method 'create all windows' for class Scene File'

这么说的qaq

点评

你可能使用的不是 RMVA…… 或者别的脚本修改了 Scene_File 产生了冲突  发表于 2019-9-11 08:03
啥都不会的小菜鸡!
回复

使用道具 举报

梦石
0
星屑
567
在线时间
151 小时
注册时间
2018-9-25
回帖
25
 楼主| 发表于 2019-9-12 08:17:39 | 显示全部楼层
KB.Driver 发表于 2019-9-9 09:47
新建工程测试通过

谢谢哈我刚看见,待我测试下再给金币
回复

使用道具 举报

梦石
0
星屑
567
在线时间
151 小时
注册时间
2018-9-25
回帖
25
 楼主| 发表于 2019-9-12 08:39:41 | 显示全部楼层
KB.Driver 发表于 2019-9-8 11:18
新建工程测试通过

大佬已给金币,马后炮地问一下,在覆盖/取消上面加个是否覆盖此存档的陈述难吗?不难地话能告知下怎么微调脚本吗?当然你要忙或者有点难度地话就算了。

点评

不难,有时间给你加一下  发表于 2019-9-12 11:59
回复

使用道具 举报

梦石
10
星屑
39550
在线时间
1919 小时
注册时间
2010-11-14
回帖
3214

R考场第七期纪念奖

发表于 2019-9-12 13:03:21 | 显示全部楼层
杰克苏 发表于 2019-9-12 08:39
大佬已给金币,马后炮地问一下,在覆盖/取消上面加个是否覆盖此存档的陈述难吗?不难地话能告知下怎么微调 ...
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - 存档系统 v1.03
  4. # -- 最后更新: 2012.07.22
  5. # -- 使用难度: 普通
  6. # -- 需要脚本: 无
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-SaveEngine"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.07.22 - Fixed: Location Drawing.
  15. # 2012.01.23 - Anti-crash method added for removed maps.
  16. # 2011.12.26 - Compatibility Update: New Game+
  17. # 2011.12.26 - Started Script and Finished.
  18. #
  19. #==============================================================================
  20. # ▼ 介绍
  21. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  22. # 本脚本为玩家提供一个新式存档界面,可以直接在存档界面读档或删除存档。同时为玩家
  23. # 显示更多的存档信息,例如地点、所持金钱以及其他任何你想要显示的变量。
  24. #
  25. # 如果你第一次使用此脚本,查看旧存档文件可能会出现丢失部分存档数据的情况,这时候
  26. # 需要你重新读档并再次存档。
  27. #
  28. #==============================================================================
  29. # ▼ 安装方式
  30. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  31. # 打开脚本编辑器,将本脚本拷贝/复制到一个在▼ 插件脚本之下▼ Main之上的新
  32. # 脚本页/槽中.记得保存你的工程以使脚本生效.
  33. #
  34. #==============================================================================
  35. # ▼ 兼容性
  36. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  37. # 本脚本仅为RPG Maker VX Ace编写.极不可能在无任何修改的情况下运行于RPG Maker VX.
  38. #
  39. #==============================================================================

  40. module YEA
  41.   module SAVE

  42.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  43.     # - 存档文件窗口设置 -
  44.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

  45.     MAX_FILES = 16         # 最大存档数. 默认: 16
  46.     SLOT_NAME = "Save %s"  # 存档文件文本.

  47.     # These are the icons
  48.     SAVE_ICON  = 368       # 已存档的图标
  49.     EMPTY_ICON = 375       # 未存档的图标

  50.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  51.     # - 指令窗口设置 -
  52.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

  53.     ACTION_LOAD   = "载入"           # 载入的文本.
  54.     ACTION_SAVE   = "存档"           # 存档的文本.
  55.     ACTION_DELETE = "删除"           # 删除的文本.
  56.     DELETE_SOUND  = RPG::SE.new("Collapse3", 100, 100) # 删除的音效.

  57.     # 在帮助窗口中显示的文本.
  58.     SELECT_HELP = "请选择一个存档文件."
  59.     LOAD_HELP   = "从已保存数据中载入."
  60.     SAVE_HELP   = "保存当前游戏数据."
  61.     DELETE_HELP = "删除全部已保存数据."
  62.    
  63.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  64.     # - 覆盖窗口设置 -
  65.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  66.    
  67.     ACTION_OVERLAP = "覆盖"
  68.     ACTION_CANCEL  = "取消"
  69.     OVERLAP_HELP   = "是否覆盖此存档?"

  70.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  71.     # - 游戏状态窗口文本 -
  72.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

  73.     EMPTY_TEXT = "无存档数据"      # 无存档数据的文本.
  74.     PLAYTIME   = "游戏时间"        # 显示游戏时间的文本.
  75.     TOTAL_SAVE = "存档次数: "      # 存档次数的文本.
  76.     TOTAL_GOLD = "总金钱数: "      # 总金钱数的文本.
  77.     LOCATION   = "地点: "          # 地点的文本.

  78.     # 在数组中填入你想要显示变量数值的变量ID,0为不显示
  79.     COLUMN1_VARIABLES = [381, 390, 495]
  80.     COLUMN2_VARIABLES = [707, 5, 6]

  81.   end # SAVE
  82. end # YEA

  83. #==============================================================================
  84. # ▼ 编辑以下内容可能会出现电脑损坏、死机,电脑主人脑袋爆炸、昏迷、死亡或口臭
  85. # 所以编辑了后果自负。
  86. #==============================================================================

  87. #==============================================================================
  88. # ■ Icon
  89. #==============================================================================

  90. module Icon

  91.   #--------------------------------------------------------------------------
  92.   # self.save_icon
  93.   #--------------------------------------------------------------------------
  94.   def self.save_icon; return YEA::SAVE::SAVE_ICON; end

  95.   #--------------------------------------------------------------------------
  96.   # self.empty_icon
  97.   #--------------------------------------------------------------------------
  98.   def self.empty_icon; return YEA::SAVE::EMPTY_ICON; end

  99. end # Icon

  100. #==============================================================================
  101. # ■ Numeric
  102. #==============================================================================

  103. class Numeric

  104.   #--------------------------------------------------------------------------
  105.   # new method: group_digits
  106.   #--------------------------------------------------------------------------
  107.   unless $imported["YEA-CoreEngine"]
  108.   def group; return self.to_s; end
  109.   end # $imported["YEA-CoreEngine"]

  110. end # Numeric

  111. #==============================================================================
  112. # ■ DataManager
  113. #==============================================================================

  114. module DataManager

  115.   #--------------------------------------------------------------------------
  116.   # overwrite method: savefile_max
  117.   #--------------------------------------------------------------------------
  118.   def self.savefile_max
  119.     return YEA::SAVE::MAX_FILES
  120.   end

  121.   #--------------------------------------------------------------------------
  122.   # overwrite method: self.make_save_header
  123.   #--------------------------------------------------------------------------
  124.   def self.make_save_header
  125.     header = {}
  126.     header[:characters]    = $game_party.characters_for_savefile
  127.     header[:playtime_s]    = $game_system.playtime_s
  128.     header[:system]        = Marshal.load(Marshal.dump($game_system))
  129.     header[:timer]         = Marshal.load(Marshal.dump($game_timer))
  130.     header[:message]       = Marshal.load(Marshal.dump($game_message))
  131.     header[:switches]      = Marshal.load(Marshal.dump($game_switches))
  132.     header[:variables]     = Marshal.load(Marshal.dump($game_variables))
  133.     header[:self_switches] = Marshal.load(Marshal.dump($game_self_switches))
  134.     header[:actors]        = Marshal.load(Marshal.dump($game_actors))
  135.     header[:party]         = Marshal.load(Marshal.dump($game_party))
  136.     header[:troop]         = Marshal.load(Marshal.dump($game_troop))
  137.     header[:map]           = Marshal.load(Marshal.dump($game_map))
  138.     header[:player]        = Marshal.load(Marshal.dump($game_player))
  139.     header
  140.   end

  141. end # DataManager

  142. #==============================================================================
  143. # ■ Window_MenuCommand
  144. #==============================================================================

  145. class Window_MenuCommand < Window_Command

  146.   #--------------------------------------------------------------------------
  147.   # overwrite method: save_enabled
  148.   #--------------------------------------------------------------------------
  149.   def save_enabled; return true; end

  150. end # Window_MenuCommand

  151. #==============================================================================
  152. # ■ Window_FileList
  153. #==============================================================================

  154. class Window_FileList < Window_Selectable

  155.   #--------------------------------------------------------------------------
  156.   # initialize
  157.   #--------------------------------------------------------------------------
  158.   def initialize(dx, dy)
  159.     super(dx, dy, 128, Graphics.height - dy)
  160.     refresh
  161.     activate
  162.     select(SceneManager.scene.first_savefile_index)
  163.   end

  164.   #--------------------------------------------------------------------------
  165.   # item_max
  166.   #--------------------------------------------------------------------------
  167.   def item_max; return DataManager.savefile_max; end

  168.   #--------------------------------------------------------------------------
  169.   # current_item_enabled?
  170.   #--------------------------------------------------------------------------
  171.   def current_item_enabled?
  172.     header = DataManager.load_header(index)
  173.     return false if header.nil? && SceneManager.scene_is?(Scene_Load)
  174.     return true
  175.   end

  176.   #--------------------------------------------------------------------------
  177.   # refresh
  178.   #--------------------------------------------------------------------------
  179.   def refresh
  180.     create_contents
  181.     draw_all_items
  182.   end

  183.   #--------------------------------------------------------------------------
  184.   # draw_item
  185.   #--------------------------------------------------------------------------
  186.   def draw_item(index)
  187.     header = DataManager.load_header(index)
  188.     enabled = !header.nil?
  189.     rect = item_rect(index)
  190.     rect.width -= 4
  191.     draw_icon(save_icon?(header), rect.x, rect.y, enabled)
  192.     change_color(normal_color, enabled)
  193.     text = sprintf(YEA::SAVE::SLOT_NAME, (index + 1).group)
  194.     draw_text(rect.x+24, rect.y, rect.width-24, line_height, text)
  195.   end

  196.   #--------------------------------------------------------------------------
  197.   # save_icon?
  198.   #--------------------------------------------------------------------------
  199.   def save_icon?(header)
  200.     return Icon.empty_icon if header.nil?
  201.     return Icon.save_icon
  202.   end

  203. end # Window_FileList

  204. #==============================================================================
  205. # ■ Window_FileStatus
  206. #==============================================================================

  207. class Window_FileStatus < Window_Base

  208.   #--------------------------------------------------------------------------
  209.   # initialize
  210.   #--------------------------------------------------------------------------
  211.   def initialize(dx, dy, file_window)
  212.     super(dx, dy, Graphics.width - dx, Graphics.height - dy)
  213.     @file_window = file_window
  214.     @current_index = @file_window.index
  215.     refresh
  216.   end

  217.   #--------------------------------------------------------------------------
  218.   # update
  219.   #--------------------------------------------------------------------------
  220.   def update
  221.     super
  222.     return if @file_window.index < 0
  223.     return if @current_index == @file_window.index
  224.     @current_index = @file_window.index
  225.     refresh
  226.   end

  227.   #--------------------------------------------------------------------------
  228.   # refresh
  229.   #--------------------------------------------------------------------------
  230.   def refresh
  231.     contents.clear
  232.     reset_font_settings
  233.     @header = DataManager.load_header(@file_window.index)
  234.     if @header.nil?
  235.       draw_empty
  236.     else
  237.       draw_save_contents
  238.     end
  239.   end

  240.   #--------------------------------------------------------------------------
  241.   # draw_empty
  242.   #--------------------------------------------------------------------------
  243.   def draw_empty
  244.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  245.     rect = Rect.new(0, 0, contents.width, contents.height)
  246.     contents.fill_rect(rect, colour)
  247.     text = YEA::SAVE::EMPTY_TEXT
  248.     change_color(system_color)
  249.     draw_text(rect, text, 1)
  250.   end

  251.   #--------------------------------------------------------------------------
  252.   # draw_save_slot
  253.   #--------------------------------------------------------------------------
  254.   def draw_save_slot(dx, dy, dw)
  255.     reset_font_settings
  256.     change_color(system_color)
  257.     text = sprintf(YEA::SAVE::SLOT_NAME, "")
  258.     draw_text(dx, dy, dw, line_height, text)
  259.     cx = text_size(text).width
  260.     change_color(normal_color)
  261.     draw_text(dx+cx, dy, dw-cx, line_height, (@file_window.index+1).group)
  262.   end

  263.   #--------------------------------------------------------------------------
  264.   # draw_save_playtime
  265.   #--------------------------------------------------------------------------
  266.   def draw_save_playtime(dx, dy, dw)
  267.     return if @header[:playtime_s].nil?
  268.     reset_font_settings
  269.     change_color(system_color)
  270.     draw_text(dx, dy, dw, line_height, YEA::SAVE::PLAYTIME, 0)
  271.     change_color(normal_color)
  272.     draw_text(dx, dy, dw, line_height, @header[:playtime_s], 2)
  273.   end

  274.   #--------------------------------------------------------------------------
  275.   # draw_save_total_saves
  276.   #--------------------------------------------------------------------------
  277.   def draw_save_total_saves(dx, dy, dw)
  278.     return if @header[:system].nil?
  279.     reset_font_settings
  280.     change_color(system_color)
  281.     text = YEA::SAVE::TOTAL_SAVE
  282.     draw_text(dx, dy, dw, line_height, text)
  283.     cx = text_size(text).width
  284.     change_color(normal_color)
  285.     draw_text(dx+cx, dy, dw-cx, line_height, @header[:system].save_count.group)
  286.   end

  287.   #--------------------------------------------------------------------------
  288.   # draw_save_gold
  289.   #--------------------------------------------------------------------------
  290.   def draw_save_gold(dx, dy, dw)
  291.     return if @header[:party].nil?
  292.     reset_font_settings
  293.     change_color(system_color)
  294.     draw_text(dx, dy, dw, line_height, YEA::SAVE::TOTAL_GOLD)
  295.     text = Vocab::currency_unit
  296.     draw_text(dx, dy, dw, line_height, text, 2)
  297.     cx = text_size(text).width
  298.     change_color(normal_color)
  299.     text = @header[:party].gold.group
  300.     draw_text(dx, dy, dw-cx, line_height, text, 2)
  301.   end

  302.   #--------------------------------------------------------------------------
  303.   # draw_save_location
  304.   #--------------------------------------------------------------------------
  305.   def draw_save_location(dx, dy, dw)
  306.     return if @header[:map].nil?
  307.     reset_font_settings
  308.     change_color(system_color)
  309.     draw_text(dx, dy, dw, line_height, YEA::SAVE::LOCATION)
  310.     change_color(normal_color)
  311.     cx = text_size(YEA::SAVE::LOCATION).width
  312.     return if $data_mapinfos[@header[:map].map_id].nil?
  313.     text = @header[:map].display_name
  314.     text = $data_mapinfos[@header[:map].map_id].name if text == ""
  315.     draw_text(dx+cx, dy, dw-cx, line_height, text)
  316.   end

  317.   #--------------------------------------------------------------------------
  318.   # draw_save_characters
  319.   #--------------------------------------------------------------------------
  320.   def draw_save_characters(dx, dy)
  321.     return if @header[:party].nil?
  322.     reset_font_settings
  323.     make_font_smaller
  324.     dw = (contents.width - dx) / @header[:party].max_battle_members
  325.     dx += dw/2
  326.     for member in @header[:party].battle_members
  327.       next if member.nil?
  328.       member = @header[:actors][member.id]
  329.       change_color(normal_color)
  330.       draw_actor_graphic(member, dx, dy)
  331.       text = member.name
  332.       draw_text(dx-dw/2, dy, dw, line_height, text, 1)
  333.       text = member.level.group
  334.       draw_text(dx-dw/2, dy-line_height, dw-4, line_height, text, 2)
  335.       cx = text_size(text).width
  336.       change_color(system_color)
  337.       text = Vocab::level_a
  338.       draw_text(dx-dw/2, dy-line_height, dw-cx-4, line_height, text, 2)
  339.       dx += dw
  340.     end
  341.   end

  342.   #--------------------------------------------------------------------------
  343.   # draw_save_column1
  344.   #--------------------------------------------------------------------------
  345.   def draw_save_column1(dx, dy, dw)
  346.     data = YEA::SAVE::COLUMN1_VARIABLES
  347.     draw_column_data(data, dx, dy, dw)
  348.   end

  349.   #--------------------------------------------------------------------------
  350.   # draw_save_column2
  351.   #--------------------------------------------------------------------------
  352.   def draw_save_column2(dx, dy, dw)
  353.     data = YEA::SAVE::COLUMN2_VARIABLES
  354.     draw_column_data(data, dx, dy, dw)
  355.   end

  356.   #--------------------------------------------------------------------------
  357.   # draw_column_data
  358.   #--------------------------------------------------------------------------
  359.   def draw_column_data(data, dx, dy, dw)
  360.     return if @header[:variables].nil?
  361.     reset_font_settings
  362.     for variable_id in data
  363.       next if $data_system.variables[variable_id].nil?
  364.       change_color(system_color)
  365.       name = $data_system.variables[variable_id]
  366.       draw_text(dx, dy, dw, line_height, name, 0)
  367.       value = @header[:variables][variable_id].group
  368.       change_color(normal_color)
  369.       draw_text(dx, dy, dw, line_height, value, 2)
  370.       dy += line_height
  371.     end
  372.   end

  373.   #--------------------------------------------------------------------------
  374.   # draw_save_contents
  375.   #--------------------------------------------------------------------------
  376.   def draw_save_contents
  377.     draw_save_slot(4, 0, contents.width/2-8)
  378.     draw_save_playtime(contents.width/2+4, 0, contents.width/2-8)
  379.     draw_save_total_saves(4, line_height, contents.width/2-8)
  380.     draw_save_gold(contents.width/2+4, line_height, contents.width/2-8)
  381.     draw_save_location(4, line_height*2, contents.width-8)
  382.     draw_save_characters(0, line_height*5 + line_height/3)
  383.     draw_save_column1(16, line_height*7, contents.width/2-48)
  384.     draw_save_column2(contents.width/2+16, line_height*7, contents.width/2-48)
  385.   end

  386. end # Window_FileStatus

  387. #==============================================================================
  388. # ■ Window_FileAction
  389. #==============================================================================

  390. class Window_FileAction < Window_HorzCommand

  391.   #--------------------------------------------------------------------------
  392.   # initialize
  393.   #--------------------------------------------------------------------------
  394.   def initialize(dx, dy, file_window)
  395.     @file_window = file_window
  396.     super(dx, dy)
  397.     deactivate
  398.     unselect
  399.   end

  400.   #--------------------------------------------------------------------------
  401.   # window_width
  402.   #--------------------------------------------------------------------------
  403.   def window_width; Graphics.width - 128; end

  404.   #--------------------------------------------------------------------------
  405.   # col_max
  406.   #--------------------------------------------------------------------------
  407.   def col_max; return 3; end

  408.   #--------------------------------------------------------------------------
  409.   # update
  410.   #--------------------------------------------------------------------------
  411.   def update
  412.     super
  413.     return if @file_window.index < 0
  414.     return if @current_index == @file_window.index
  415.     @current_index = @file_window.index
  416.     refresh
  417.   end

  418.   #--------------------------------------------------------------------------
  419.   # make_command_list
  420.   #--------------------------------------------------------------------------
  421.   def make_command_list
  422.     @header = DataManager.load_header(@file_window.index)
  423.     add_load_command
  424.     add_save_command
  425.     add_delete_command
  426.   end

  427.   #--------------------------------------------------------------------------
  428.   # add_load_command
  429.   #--------------------------------------------------------------------------
  430.   def add_load_command
  431.     add_command(YEA::SAVE::ACTION_LOAD, :load, load_enabled?)
  432.   end

  433.   #--------------------------------------------------------------------------
  434.   # load_enabled?
  435.   #--------------------------------------------------------------------------
  436.   def load_enabled?
  437.     return false if @header.nil?
  438.     return true
  439.   end

  440.   #--------------------------------------------------------------------------
  441.   # add_save_command
  442.   #--------------------------------------------------------------------------
  443.   def add_save_command
  444.     add_command(YEA::SAVE::ACTION_SAVE, :save, save_enabled?)
  445.   end

  446.   #--------------------------------------------------------------------------
  447.   # save_enabled?
  448.   #--------------------------------------------------------------------------
  449.   def save_enabled?
  450.     return false if @header.nil? && SceneManager.scene_is?(Scene_Load)
  451.     return false if SceneManager.scene_is?(Scene_Load)
  452.     return false if $game_system.save_disabled
  453.     return true
  454.   end

  455.   #--------------------------------------------------------------------------
  456.   # add_delete_command
  457.   #--------------------------------------------------------------------------
  458.   def add_delete_command
  459.     add_command(YEA::SAVE::ACTION_DELETE, :delete, delete_enabled?)
  460.   end

  461.   #--------------------------------------------------------------------------
  462.   # delete_enabled?
  463.   #--------------------------------------------------------------------------
  464.   def delete_enabled?
  465.     return false if @header.nil?
  466.     return true
  467.   end

  468.   #--------------------------------------------------------------------------
  469.   # update_help
  470.   #--------------------------------------------------------------------------
  471.   def update_help
  472.     case current_symbol
  473.     when :load; @help_window.set_text(YEA::SAVE::LOAD_HELP)
  474.     when :save; @help_window.set_text(YEA::SAVE::SAVE_HELP)
  475.     when :delete; @help_window.set_text(YEA::SAVE::DELETE_HELP)
  476.     end
  477.   end

  478. end # Window_FileAction

  479. #==============================================================================
  480. # ■ Scene_File
  481. #==============================================================================

  482. class Scene_File < Scene_MenuBase

  483.   #--------------------------------------------------------------------------
  484.   # overwrite method: start
  485.   #--------------------------------------------------------------------------
  486.   def start
  487.     super
  488.     create_all_windows
  489.   end

  490.   #--------------------------------------------------------------------------
  491.   # overwrite method: terminate
  492.   #--------------------------------------------------------------------------
  493.   def terminate
  494.     super
  495.   end

  496.   #--------------------------------------------------------------------------
  497.   # overwrite method: update
  498.   #--------------------------------------------------------------------------
  499.   def update
  500.     super
  501.   end

  502.   #--------------------------------------------------------------------------
  503.   # new method: create_all_windows
  504.   #--------------------------------------------------------------------------
  505.   def create_all_windows
  506.     create_help_window
  507.     create_file_window
  508.     create_action_window
  509.     create_status_window
  510.   end

  511.   #--------------------------------------------------------------------------
  512.   # overwrite method: create_help_window
  513.   #--------------------------------------------------------------------------
  514.   def create_help_window
  515.     @help_window = Window_Help.new
  516.     @help_window.set_text(YEA::SAVE::SELECT_HELP)
  517.   end

  518.   #--------------------------------------------------------------------------
  519.   # new method: create_file_window
  520.   #--------------------------------------------------------------------------
  521.   def create_file_window
  522.     wy = @help_window.height
  523.     @file_window = Window_FileList.new(0, wy)
  524.     @file_window.set_handler(:ok, method(:on_file_ok))
  525.     @file_window.set_handler(:cancel, method(:return_scene))
  526.   end

  527.   #--------------------------------------------------------------------------
  528.   # new method: create_action_window
  529.   #--------------------------------------------------------------------------
  530.   def create_action_window
  531.     wx = @file_window.width
  532.     wy = @help_window.height
  533.     @action_window = Window_FileAction.new(wx, wy, @file_window)
  534.     @action_window.help_window = @help_window
  535.     @action_window.set_handler(:cancel, method(:on_action_cancel))
  536.     @action_window.set_handler(:load, method(:on_action_load))
  537.     @action_window.set_handler(:save, method(:on_action_save))
  538.     @action_window.set_handler(:delete, method(:on_action_delete))
  539.   end

  540.   #--------------------------------------------------------------------------
  541.   # new method: create_status_window
  542.   #--------------------------------------------------------------------------
  543.   def create_status_window
  544.     wx = @action_window.x
  545.     wy = @action_window.y + @action_window.height
  546.     @status_window = Window_FileStatus.new(wx, wy, @file_window)
  547.   end

  548.   #--------------------------------------------------------------------------
  549.   # new method: on_file_ok
  550.   #--------------------------------------------------------------------------
  551.   def on_file_ok
  552.     @action_window.activate
  553.     index = SceneManager.scene_is?(Scene_Load) ? 0 : 1
  554.     @action_window.select(index)
  555.   end

  556.   #--------------------------------------------------------------------------
  557.   # new method: on_action_cancel
  558.   #--------------------------------------------------------------------------
  559.   def on_action_cancel
  560.     @action_window.unselect
  561.     @file_window.activate
  562.     @help_window.set_text(YEA::SAVE::SELECT_HELP)
  563.   end

  564.   #--------------------------------------------------------------------------
  565.   # new method: on_action_load
  566.   #--------------------------------------------------------------------------
  567.   def on_action_load
  568.     if DataManager.load_game(@file_window.index)
  569.       on_load_success
  570.     else
  571.       Sound.play_buzzer
  572.     end
  573.   end

  574.   #--------------------------------------------------------------------------
  575.   # overwrite method: on_load_success
  576.   #--------------------------------------------------------------------------
  577.   def on_load_success
  578.     Sound.play_load
  579.     fadeout_all
  580.     $game_system.on_after_load
  581.     SceneManager.goto(Scene_Map)
  582.   end

  583.   #--------------------------------------------------------------------------
  584.   # new method: on_action_save
  585.   #--------------------------------------------------------------------------
  586.   def on_action_save
  587.     @action_window.activate
  588.     if DataManager.save_game(@file_window.index)
  589.       on_save_success
  590.       refresh_windows
  591.     else
  592.       Sound.play_buzzer
  593.     end
  594.   end
  595.   
  596. #~   # 此处修改 ----------------------------------------------------------------
  597. #~   alias on_action_save_original on_action_save
  598. #~   def on_action_save
  599. #~     if File.exist?(DataManager.make_filename(@file_window.index)) # 存档已经存在
  600. #~       @action_window.deactivate
  601. #~       @overlap_window.show.open.activate
  602. #~     else
  603. #~       on_action_save_with_overlap
  604. #~     end
  605. #~   end
  606. #~   
  607. #~   def on_action_save_with_overlap
  608. #~     on_action_save_original
  609. #~     on_action_save_cancel
  610. #~   end
  611. #~   
  612. #~   def on_action_save_cancel
  613. #~     @action_window.activate
  614. #~     @overlap_window.hide.close.deactivate
  615. #~   end
  616. #~   # -------------------------------------------------------------------------  
  617.    

  618.   #--------------------------------------------------------------------------
  619.   # overwrite method: on_save_success
  620.   #--------------------------------------------------------------------------
  621.   def on_save_success; Sound.play_save; end

  622.   #--------------------------------------------------------------------------
  623.   # new method: on_action_delete
  624.   #--------------------------------------------------------------------------
  625.   def on_action_delete
  626.     @action_window.activate
  627.     DataManager.delete_save_file(@file_window.index)
  628.     on_delete_success
  629.     refresh_windows
  630.   end

  631.   #--------------------------------------------------------------------------
  632.   # new method: on_delete_success
  633.   #--------------------------------------------------------------------------
  634.   def on_delete_success
  635.     YEA::SAVE::DELETE_SOUND.play
  636.   end

  637.   #--------------------------------------------------------------------------
  638.   # new method: refresh_windows
  639.   #--------------------------------------------------------------------------
  640.   def refresh_windows
  641.     @file_window.refresh
  642.     @action_window.refresh
  643.     @status_window.refresh
  644.   end

  645. end # Scene_File

  646. #==============================================================================
  647. # ■ Scene_Save
  648. #==============================================================================

  649. class Scene_Save < Scene_File

  650.   #--------------------------------------------------------------------------
  651.   # overwrite method: on_savefile_ok
  652.   #--------------------------------------------------------------------------
  653.   def on_savefile_ok; super; end

  654.   #--------------------------------------------------------------------------
  655.   # overwrite method: on_save_success
  656.   #--------------------------------------------------------------------------
  657.   def on_save_success; super; end

  658. end # help_window_text

  659. #==============================================================================
  660. # ■ Scene_Load
  661. #==============================================================================

  662. class Scene_Load < Scene_File

  663.   #--------------------------------------------------------------------------
  664.   # overwrite method: on_savefile_ok
  665.   #--------------------------------------------------------------------------
  666.   def on_savefile_ok; super; end

  667.   #--------------------------------------------------------------------------
  668.   # overwrite method: on_load_success
  669.   #--------------------------------------------------------------------------
  670.   def on_load_success; super; end

  671. end # Scene_Load

  672. #==============================================================================
  673. #
  674. # ■ End of File
  675. #
  676. #==============================================================================

  677. class Scene_File
  678.   
  679.   alias create_all_windows_original create_all_windows
  680.   def create_all_windows
  681.     create_all_windows_original
  682.     create_overlap_window
  683.   end
  684.   
  685.   class Window_Overlap < Window_HorzCommand
  686.     def window_width
  687.       Bitmap.new(1,1).text_size(YEA::SAVE::OVERLAP_HELP).width + 24 + 8
  688.     end
  689.     def visible_line_number; 2; end
  690.     def col_max; 2; end
  691.     def contents_height
  692.       height - standard_padding * 2
  693.     end
  694.     def item_rect(index)
  695.       rect = super
  696.       rect.y += line_height
  697.       rect
  698.     end
  699.     def draw_all_items
  700.       rect = item_rect_for_text(0)
  701.       rect.y -= line_height
  702.       rect.width = contents.width
  703.       draw_text(rect, YEA::SAVE::OVERLAP_HELP)
  704.       super
  705.     end
  706.     def make_command_list
  707.       add_command(YEA::SAVE::ACTION_OVERLAP, :overlap)
  708.       add_command(YEA::SAVE::ACTION_CANCEL , :cancel )
  709.     end
  710.   end

  711.   def create_overlap_window
  712.     @overlap_window = Window_Overlap.new(0, 0)
  713.     @overlap_window.set_handler(:overlap, method(:on_action_save_with_overlap))
  714.     @overlap_window.set_handler(:cancel, method(:on_action_save_cancel))
  715.     @overlap_window.x = (Graphics.width - @overlap_window.width) / 2
  716.     @overlap_window.y = (Graphics.height - @overlap_window.height) / 2  
  717.     @overlap_window.hide.close.deactivate
  718.   end
  719.   
  720.   alias on_action_save_original on_action_save
  721.   def on_action_save
  722.     if File.exist?(DataManager.make_filename(@file_window.index)) # 存档已经存在
  723.       @action_window.deactivate
  724.       @overlap_window.show.open.activate
  725.     else
  726.       on_action_save_with_overlap
  727.     end
  728.   end
  729.   
  730.   def on_action_save_with_overlap
  731.     on_action_save_original
  732.     on_action_save_cancel
  733.   end
  734.   
  735.   def on_action_save_cancel
  736.     @action_window.activate
  737.     @overlap_window.hide.close.deactivate
  738.   end
  739. end
复制代码


_20190912130045.png
用头画头像,用脚写脚本
回复

使用道具 举报

头像被屏蔽
梦石
0
星屑
177
在线时间
936 小时
注册时间
2010-11-13
回帖
897
发表于 2019-9-12 18:55:44 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复

使用道具 举报

头像被屏蔽
梦石
0
星屑
177
在线时间
936 小时
注册时间
2010-11-13
回帖
897
发表于 2019-9-12 18:56:36 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复

使用道具 举报

梦石
0
星屑
567
在线时间
151 小时
注册时间
2018-9-25
回帖
25
 楼主| 发表于 2019-9-12 21:38:30 | 显示全部楼层
KB.Driver 发表于 2019-9-12 13:03
#==============================================================================
#
# ▼ Yanfly Eng ...

谢谢大佬,大佬那个存档界面能改成这样的吗(就是在描述和选项中间加一根分割线)?如果可行的话有空的时候希望再麻烦一下大佬,我可以加金币(我的权限好像不能私信 )。
未标题-1.jpg

点评

自学Window_Status代码68~74行  发表于 2019-9-14 23:50
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部