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

Project1

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

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

[复制链接]

Lv2.观梦者

梦石
0
星屑
711
在线时间
137 小时
注册时间
2018-9-25
帖子
26
跳转到指定楼层
1
发表于 2019-9-8 11:18:30 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
47星屑
本帖最后由 VIPArcher 于 2019-9-9 00:39 编辑

想在Yanfly大佬的存档脚本的基础上加个是否覆盖存档的存档提示-(已经搜了站内有关存档提示的脚本&扒下以前玩的游戏的存档提示的脚本(它们没用Yanfly大佬的存档脚本),但都跟这个冲突)
RUBY 代码复制
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - 存档系统 v1.03
  4. # -- 最后更新: 2012.07.22
  5. # -- 使用难度: 普通
  6. # -- 需要脚本: 无
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-SaveEngine"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.07.22 - Fixed: Location Drawing.
  17. # 2012.01.23 - Anti-crash method added for removed maps.
  18. # 2011.12.26 - Compatibility Update: New Game+
  19. # 2011.12.26 - Started Script and Finished.
  20. #
  21. #==============================================================================
  22. # ▼ 介绍
  23. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  24. # 本脚本为玩家提供一个新式存档界面,可以直接在存档界面读档或删除存档。同时为玩家
  25. # 显示更多的存档信息,例如地点、所持金钱以及其他任何你想要显示的变量。
  26. #
  27. # 如果你第一次使用此脚本,查看旧存档文件可能会出现丢失部分存档数据的情况,这时候
  28. # 需要你重新读档并再次存档。
  29. #
  30. #==============================================================================
  31. # ▼ 安装方式
  32. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  33. # 打开脚本编辑器,将本脚本拷贝/复制到一个在▼ 插件脚本之下▼ Main之上的新
  34. # 脚本页/槽中.记得保存你的工程以使脚本生效.
  35. #
  36. #==============================================================================
  37. # ▼ 兼容性
  38. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  39. # 本脚本仅为RPG Maker VX Ace编写.极不可能在无任何修改的情况下运行于RPG Maker VX.
  40. #
  41. #==============================================================================
  42.  
  43. module YEA
  44.   module SAVE
  45.  
  46.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  47.     # - 存档文件窗口设置 -
  48.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  49.  
  50.     MAX_FILES = 16         # 最大存档数. 默认: 16
  51.     SLOT_NAME = "Save %s"  # 存档文件文本.
  52.  
  53.     # These are the icons
  54.     SAVE_ICON  = 368       # 已存档的图标
  55.     EMPTY_ICON = 375       # 未存档的图标
  56.  
  57.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  58.     # - 指令窗口设置 -
  59.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  60.  
  61.     ACTION_LOAD   = "载入"           # 载入的文本.
  62.     ACTION_SAVE   = "存档"           # 存档的文本.
  63.     ACTION_DELETE = "删除"           # 删除的文本.
  64.     DELETE_SOUND  = RPG::SE.new("Collapse3", 100, 100) # 删除的音效.
  65.  
  66.     # 在帮助窗口中显示的文本.
  67.     SELECT_HELP = "请选择一个存档文件."
  68.     LOAD_HELP   = "从已保存数据中载入."
  69.     SAVE_HELP   = "保存当前游戏数据."
  70.     DELETE_HELP = "删除全部已保存数据."
  71.  
  72.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  73.     # - 游戏状态窗口文本 -
  74.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  75.  
  76.     EMPTY_TEXT = "无存档数据"      # 无存档数据的文本.
  77.     PLAYTIME   = "游戏时间"        # 显示游戏时间的文本.
  78.     TOTAL_SAVE = "存档次数: "      # 存档次数的文本.
  79.     TOTAL_GOLD = "总金钱数: "      # 总金钱数的文本.
  80.     LOCATION   = "地点: "          # 地点的文本.
  81.  
  82.     # 在数组中填入你想要显示变量数值的变量ID,0为不显示
  83.     COLUMN1_VARIABLES = [381, 390, 495]
  84.     COLUMN2_VARIABLES = [707, 5, 6]
  85.  
  86.   end # SAVE
  87. end # YEA
  88.  
  89. #==============================================================================
  90. # ▼ 编辑以下内容可能会出现电脑损坏、死机,电脑主人脑袋爆炸、昏迷、死亡或口臭
  91. # 所以编辑了后果自负。
  92. #==============================================================================
  93.  
  94. #==============================================================================
  95. # ■ Icon
  96. #==============================================================================
  97.  
  98. module Icon
  99.  
  100.   #--------------------------------------------------------------------------
  101.   # self.save_icon
  102.   #--------------------------------------------------------------------------
  103.   def self.save_icon; return YEA::SAVE::SAVE_ICON; end
  104.  
  105.   #--------------------------------------------------------------------------
  106.   # self.empty_icon
  107.   #--------------------------------------------------------------------------
  108.   def self.empty_icon; return YEA::SAVE::EMPTY_ICON; end
  109.  
  110. end # Icon
  111.  
  112. #==============================================================================
  113. # ■ Numeric
  114. #==============================================================================
  115.  
  116. class Numeric
  117.  
  118.   #--------------------------------------------------------------------------
  119.   # new method: group_digits
  120.   #--------------------------------------------------------------------------
  121.   unless $imported["YEA-CoreEngine"]
  122.   def group; return self.to_s; end
  123.   end # $imported["YEA-CoreEngine"]
  124.  
  125. end # Numeric
  126.  
  127. #==============================================================================
  128. # ■ DataManager
  129. #==============================================================================
  130.  
  131. module DataManager
  132.  
  133.   #--------------------------------------------------------------------------
  134.   # overwrite method: savefile_max
  135.   #--------------------------------------------------------------------------
  136.   def self.savefile_max
  137.     return YEA::SAVE::MAX_FILES
  138.   end
  139.  
  140.   #--------------------------------------------------------------------------
  141.   # overwrite method: self.make_save_header
  142.   #--------------------------------------------------------------------------
  143.   def self.make_save_header
  144.     header = {}
  145.     header[:characters]    = $game_party.characters_for_savefile
  146.     header[:playtime_s]    = $game_system.playtime_s
  147.     header[:system]        = Marshal.load(Marshal.dump($game_system))
  148.     header[:timer]         = Marshal.load(Marshal.dump($game_timer))
  149.     header[:message]       = Marshal.load(Marshal.dump($game_message))
  150.     header[:switches]      = Marshal.load(Marshal.dump($game_switches))
  151.     header[:variables]     = Marshal.load(Marshal.dump($game_variables))
  152.     header[:self_switches] = Marshal.load(Marshal.dump($game_self_switches))
  153.     header[:actors]        = Marshal.load(Marshal.dump($game_actors))
  154.     header[:party]         = Marshal.load(Marshal.dump($game_party))
  155.     header[:troop]         = Marshal.load(Marshal.dump($game_troop))
  156.     header[:map]           = Marshal.load(Marshal.dump($game_map))
  157.     header[:player]        = Marshal.load(Marshal.dump($game_player))
  158.     header
  159.   end
  160.  
  161. end # DataManager
  162.  
  163. #==============================================================================
  164. # ■ Window_MenuCommand
  165. #==============================================================================
  166.  
  167. class Window_MenuCommand < Window_Command
  168.  
  169.   #--------------------------------------------------------------------------
  170.   # overwrite method: save_enabled
  171.   #--------------------------------------------------------------------------
  172.   def save_enabled; return true; end
  173.  
  174. end # Window_MenuCommand
  175.  
  176. #==============================================================================
  177. # ■ Window_FileList
  178. #==============================================================================
  179.  
  180. class Window_FileList < Window_Selectable
  181.  
  182.   #--------------------------------------------------------------------------
  183.   # initialize
  184.   #--------------------------------------------------------------------------
  185.   def initialize(dx, dy)
  186.     super(dx, dy, 128, Graphics.height - dy)
  187.     refresh
  188.     activate
  189.     select(SceneManager.scene.first_savefile_index)
  190.   end
  191.  
  192.   #--------------------------------------------------------------------------
  193.   # item_max
  194.   #--------------------------------------------------------------------------
  195.   def item_max; return DataManager.savefile_max; end
  196.  
  197.   #--------------------------------------------------------------------------
  198.   # current_item_enabled?
  199.   #--------------------------------------------------------------------------
  200.   def current_item_enabled?
  201.     header = DataManager.load_header(index)
  202.     return false if header.nil? && SceneManager.scene_is?(Scene_Load)
  203.     return true
  204.   end
  205.  
  206.   #--------------------------------------------------------------------------
  207.   # refresh
  208.   #--------------------------------------------------------------------------
  209.   def refresh
  210.     create_contents
  211.     draw_all_items
  212.   end
  213.  
  214.   #--------------------------------------------------------------------------
  215.   # draw_item
  216.   #--------------------------------------------------------------------------
  217.   def draw_item(index)
  218.     header = DataManager.load_header(index)
  219.     enabled = !header.nil?
  220.     rect = item_rect(index)
  221.     rect.width -= 4
  222.     draw_icon(save_icon?(header), rect.x, rect.y, enabled)
  223.     change_color(normal_color, enabled)
  224.     text = sprintf(YEA::SAVE::SLOT_NAME, (index + 1).group)
  225.     draw_text(rect.x+24, rect.y, rect.width-24, line_height, text)
  226.   end
  227.  
  228.   #--------------------------------------------------------------------------
  229.   # save_icon?
  230.   #--------------------------------------------------------------------------
  231.   def save_icon?(header)
  232.     return Icon.empty_icon if header.nil?
  233.     return Icon.save_icon
  234.   end
  235.  
  236. end # Window_FileList
  237.  
  238. #==============================================================================
  239. # ■ Window_FileStatus
  240. #==============================================================================
  241.  
  242. class Window_FileStatus < Window_Base
  243.  
  244.   #--------------------------------------------------------------------------
  245.   # initialize
  246.   #--------------------------------------------------------------------------
  247.   def initialize(dx, dy, file_window)
  248.     super(dx, dy, Graphics.width - dx, Graphics.height - dy)
  249.     @file_window = file_window
  250.     @current_index = @file_window.index
  251.     refresh
  252.   end
  253.  
  254.   #--------------------------------------------------------------------------
  255.   # update
  256.   #--------------------------------------------------------------------------
  257.   def update
  258.     super
  259.     return if @file_window.index < 0
  260.     return if @current_index == @file_window.index
  261.     @current_index = @file_window.index
  262.     refresh
  263.   end
  264.  
  265.   #--------------------------------------------------------------------------
  266.   # refresh
  267.   #--------------------------------------------------------------------------
  268.   def refresh
  269.     contents.clear
  270.     reset_font_settings
  271.     @header = DataManager.load_header(@file_window.index)
  272.     if @header.nil?
  273.       draw_empty
  274.     else
  275.       draw_save_contents
  276.     end
  277.   end
  278.  
  279.   #--------------------------------------------------------------------------
  280.   # draw_empty
  281.   #--------------------------------------------------------------------------
  282.   def draw_empty
  283.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  284.     rect = Rect.new(0, 0, contents.width, contents.height)
  285.     contents.fill_rect(rect, colour)
  286.     text = YEA::SAVE::EMPTY_TEXT
  287.     change_color(system_color)
  288.     draw_text(rect, text, 1)
  289.   end
  290.  
  291.   #--------------------------------------------------------------------------
  292.   # draw_save_slot
  293.   #--------------------------------------------------------------------------
  294.   def draw_save_slot(dx, dy, dw)
  295.     reset_font_settings
  296.     change_color(system_color)
  297.     text = sprintf(YEA::SAVE::SLOT_NAME, "")
  298.     draw_text(dx, dy, dw, line_height, text)
  299.     cx = text_size(text).width
  300.     change_color(normal_color)
  301.     draw_text(dx+cx, dy, dw-cx, line_height, (@file_window.index+1).group)
  302.   end
  303.  
  304.   #--------------------------------------------------------------------------
  305.   # draw_save_playtime
  306.   #--------------------------------------------------------------------------
  307.   def draw_save_playtime(dx, dy, dw)
  308.     return if @header[:playtime_s].nil?
  309.     reset_font_settings
  310.     change_color(system_color)
  311.     draw_text(dx, dy, dw, line_height, YEA::SAVE::PLAYTIME, 0)
  312.     change_color(normal_color)
  313.     draw_text(dx, dy, dw, line_height, @header[:playtime_s], 2)
  314.   end
  315.  
  316.   #--------------------------------------------------------------------------
  317.   # draw_save_total_saves
  318.   #--------------------------------------------------------------------------
  319.   def draw_save_total_saves(dx, dy, dw)
  320.     return if @header[:system].nil?
  321.     reset_font_settings
  322.     change_color(system_color)
  323.     text = YEA::SAVE::TOTAL_SAVE
  324.     draw_text(dx, dy, dw, line_height, text)
  325.     cx = text_size(text).width
  326.     change_color(normal_color)
  327.     draw_text(dx+cx, dy, dw-cx, line_height, @header[:system].save_count.group)
  328.   end
  329.  
  330.   #--------------------------------------------------------------------------
  331.   # draw_save_gold
  332.   #--------------------------------------------------------------------------
  333.   def draw_save_gold(dx, dy, dw)
  334.     return if @header[:party].nil?
  335.     reset_font_settings
  336.     change_color(system_color)
  337.     draw_text(dx, dy, dw, line_height, YEA::SAVE::TOTAL_GOLD)
  338.     text = Vocab::currency_unit
  339.     draw_text(dx, dy, dw, line_height, text, 2)
  340.     cx = text_size(text).width
  341.     change_color(normal_color)
  342.     text = @header[:party].gold.group
  343.     draw_text(dx, dy, dw-cx, line_height, text, 2)
  344.   end
  345.  
  346.   #--------------------------------------------------------------------------
  347.   # draw_save_location
  348.   #--------------------------------------------------------------------------
  349.   def draw_save_location(dx, dy, dw)
  350.     return if @header[:map].nil?
  351.     reset_font_settings
  352.     change_color(system_color)
  353.     draw_text(dx, dy, dw, line_height, YEA::SAVE::LOCATION)
  354.     change_color(normal_color)
  355.     cx = text_size(YEA::SAVE::LOCATION).width
  356.     return if $data_mapinfos[@header[:map].map_id].nil?
  357.     text = @header[:map].display_name
  358.     text = $data_mapinfos[@header[:map].map_id].name if text == ""
  359.     draw_text(dx+cx, dy, dw-cx, line_height, text)
  360.   end
  361.  
  362.   #--------------------------------------------------------------------------
  363.   # draw_save_characters
  364.   #--------------------------------------------------------------------------
  365.   def draw_save_characters(dx, dy)
  366.     return if @header[:party].nil?
  367.     reset_font_settings
  368.     make_font_smaller
  369.     dw = (contents.width - dx) / @header[:party].max_battle_members
  370.     dx += dw/2
  371.     for member in @header[:party].battle_members
  372.       next if member.nil?
  373.       member = @header[:actors][member.id]
  374.       change_color(normal_color)
  375.       draw_actor_graphic(member, dx, dy)
  376.       text = member.name
  377.       draw_text(dx-dw/2, dy, dw, line_height, text, 1)
  378.       text = member.level.group
  379.       draw_text(dx-dw/2, dy-line_height, dw-4, line_height, text, 2)
  380.       cx = text_size(text).width
  381.       change_color(system_color)
  382.       text = Vocab::level_a
  383.       draw_text(dx-dw/2, dy-line_height, dw-cx-4, line_height, text, 2)
  384.       dx += dw
  385.     end
  386.   end
  387.  
  388.   #--------------------------------------------------------------------------
  389.   # draw_save_column1
  390.   #--------------------------------------------------------------------------
  391.   def draw_save_column1(dx, dy, dw)
  392.     data = YEA::SAVE::COLUMN1_VARIABLES
  393.     draw_column_data(data, dx, dy, dw)
  394.   end
  395.  
  396.   #--------------------------------------------------------------------------
  397.   # draw_save_column2
  398.   #--------------------------------------------------------------------------
  399.   def draw_save_column2(dx, dy, dw)
  400.     data = YEA::SAVE::COLUMN2_VARIABLES
  401.     draw_column_data(data, dx, dy, dw)
  402.   end
  403.  
  404.   #--------------------------------------------------------------------------
  405.   # draw_column_data
  406.   #--------------------------------------------------------------------------
  407.   def draw_column_data(data, dx, dy, dw)
  408.     return if @header[:variables].nil?
  409.     reset_font_settings
  410.     for variable_id in data
  411.       next if $data_system.variables[variable_id].nil?
  412.       change_color(system_color)
  413.       name = $data_system.variables[variable_id]
  414.       draw_text(dx, dy, dw, line_height, name, 0)
  415.       value = @header[:variables][variable_id].group
  416.       change_color(normal_color)
  417.       draw_text(dx, dy, dw, line_height, value, 2)
  418.       dy += line_height
  419.     end
  420.   end
  421.  
  422.   #--------------------------------------------------------------------------
  423.   # draw_save_contents
  424.   #--------------------------------------------------------------------------
  425.   def draw_save_contents
  426.     draw_save_slot(4, 0, contents.width/2-8)
  427.     draw_save_playtime(contents.width/2+4, 0, contents.width/2-8)
  428.     draw_save_total_saves(4, line_height, contents.width/2-8)
  429.     draw_save_gold(contents.width/2+4, line_height, contents.width/2-8)
  430.     draw_save_location(4, line_height*2, contents.width-8)
  431.     draw_save_characters(0, line_height*5 + line_height/3)
  432.     draw_save_column1(16, line_height*7, contents.width/2-48)
  433.     draw_save_column2(contents.width/2+16, line_height*7, contents.width/2-48)
  434.   end
  435.  
  436. end # Window_FileStatus
  437.  
  438. #==============================================================================
  439. # ■ Window_FileAction
  440. #==============================================================================
  441.  
  442. class Window_FileAction < Window_HorzCommand
  443.  
  444.   #--------------------------------------------------------------------------
  445.   # initialize
  446.   #--------------------------------------------------------------------------
  447.   def initialize(dx, dy, file_window)
  448.     @file_window = file_window
  449.     super(dx, dy)
  450.     deactivate
  451.     unselect
  452.   end
  453.  
  454.   #--------------------------------------------------------------------------
  455.   # window_width
  456.   #--------------------------------------------------------------------------
  457.   def window_width; Graphics.width - 128; end
  458.  
  459.   #--------------------------------------------------------------------------
  460.   # col_max
  461.   #--------------------------------------------------------------------------
  462.   def col_max; return 3; end
  463.  
  464.   #--------------------------------------------------------------------------
  465.   # update
  466.   #--------------------------------------------------------------------------
  467.   def update
  468.     super
  469.     return if @file_window.index < 0
  470.     return if @current_index == @file_window.index
  471.     @current_index = @file_window.index
  472.     refresh
  473.   end
  474.  
  475.   #--------------------------------------------------------------------------
  476.   # make_command_list
  477.   #--------------------------------------------------------------------------
  478.   def make_command_list
  479.     @header = DataManager.load_header(@file_window.index)
  480.     add_load_command
  481.     add_save_command
  482.     add_delete_command
  483.   end
  484.  
  485.   #--------------------------------------------------------------------------
  486.   # add_load_command
  487.   #--------------------------------------------------------------------------
  488.   def add_load_command
  489.     add_command(YEA::SAVE::ACTION_LOAD, :load, load_enabled?)
  490.   end
  491.  
  492.   #--------------------------------------------------------------------------
  493.   # load_enabled?
  494.   #--------------------------------------------------------------------------
  495.   def load_enabled?
  496.     return false if @header.nil?
  497.     return true
  498.   end
  499.  
  500.   #--------------------------------------------------------------------------
  501.   # add_save_command
  502.   #--------------------------------------------------------------------------
  503.   def add_save_command
  504.     add_command(YEA::SAVE::ACTION_SAVE, :save, save_enabled?)
  505.   end
  506.  
  507.   #--------------------------------------------------------------------------
  508.   # save_enabled?
  509.   #--------------------------------------------------------------------------
  510.   def save_enabled?
  511.     return false if @header.nil? && SceneManager.scene_is?(Scene_Load)
  512.     return false if SceneManager.scene_is?(Scene_Load)
  513.     return false if $game_system.save_disabled
  514.     return true
  515.   end
  516.  
  517.   #--------------------------------------------------------------------------
  518.   # add_delete_command
  519.   #--------------------------------------------------------------------------
  520.   def add_delete_command
  521.     add_command(YEA::SAVE::ACTION_DELETE, :delete, delete_enabled?)
  522.   end
  523.  
  524.   #--------------------------------------------------------------------------
  525.   # delete_enabled?
  526.   #--------------------------------------------------------------------------
  527.   def delete_enabled?
  528.     return false if @header.nil?
  529.     return true
  530.   end
  531.  
  532.   #--------------------------------------------------------------------------
  533.   # update_help
  534.   #--------------------------------------------------------------------------
  535.   def update_help
  536.     case current_symbol
  537.     when :load; @help_window.set_text(YEA::SAVE::LOAD_HELP)
  538.     when :save; @help_window.set_text(YEA::SAVE::SAVE_HELP)
  539.     when :delete; @help_window.set_text(YEA::SAVE::DELETE_HELP)
  540.     end
  541.   end
  542.  
  543. end # Window_FileAction
  544.  
  545. #==============================================================================
  546. # ■ Scene_File
  547. #==============================================================================
  548.  
  549. class Scene_File < Scene_MenuBase
  550.  
  551.   #--------------------------------------------------------------------------
  552.   # overwrite method: start
  553.   #--------------------------------------------------------------------------
  554.   def start
  555.     super
  556.     create_all_windows
  557.   end
  558.  
  559.   #--------------------------------------------------------------------------
  560.   # overwrite method: terminate
  561.   #--------------------------------------------------------------------------
  562.   def terminate
  563.     super
  564.   end
  565.  
  566.   #--------------------------------------------------------------------------
  567.   # overwrite method: update
  568.   #--------------------------------------------------------------------------
  569.   def update
  570.     super
  571.   end
  572.  
  573.   #--------------------------------------------------------------------------
  574.   # new method: create_all_windows
  575.   #--------------------------------------------------------------------------
  576.   def create_all_windows
  577.     create_help_window
  578.     create_file_window
  579.     create_action_window
  580.     create_status_window
  581.   end
  582.  
  583.   #--------------------------------------------------------------------------
  584.   # overwrite method: create_help_window
  585.   #--------------------------------------------------------------------------
  586.   def create_help_window
  587.     @help_window = Window_Help.new
  588.     @help_window.set_text(YEA::SAVE::SELECT_HELP)
  589.   end
  590.  
  591.   #--------------------------------------------------------------------------
  592.   # new method: create_file_window
  593.   #--------------------------------------------------------------------------
  594.   def create_file_window
  595.     wy = @help_window.height
  596.     @file_window = Window_FileList.new(0, wy)
  597.     @file_window.set_handler(:ok, method(:on_file_ok))
  598.     @file_window.set_handler(:cancel, method(:return_scene))
  599.   end
  600.  
  601.   #--------------------------------------------------------------------------
  602.   # new method: create_action_window
  603.   #--------------------------------------------------------------------------
  604.   def create_action_window
  605.     wx = @file_window.width
  606.     wy = @help_window.height
  607.     @action_window = Window_FileAction.new(wx, wy, @file_window)
  608.     @action_window.help_window = @help_window
  609.     @action_window.set_handler(:cancel, method(:on_action_cancel))
  610.     @action_window.set_handler(:load, method(:on_action_load))
  611.     @action_window.set_handler(:save, method(:on_action_save))
  612.     @action_window.set_handler(:delete, method(:on_action_delete))
  613.   end
  614.  
  615.   #--------------------------------------------------------------------------
  616.   # new method: create_status_window
  617.   #--------------------------------------------------------------------------
  618.   def create_status_window
  619.     wx = @action_window.x
  620.     wy = @action_window.y + @action_window.height
  621.     @status_window = Window_FileStatus.new(wx, wy, @file_window)
  622.   end
  623.  
  624.   #--------------------------------------------------------------------------
  625.   # new method: on_file_ok
  626.   #--------------------------------------------------------------------------
  627.   def on_file_ok
  628.     @action_window.activate
  629.     index = SceneManager.scene_is?(Scene_Load) ? 0 : 1
  630.     @action_window.select(index)
  631.   end
  632.  
  633.   #--------------------------------------------------------------------------
  634.   # new method: on_action_cancel
  635.   #--------------------------------------------------------------------------
  636.   def on_action_cancel
  637.     @action_window.unselect
  638.     @file_window.activate
  639.     @help_window.set_text(YEA::SAVE::SELECT_HELP)
  640.   end
  641.  
  642.   #--------------------------------------------------------------------------
  643.   # new method: on_action_load
  644.   #--------------------------------------------------------------------------
  645.   def on_action_load
  646.     if DataManager.load_game(@file_window.index)
  647.       on_load_success
  648.     else
  649.       Sound.play_buzzer
  650.     end
  651.   end
  652.  
  653.   #--------------------------------------------------------------------------
  654.   # overwrite method: on_load_success
  655.   #--------------------------------------------------------------------------
  656.   def on_load_success
  657.     Sound.play_load
  658.     fadeout_all
  659.     $game_system.on_after_load
  660.     SceneManager.goto(Scene_Map)
  661.   end
  662.  
  663.   #--------------------------------------------------------------------------
  664.   # new method: on_action_save
  665.   #--------------------------------------------------------------------------
  666.   def on_action_save
  667.     @action_window.activate
  668.     if DataManager.save_game(@file_window.index)
  669.       on_save_success
  670.       refresh_windows
  671.     else
  672.       Sound.play_buzzer
  673.     end
  674.   end
  675.  
  676.   #--------------------------------------------------------------------------
  677.   # overwrite method: on_save_success
  678.   #--------------------------------------------------------------------------
  679.   def on_save_success; Sound.play_save; end
  680.  
  681.   #--------------------------------------------------------------------------
  682.   # new method: on_action_delete
  683.   #--------------------------------------------------------------------------
  684.   def on_action_delete
  685.     @action_window.activate
  686.     DataManager.delete_save_file(@file_window.index)
  687.     on_delete_success
  688.     refresh_windows
  689.   end
  690.  
  691.   #--------------------------------------------------------------------------
  692.   # new method: on_delete_success
  693.   #--------------------------------------------------------------------------
  694.   def on_delete_success
  695.     YEA::SAVE::DELETE_SOUND.play
  696.   end
  697.  
  698.   #--------------------------------------------------------------------------
  699.   # new method: refresh_windows
  700.   #--------------------------------------------------------------------------
  701.   def refresh_windows
  702.     @file_window.refresh
  703.     @action_window.refresh
  704.     @status_window.refresh
  705.   end
  706.  
  707. end # Scene_File
  708.  
  709. #==============================================================================
  710. # ■ Scene_Save
  711. #==============================================================================
  712.  
  713. class Scene_Save < Scene_File
  714.  
  715.   #--------------------------------------------------------------------------
  716.   # overwrite method: on_savefile_ok
  717.   #--------------------------------------------------------------------------
  718.   def on_savefile_ok; super; end
  719.  
  720.   #--------------------------------------------------------------------------
  721.   # overwrite method: on_save_success
  722.   #--------------------------------------------------------------------------
  723.   def on_save_success; super; end
  724.  
  725. end # help_window_text
  726.  
  727. #==============================================================================
  728. # ■ Scene_Load
  729. #==============================================================================
  730.  
  731. class Scene_Load < Scene_File
  732.  
  733.   #--------------------------------------------------------------------------
  734.   # overwrite method: on_savefile_ok
  735.   #--------------------------------------------------------------------------
  736.   def on_savefile_ok; super; end
  737.  
  738.   #--------------------------------------------------------------------------
  739.   # overwrite method: on_load_success
  740.   #--------------------------------------------------------------------------
  741.   def on_load_success; super; end
  742.  
  743. end # Scene_Load
  744.  
  745. #==============================================================================
  746. #
  747. # ■ End of File
  748. #
  749. #==============================================================================

360截图16240130354020.jpg (50.72 KB, 下载次数: 51)

就是这个界面

就是这个界面

最佳答案

查看完整内容

新建工程测试通过

Lv5.捕梦者

梦石
10
星屑
39587
在线时间
1920 小时
注册时间
2010-11-14
帖子
3320

R考场第七期纪念奖

2
发表于 2019-9-8 11:18:31 | 只看该作者

新建工程测试通过

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

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
9677
在线时间
570 小时
注册时间
2017-9-28
帖子
208
3
发表于 2019-9-9 09:22:33 | 只看该作者
RUBY 代码复制
  1. # coding: utf-8
  2. # 请将本脚本放置于「Yanfly Engine Ace - 存档系统 v1.03」之后使用
  3.  
  4. module YEA
  5.   module SAVE
  6.     # 在确认窗口中显示的文本
  7.     OVERRIDE_HELP = '是否覆盖存档?'
  8.   end
  9. end
  10.  
  11. class Window_Confirm < Window_Base
  12.   attr_reader :index
  13.  
  14.   def initialize(help_text = '')
  15.     super(0, 0, Graphics.width, fitting_height(2))
  16.     update_placement
  17.     self.arrows_visible = false
  18.     self.openness = 0
  19.     @index = 0
  20.     @handler = {}
  21.     set_text(help_text)
  22.     deactivate
  23.   end
  24.  
  25.   def update_placement
  26.     self.x = (Graphics.width - width) / 2
  27.     self.y = (Graphics.height - height) / 2
  28.   end
  29.  
  30.   def current_item
  31.     @index == 0 ? :yes : :no
  32.   end
  33.  
  34.   def on sym, blk
  35.     @handler[sym] = blk
  36.   end
  37.  
  38.   def update
  39.     super
  40.     update_cursor
  41.     update_handle
  42.   end
  43.  
  44.   def active=(active)
  45.     super
  46.     update_cursor_rect
  47.   end
  48.  
  49.   def index=(index)
  50.     @index = index
  51.     update_cursor_rect
  52.   end
  53.  
  54.   def update_cursor_rect
  55.     cursor_rect.set(item_rect(@index))
  56.   end
  57.  
  58.   def update_cursor
  59.     return unless open? && active
  60.     last_index = @index
  61.     cursor_left  if Input.repeat?(:LEFT)
  62.     cursor_right if Input.repeat?(:RIGHT)
  63.     Sound.play_cursor if @index != last_index
  64.   end
  65.  
  66.   def update_handle
  67.     return unless open? && active
  68.     process_ok     if Input.trigger?(:C)
  69.     process_cancel if Input.trigger?(:B)
  70.   end
  71.  
  72.   def cursor_left
  73.     self.index = (@index - 1) % 2
  74.   end
  75.  
  76.   def cursor_right
  77.     self.index = (@index + 1) % 2
  78.   end
  79.  
  80.   def process_ok
  81.     Sound.play_ok
  82.     Input.update
  83.     deactivate
  84.     handle(current_item)
  85.   end
  86.  
  87.   def process_cancel
  88.     Sound.play_cancel
  89.     Input.update
  90.     deactivate
  91.     handle(:no)
  92.   end
  93.  
  94.   def handle sym
  95.     @handler[sym].call if @handler.key?(sym)
  96.   end
  97.  
  98.   def set_text(text)
  99.     if text != @text
  100.       @text = text
  101.       refresh
  102.     end
  103.   end
  104.  
  105.   def refresh
  106.     contents.clear
  107.     draw_text_ex(4, 0, @text)
  108.     %w(是 否).each_with_index do |text, i|
  109.       contents.draw_text(item_rect(i), text, 1)
  110.     end
  111.   end
  112.  
  113.   def item_width
  114.     120
  115.   end
  116.  
  117.   def spacing
  118.     8
  119.   end
  120.  
  121.   def item_rect(index)
  122.     x = contents_width - item_width * 2 - spacing
  123.     dx = item_width + spacing
  124.     rect = Rect.new(x + index * dx, line_height, item_width, line_height)
  125.   end
  126. end
  127.  
  128. class Scene_File
  129.   alias _create_all_windows_confirm create_all_windows
  130.   def create_all_windows
  131.     _create_all_windows_confirm
  132.     create_confirm_window
  133.   end
  134.  
  135.   def create_confirm_window
  136.     @confirm_window = Window_Confirm.new(YEA::SAVE::OVERRIDE_HELP)
  137.     @confirm_window.on(:yes, method(:on_confirm_yes))
  138.     @confirm_window.on(:no, method(:on_confirm_no))
  139.   end
  140.  
  141.   alias _on_action_save_confirm on_action_save
  142.   def on_action_save
  143.     if DataManager.load_header(@file_window.index)
  144.       @confirm_window.index = 0
  145.       @confirm_window.activate.open
  146.     else
  147.       _on_action_save_confirm
  148.     end
  149.   end
  150.  
  151.   def on_confirm_yes
  152.     _on_action_save_confirm
  153.     @confirm_window.close
  154.   end
  155.  
  156.   def on_confirm_no
  157.     @confirm_window.close
  158.     @action_window.activate
  159.   end
  160. end
喵喵喵
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
425
在线时间
26 小时
注册时间
2019-8-6
帖子
22
4
发表于 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
啥都不会的小菜鸡!
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
711
在线时间
137 小时
注册时间
2018-9-25
帖子
26
5
 楼主| 发表于 2019-9-12 08:17:39 | 只看该作者
KB.Driver 发表于 2019-9-9 09:47
新建工程测试通过

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

使用道具 举报

Lv2.观梦者

梦石
0
星屑
711
在线时间
137 小时
注册时间
2018-9-25
帖子
26
6
 楼主| 发表于 2019-9-12 08:39:41 | 只看该作者
KB.Driver 发表于 2019-9-8 11:18
新建工程测试通过

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

点评

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

使用道具 举报

Lv5.捕梦者

梦石
10
星屑
39587
在线时间
1920 小时
注册时间
2010-11-14
帖子
3320

R考场第七期纪念奖

7
发表于 2019-9-12 13:03:21 | 只看该作者
杰克苏 发表于 2019-9-12 08:39
大佬已给金币,马后炮地问一下,在覆盖/取消上面加个是否覆盖此存档的陈述难吗?不难地话能告知下怎么微调 ...

RUBY 代码复制
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - 存档系统 v1.03
  4. # -- 最后更新: 2012.07.22
  5. # -- 使用难度: 普通
  6. # -- 需要脚本: 无
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-SaveEngine"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.07.22 - Fixed: Location Drawing.
  17. # 2012.01.23 - Anti-crash method added for removed maps.
  18. # 2011.12.26 - Compatibility Update: New Game+
  19. # 2011.12.26 - Started Script and Finished.
  20. #
  21. #==============================================================================
  22. # ▼ 介绍
  23. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  24. # 本脚本为玩家提供一个新式存档界面,可以直接在存档界面读档或删除存档。同时为玩家
  25. # 显示更多的存档信息,例如地点、所持金钱以及其他任何你想要显示的变量。
  26. #
  27. # 如果你第一次使用此脚本,查看旧存档文件可能会出现丢失部分存档数据的情况,这时候
  28. # 需要你重新读档并再次存档。
  29. #
  30. #==============================================================================
  31. # ▼ 安装方式
  32. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  33. # 打开脚本编辑器,将本脚本拷贝/复制到一个在▼ 插件脚本之下▼ Main之上的新
  34. # 脚本页/槽中.记得保存你的工程以使脚本生效.
  35. #
  36. #==============================================================================
  37. # ▼ 兼容性
  38. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  39. # 本脚本仅为RPG Maker VX Ace编写.极不可能在无任何修改的情况下运行于RPG Maker VX.
  40. #
  41. #==============================================================================
  42.  
  43. module YEA
  44.   module SAVE
  45.  
  46.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  47.     # - 存档文件窗口设置 -
  48.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  49.  
  50.     MAX_FILES = 16         # 最大存档数. 默认: 16
  51.     SLOT_NAME = "Save %s"  # 存档文件文本.
  52.  
  53.     # These are the icons
  54.     SAVE_ICON  = 368       # 已存档的图标
  55.     EMPTY_ICON = 375       # 未存档的图标
  56.  
  57.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  58.     # - 指令窗口设置 -
  59.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  60.  
  61.     ACTION_LOAD   = "载入"           # 载入的文本.
  62.     ACTION_SAVE   = "存档"           # 存档的文本.
  63.     ACTION_DELETE = "删除"           # 删除的文本.
  64.     DELETE_SOUND  = RPG::SE.new("Collapse3", 100, 100) # 删除的音效.
  65.  
  66.     # 在帮助窗口中显示的文本.
  67.     SELECT_HELP = "请选择一个存档文件."
  68.     LOAD_HELP   = "从已保存数据中载入."
  69.     SAVE_HELP   = "保存当前游戏数据."
  70.     DELETE_HELP = "删除全部已保存数据."
  71.  
  72.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  73.     # - 覆盖窗口设置 -
  74.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  75.  
  76.     ACTION_OVERLAP = "覆盖"
  77.     ACTION_CANCEL  = "取消"
  78.     OVERLAP_HELP   = "是否覆盖此存档?"
  79.  
  80.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  81.     # - 游戏状态窗口文本 -
  82.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  83.  
  84.     EMPTY_TEXT = "无存档数据"      # 无存档数据的文本.
  85.     PLAYTIME   = "游戏时间"        # 显示游戏时间的文本.
  86.     TOTAL_SAVE = "存档次数: "      # 存档次数的文本.
  87.     TOTAL_GOLD = "总金钱数: "      # 总金钱数的文本.
  88.     LOCATION   = "地点: "          # 地点的文本.
  89.  
  90.     # 在数组中填入你想要显示变量数值的变量ID,0为不显示
  91.     COLUMN1_VARIABLES = [381, 390, 495]
  92.     COLUMN2_VARIABLES = [707, 5, 6]
  93.  
  94.   end # SAVE
  95. end # YEA
  96.  
  97. #==============================================================================
  98. # ▼ 编辑以下内容可能会出现电脑损坏、死机,电脑主人脑袋爆炸、昏迷、死亡或口臭
  99. # 所以编辑了后果自负。
  100. #==============================================================================
  101.  
  102. #==============================================================================
  103. # ■ Icon
  104. #==============================================================================
  105.  
  106. module Icon
  107.  
  108.   #--------------------------------------------------------------------------
  109.   # self.save_icon
  110.   #--------------------------------------------------------------------------
  111.   def self.save_icon; return YEA::SAVE::SAVE_ICON; end
  112.  
  113.   #--------------------------------------------------------------------------
  114.   # self.empty_icon
  115.   #--------------------------------------------------------------------------
  116.   def self.empty_icon; return YEA::SAVE::EMPTY_ICON; end
  117.  
  118. end # Icon
  119.  
  120. #==============================================================================
  121. # ■ Numeric
  122. #==============================================================================
  123.  
  124. class Numeric
  125.  
  126.   #--------------------------------------------------------------------------
  127.   # new method: group_digits
  128.   #--------------------------------------------------------------------------
  129.   unless $imported["YEA-CoreEngine"]
  130.   def group; return self.to_s; end
  131.   end # $imported["YEA-CoreEngine"]
  132.  
  133. end # Numeric
  134.  
  135. #==============================================================================
  136. # ■ DataManager
  137. #==============================================================================
  138.  
  139. module DataManager
  140.  
  141.   #--------------------------------------------------------------------------
  142.   # overwrite method: savefile_max
  143.   #--------------------------------------------------------------------------
  144.   def self.savefile_max
  145.     return YEA::SAVE::MAX_FILES
  146.   end
  147.  
  148.   #--------------------------------------------------------------------------
  149.   # overwrite method: self.make_save_header
  150.   #--------------------------------------------------------------------------
  151.   def self.make_save_header
  152.     header = {}
  153.     header[:characters]    = $game_party.characters_for_savefile
  154.     header[:playtime_s]    = $game_system.playtime_s
  155.     header[:system]        = Marshal.load(Marshal.dump($game_system))
  156.     header[:timer]         = Marshal.load(Marshal.dump($game_timer))
  157.     header[:message]       = Marshal.load(Marshal.dump($game_message))
  158.     header[:switches]      = Marshal.load(Marshal.dump($game_switches))
  159.     header[:variables]     = Marshal.load(Marshal.dump($game_variables))
  160.     header[:self_switches] = Marshal.load(Marshal.dump($game_self_switches))
  161.     header[:actors]        = Marshal.load(Marshal.dump($game_actors))
  162.     header[:party]         = Marshal.load(Marshal.dump($game_party))
  163.     header[:troop]         = Marshal.load(Marshal.dump($game_troop))
  164.     header[:map]           = Marshal.load(Marshal.dump($game_map))
  165.     header[:player]        = Marshal.load(Marshal.dump($game_player))
  166.     header
  167.   end
  168.  
  169. end # DataManager
  170.  
  171. #==============================================================================
  172. # ■ Window_MenuCommand
  173. #==============================================================================
  174.  
  175. class Window_MenuCommand < Window_Command
  176.  
  177.   #--------------------------------------------------------------------------
  178.   # overwrite method: save_enabled
  179.   #--------------------------------------------------------------------------
  180.   def save_enabled; return true; end
  181.  
  182. end # Window_MenuCommand
  183.  
  184. #==============================================================================
  185. # ■ Window_FileList
  186. #==============================================================================
  187.  
  188. class Window_FileList < Window_Selectable
  189.  
  190.   #--------------------------------------------------------------------------
  191.   # initialize
  192.   #--------------------------------------------------------------------------
  193.   def initialize(dx, dy)
  194.     super(dx, dy, 128, Graphics.height - dy)
  195.     refresh
  196.     activate
  197.     select(SceneManager.scene.first_savefile_index)
  198.   end
  199.  
  200.   #--------------------------------------------------------------------------
  201.   # item_max
  202.   #--------------------------------------------------------------------------
  203.   def item_max; return DataManager.savefile_max; end
  204.  
  205.   #--------------------------------------------------------------------------
  206.   # current_item_enabled?
  207.   #--------------------------------------------------------------------------
  208.   def current_item_enabled?
  209.     header = DataManager.load_header(index)
  210.     return false if header.nil? && SceneManager.scene_is?(Scene_Load)
  211.     return true
  212.   end
  213.  
  214.   #--------------------------------------------------------------------------
  215.   # refresh
  216.   #--------------------------------------------------------------------------
  217.   def refresh
  218.     create_contents
  219.     draw_all_items
  220.   end
  221.  
  222.   #--------------------------------------------------------------------------
  223.   # draw_item
  224.   #--------------------------------------------------------------------------
  225.   def draw_item(index)
  226.     header = DataManager.load_header(index)
  227.     enabled = !header.nil?
  228.     rect = item_rect(index)
  229.     rect.width -= 4
  230.     draw_icon(save_icon?(header), rect.x, rect.y, enabled)
  231.     change_color(normal_color, enabled)
  232.     text = sprintf(YEA::SAVE::SLOT_NAME, (index + 1).group)
  233.     draw_text(rect.x+24, rect.y, rect.width-24, line_height, text)
  234.   end
  235.  
  236.   #--------------------------------------------------------------------------
  237.   # save_icon?
  238.   #--------------------------------------------------------------------------
  239.   def save_icon?(header)
  240.     return Icon.empty_icon if header.nil?
  241.     return Icon.save_icon
  242.   end
  243.  
  244. end # Window_FileList
  245.  
  246. #==============================================================================
  247. # ■ Window_FileStatus
  248. #==============================================================================
  249.  
  250. class Window_FileStatus < Window_Base
  251.  
  252.   #--------------------------------------------------------------------------
  253.   # initialize
  254.   #--------------------------------------------------------------------------
  255.   def initialize(dx, dy, file_window)
  256.     super(dx, dy, Graphics.width - dx, Graphics.height - dy)
  257.     @file_window = file_window
  258.     @current_index = @file_window.index
  259.     refresh
  260.   end
  261.  
  262.   #--------------------------------------------------------------------------
  263.   # update
  264.   #--------------------------------------------------------------------------
  265.   def update
  266.     super
  267.     return if @file_window.index < 0
  268.     return if @current_index == @file_window.index
  269.     @current_index = @file_window.index
  270.     refresh
  271.   end
  272.  
  273.   #--------------------------------------------------------------------------
  274.   # refresh
  275.   #--------------------------------------------------------------------------
  276.   def refresh
  277.     contents.clear
  278.     reset_font_settings
  279.     @header = DataManager.load_header(@file_window.index)
  280.     if @header.nil?
  281.       draw_empty
  282.     else
  283.       draw_save_contents
  284.     end
  285.   end
  286.  
  287.   #--------------------------------------------------------------------------
  288.   # draw_empty
  289.   #--------------------------------------------------------------------------
  290.   def draw_empty
  291.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  292.     rect = Rect.new(0, 0, contents.width, contents.height)
  293.     contents.fill_rect(rect, colour)
  294.     text = YEA::SAVE::EMPTY_TEXT
  295.     change_color(system_color)
  296.     draw_text(rect, text, 1)
  297.   end
  298.  
  299.   #--------------------------------------------------------------------------
  300.   # draw_save_slot
  301.   #--------------------------------------------------------------------------
  302.   def draw_save_slot(dx, dy, dw)
  303.     reset_font_settings
  304.     change_color(system_color)
  305.     text = sprintf(YEA::SAVE::SLOT_NAME, "")
  306.     draw_text(dx, dy, dw, line_height, text)
  307.     cx = text_size(text).width
  308.     change_color(normal_color)
  309.     draw_text(dx+cx, dy, dw-cx, line_height, (@file_window.index+1).group)
  310.   end
  311.  
  312.   #--------------------------------------------------------------------------
  313.   # draw_save_playtime
  314.   #--------------------------------------------------------------------------
  315.   def draw_save_playtime(dx, dy, dw)
  316.     return if @header[:playtime_s].nil?
  317.     reset_font_settings
  318.     change_color(system_color)
  319.     draw_text(dx, dy, dw, line_height, YEA::SAVE::PLAYTIME, 0)
  320.     change_color(normal_color)
  321.     draw_text(dx, dy, dw, line_height, @header[:playtime_s], 2)
  322.   end
  323.  
  324.   #--------------------------------------------------------------------------
  325.   # draw_save_total_saves
  326.   #--------------------------------------------------------------------------
  327.   def draw_save_total_saves(dx, dy, dw)
  328.     return if @header[:system].nil?
  329.     reset_font_settings
  330.     change_color(system_color)
  331.     text = YEA::SAVE::TOTAL_SAVE
  332.     draw_text(dx, dy, dw, line_height, text)
  333.     cx = text_size(text).width
  334.     change_color(normal_color)
  335.     draw_text(dx+cx, dy, dw-cx, line_height, @header[:system].save_count.group)
  336.   end
  337.  
  338.   #--------------------------------------------------------------------------
  339.   # draw_save_gold
  340.   #--------------------------------------------------------------------------
  341.   def draw_save_gold(dx, dy, dw)
  342.     return if @header[:party].nil?
  343.     reset_font_settings
  344.     change_color(system_color)
  345.     draw_text(dx, dy, dw, line_height, YEA::SAVE::TOTAL_GOLD)
  346.     text = Vocab::currency_unit
  347.     draw_text(dx, dy, dw, line_height, text, 2)
  348.     cx = text_size(text).width
  349.     change_color(normal_color)
  350.     text = @header[:party].gold.group
  351.     draw_text(dx, dy, dw-cx, line_height, text, 2)
  352.   end
  353.  
  354.   #--------------------------------------------------------------------------
  355.   # draw_save_location
  356.   #--------------------------------------------------------------------------
  357.   def draw_save_location(dx, dy, dw)
  358.     return if @header[:map].nil?
  359.     reset_font_settings
  360.     change_color(system_color)
  361.     draw_text(dx, dy, dw, line_height, YEA::SAVE::LOCATION)
  362.     change_color(normal_color)
  363.     cx = text_size(YEA::SAVE::LOCATION).width
  364.     return if $data_mapinfos[@header[:map].map_id].nil?
  365.     text = @header[:map].display_name
  366.     text = $data_mapinfos[@header[:map].map_id].name if text == ""
  367.     draw_text(dx+cx, dy, dw-cx, line_height, text)
  368.   end
  369.  
  370.   #--------------------------------------------------------------------------
  371.   # draw_save_characters
  372.   #--------------------------------------------------------------------------
  373.   def draw_save_characters(dx, dy)
  374.     return if @header[:party].nil?
  375.     reset_font_settings
  376.     make_font_smaller
  377.     dw = (contents.width - dx) / @header[:party].max_battle_members
  378.     dx += dw/2
  379.     for member in @header[:party].battle_members
  380.       next if member.nil?
  381.       member = @header[:actors][member.id]
  382.       change_color(normal_color)
  383.       draw_actor_graphic(member, dx, dy)
  384.       text = member.name
  385.       draw_text(dx-dw/2, dy, dw, line_height, text, 1)
  386.       text = member.level.group
  387.       draw_text(dx-dw/2, dy-line_height, dw-4, line_height, text, 2)
  388.       cx = text_size(text).width
  389.       change_color(system_color)
  390.       text = Vocab::level_a
  391.       draw_text(dx-dw/2, dy-line_height, dw-cx-4, line_height, text, 2)
  392.       dx += dw
  393.     end
  394.   end
  395.  
  396.   #--------------------------------------------------------------------------
  397.   # draw_save_column1
  398.   #--------------------------------------------------------------------------
  399.   def draw_save_column1(dx, dy, dw)
  400.     data = YEA::SAVE::COLUMN1_VARIABLES
  401.     draw_column_data(data, dx, dy, dw)
  402.   end
  403.  
  404.   #--------------------------------------------------------------------------
  405.   # draw_save_column2
  406.   #--------------------------------------------------------------------------
  407.   def draw_save_column2(dx, dy, dw)
  408.     data = YEA::SAVE::COLUMN2_VARIABLES
  409.     draw_column_data(data, dx, dy, dw)
  410.   end
  411.  
  412.   #--------------------------------------------------------------------------
  413.   # draw_column_data
  414.   #--------------------------------------------------------------------------
  415.   def draw_column_data(data, dx, dy, dw)
  416.     return if @header[:variables].nil?
  417.     reset_font_settings
  418.     for variable_id in data
  419.       next if $data_system.variables[variable_id].nil?
  420.       change_color(system_color)
  421.       name = $data_system.variables[variable_id]
  422.       draw_text(dx, dy, dw, line_height, name, 0)
  423.       value = @header[:variables][variable_id].group
  424.       change_color(normal_color)
  425.       draw_text(dx, dy, dw, line_height, value, 2)
  426.       dy += line_height
  427.     end
  428.   end
  429.  
  430.   #--------------------------------------------------------------------------
  431.   # draw_save_contents
  432.   #--------------------------------------------------------------------------
  433.   def draw_save_contents
  434.     draw_save_slot(4, 0, contents.width/2-8)
  435.     draw_save_playtime(contents.width/2+4, 0, contents.width/2-8)
  436.     draw_save_total_saves(4, line_height, contents.width/2-8)
  437.     draw_save_gold(contents.width/2+4, line_height, contents.width/2-8)
  438.     draw_save_location(4, line_height*2, contents.width-8)
  439.     draw_save_characters(0, line_height*5 + line_height/3)
  440.     draw_save_column1(16, line_height*7, contents.width/2-48)
  441.     draw_save_column2(contents.width/2+16, line_height*7, contents.width/2-48)
  442.   end
  443.  
  444. end # Window_FileStatus
  445.  
  446. #==============================================================================
  447. # ■ Window_FileAction
  448. #==============================================================================
  449.  
  450. class Window_FileAction < Window_HorzCommand
  451.  
  452.   #--------------------------------------------------------------------------
  453.   # initialize
  454.   #--------------------------------------------------------------------------
  455.   def initialize(dx, dy, file_window)
  456.     @file_window = file_window
  457.     super(dx, dy)
  458.     deactivate
  459.     unselect
  460.   end
  461.  
  462.   #--------------------------------------------------------------------------
  463.   # window_width
  464.   #--------------------------------------------------------------------------
  465.   def window_width; Graphics.width - 128; end
  466.  
  467.   #--------------------------------------------------------------------------
  468.   # col_max
  469.   #--------------------------------------------------------------------------
  470.   def col_max; return 3; end
  471.  
  472.   #--------------------------------------------------------------------------
  473.   # update
  474.   #--------------------------------------------------------------------------
  475.   def update
  476.     super
  477.     return if @file_window.index < 0
  478.     return if @current_index == @file_window.index
  479.     @current_index = @file_window.index
  480.     refresh
  481.   end
  482.  
  483.   #--------------------------------------------------------------------------
  484.   # make_command_list
  485.   #--------------------------------------------------------------------------
  486.   def make_command_list
  487.     @header = DataManager.load_header(@file_window.index)
  488.     add_load_command
  489.     add_save_command
  490.     add_delete_command
  491.   end
  492.  
  493.   #--------------------------------------------------------------------------
  494.   # add_load_command
  495.   #--------------------------------------------------------------------------
  496.   def add_load_command
  497.     add_command(YEA::SAVE::ACTION_LOAD, :load, load_enabled?)
  498.   end
  499.  
  500.   #--------------------------------------------------------------------------
  501.   # load_enabled?
  502.   #--------------------------------------------------------------------------
  503.   def load_enabled?
  504.     return false if @header.nil?
  505.     return true
  506.   end
  507.  
  508.   #--------------------------------------------------------------------------
  509.   # add_save_command
  510.   #--------------------------------------------------------------------------
  511.   def add_save_command
  512.     add_command(YEA::SAVE::ACTION_SAVE, :save, save_enabled?)
  513.   end
  514.  
  515.   #--------------------------------------------------------------------------
  516.   # save_enabled?
  517.   #--------------------------------------------------------------------------
  518.   def save_enabled?
  519.     return false if @header.nil? && SceneManager.scene_is?(Scene_Load)
  520.     return false if SceneManager.scene_is?(Scene_Load)
  521.     return false if $game_system.save_disabled
  522.     return true
  523.   end
  524.  
  525.   #--------------------------------------------------------------------------
  526.   # add_delete_command
  527.   #--------------------------------------------------------------------------
  528.   def add_delete_command
  529.     add_command(YEA::SAVE::ACTION_DELETE, :delete, delete_enabled?)
  530.   end
  531.  
  532.   #--------------------------------------------------------------------------
  533.   # delete_enabled?
  534.   #--------------------------------------------------------------------------
  535.   def delete_enabled?
  536.     return false if @header.nil?
  537.     return true
  538.   end
  539.  
  540.   #--------------------------------------------------------------------------
  541.   # update_help
  542.   #--------------------------------------------------------------------------
  543.   def update_help
  544.     case current_symbol
  545.     when :load; @help_window.set_text(YEA::SAVE::LOAD_HELP)
  546.     when :save; @help_window.set_text(YEA::SAVE::SAVE_HELP)
  547.     when :delete; @help_window.set_text(YEA::SAVE::DELETE_HELP)
  548.     end
  549.   end
  550.  
  551. end # Window_FileAction
  552.  
  553. #==============================================================================
  554. # ■ Scene_File
  555. #==============================================================================
  556.  
  557. class Scene_File < Scene_MenuBase
  558.  
  559.   #--------------------------------------------------------------------------
  560.   # overwrite method: start
  561.   #--------------------------------------------------------------------------
  562.   def start
  563.     super
  564.     create_all_windows
  565.   end
  566.  
  567.   #--------------------------------------------------------------------------
  568.   # overwrite method: terminate
  569.   #--------------------------------------------------------------------------
  570.   def terminate
  571.     super
  572.   end
  573.  
  574.   #--------------------------------------------------------------------------
  575.   # overwrite method: update
  576.   #--------------------------------------------------------------------------
  577.   def update
  578.     super
  579.   end
  580.  
  581.   #--------------------------------------------------------------------------
  582.   # new method: create_all_windows
  583.   #--------------------------------------------------------------------------
  584.   def create_all_windows
  585.     create_help_window
  586.     create_file_window
  587.     create_action_window
  588.     create_status_window
  589.   end
  590.  
  591.   #--------------------------------------------------------------------------
  592.   # overwrite method: create_help_window
  593.   #--------------------------------------------------------------------------
  594.   def create_help_window
  595.     @help_window = Window_Help.new
  596.     @help_window.set_text(YEA::SAVE::SELECT_HELP)
  597.   end
  598.  
  599.   #--------------------------------------------------------------------------
  600.   # new method: create_file_window
  601.   #--------------------------------------------------------------------------
  602.   def create_file_window
  603.     wy = @help_window.height
  604.     @file_window = Window_FileList.new(0, wy)
  605.     @file_window.set_handler(:ok, method(:on_file_ok))
  606.     @file_window.set_handler(:cancel, method(:return_scene))
  607.   end
  608.  
  609.   #--------------------------------------------------------------------------
  610.   # new method: create_action_window
  611.   #--------------------------------------------------------------------------
  612.   def create_action_window
  613.     wx = @file_window.width
  614.     wy = @help_window.height
  615.     @action_window = Window_FileAction.new(wx, wy, @file_window)
  616.     @action_window.help_window = @help_window
  617.     @action_window.set_handler(:cancel, method(:on_action_cancel))
  618.     @action_window.set_handler(:load, method(:on_action_load))
  619.     @action_window.set_handler(:save, method(:on_action_save))
  620.     @action_window.set_handler(:delete, method(:on_action_delete))
  621.   end
  622.  
  623.   #--------------------------------------------------------------------------
  624.   # new method: create_status_window
  625.   #--------------------------------------------------------------------------
  626.   def create_status_window
  627.     wx = @action_window.x
  628.     wy = @action_window.y + @action_window.height
  629.     @status_window = Window_FileStatus.new(wx, wy, @file_window)
  630.   end
  631.  
  632.   #--------------------------------------------------------------------------
  633.   # new method: on_file_ok
  634.   #--------------------------------------------------------------------------
  635.   def on_file_ok
  636.     @action_window.activate
  637.     index = SceneManager.scene_is?(Scene_Load) ? 0 : 1
  638.     @action_window.select(index)
  639.   end
  640.  
  641.   #--------------------------------------------------------------------------
  642.   # new method: on_action_cancel
  643.   #--------------------------------------------------------------------------
  644.   def on_action_cancel
  645.     @action_window.unselect
  646.     @file_window.activate
  647.     @help_window.set_text(YEA::SAVE::SELECT_HELP)
  648.   end
  649.  
  650.   #--------------------------------------------------------------------------
  651.   # new method: on_action_load
  652.   #--------------------------------------------------------------------------
  653.   def on_action_load
  654.     if DataManager.load_game(@file_window.index)
  655.       on_load_success
  656.     else
  657.       Sound.play_buzzer
  658.     end
  659.   end
  660.  
  661.   #--------------------------------------------------------------------------
  662.   # overwrite method: on_load_success
  663.   #--------------------------------------------------------------------------
  664.   def on_load_success
  665.     Sound.play_load
  666.     fadeout_all
  667.     $game_system.on_after_load
  668.     SceneManager.goto(Scene_Map)
  669.   end
  670.  
  671.   #--------------------------------------------------------------------------
  672.   # new method: on_action_save
  673.   #--------------------------------------------------------------------------
  674.   def on_action_save
  675.     @action_window.activate
  676.     if DataManager.save_game(@file_window.index)
  677.       on_save_success
  678.       refresh_windows
  679.     else
  680.       Sound.play_buzzer
  681.     end
  682.   end
  683.  
  684. #~   # 此处修改 ----------------------------------------------------------------
  685. #~   alias on_action_save_original on_action_save
  686. #~   def on_action_save
  687. #~     if File.exist?(DataManager.make_filename(@file_window.index)) # 存档已经存在
  688. #~       @action_window.deactivate
  689. #~       @overlap_window.show.open.activate
  690. #~     else
  691. #~       on_action_save_with_overlap
  692. #~     end
  693. #~   end
  694. #~   
  695. #~   def on_action_save_with_overlap
  696. #~     on_action_save_original
  697. #~     on_action_save_cancel
  698. #~   end
  699. #~   
  700. #~   def on_action_save_cancel
  701. #~     @action_window.activate
  702. #~     @overlap_window.hide.close.deactivate
  703. #~   end
  704. #~   # -------------------------------------------------------------------------  
  705.  
  706.  
  707.   #--------------------------------------------------------------------------
  708.   # overwrite method: on_save_success
  709.   #--------------------------------------------------------------------------
  710.   def on_save_success; Sound.play_save; end
  711.  
  712.   #--------------------------------------------------------------------------
  713.   # new method: on_action_delete
  714.   #--------------------------------------------------------------------------
  715.   def on_action_delete
  716.     @action_window.activate
  717.     DataManager.delete_save_file(@file_window.index)
  718.     on_delete_success
  719.     refresh_windows
  720.   end
  721.  
  722.   #--------------------------------------------------------------------------
  723.   # new method: on_delete_success
  724.   #--------------------------------------------------------------------------
  725.   def on_delete_success
  726.     YEA::SAVE::DELETE_SOUND.play
  727.   end
  728.  
  729.   #--------------------------------------------------------------------------
  730.   # new method: refresh_windows
  731.   #--------------------------------------------------------------------------
  732.   def refresh_windows
  733.     @file_window.refresh
  734.     @action_window.refresh
  735.     @status_window.refresh
  736.   end
  737.  
  738. end # Scene_File
  739.  
  740. #==============================================================================
  741. # ■ Scene_Save
  742. #==============================================================================
  743.  
  744. class Scene_Save < Scene_File
  745.  
  746.   #--------------------------------------------------------------------------
  747.   # overwrite method: on_savefile_ok
  748.   #--------------------------------------------------------------------------
  749.   def on_savefile_ok; super; end
  750.  
  751.   #--------------------------------------------------------------------------
  752.   # overwrite method: on_save_success
  753.   #--------------------------------------------------------------------------
  754.   def on_save_success; super; end
  755.  
  756. end # help_window_text
  757.  
  758. #==============================================================================
  759. # ■ Scene_Load
  760. #==============================================================================
  761.  
  762. class Scene_Load < Scene_File
  763.  
  764.   #--------------------------------------------------------------------------
  765.   # overwrite method: on_savefile_ok
  766.   #--------------------------------------------------------------------------
  767.   def on_savefile_ok; super; end
  768.  
  769.   #--------------------------------------------------------------------------
  770.   # overwrite method: on_load_success
  771.   #--------------------------------------------------------------------------
  772.   def on_load_success; super; end
  773.  
  774. end # Scene_Load
  775.  
  776. #==============================================================================
  777. #
  778. # ■ End of File
  779. #
  780. #==============================================================================
  781.  
  782. class Scene_File
  783.  
  784.   alias create_all_windows_original create_all_windows
  785.   def create_all_windows
  786.     create_all_windows_original
  787.     create_overlap_window
  788.   end
  789.  
  790.   class Window_Overlap < Window_HorzCommand
  791.     def window_width
  792.       Bitmap.new(1,1).text_size(YEA::SAVE::OVERLAP_HELP).width + 24 + 8
  793.     end
  794.     def visible_line_number; 2; end
  795.     def col_max; 2; end
  796.     def contents_height
  797.       height - standard_padding * 2
  798.     end
  799.     def item_rect(index)
  800.       rect = super
  801.       rect.y += line_height
  802.       rect
  803.     end
  804.     def draw_all_items
  805.       rect = item_rect_for_text(0)
  806.       rect.y -= line_height
  807.       rect.width = contents.width
  808.       draw_text(rect, YEA::SAVE::OVERLAP_HELP)
  809.       super
  810.     end
  811.     def make_command_list
  812.       add_command(YEA::SAVE::ACTION_OVERLAP, :overlap)
  813.       add_command(YEA::SAVE::ACTION_CANCEL , :cancel )
  814.     end
  815.   end
  816.  
  817.   def create_overlap_window
  818.     @overlap_window = Window_Overlap.new(0, 0)
  819.     @overlap_window.set_handler(:overlap, method(:on_action_save_with_overlap))
  820.     @overlap_window.set_handler(:cancel, method(:on_action_save_cancel))
  821.     @overlap_window.x = (Graphics.width - @overlap_window.width) / 2
  822.     @overlap_window.y = (Graphics.height - @overlap_window.height) / 2  
  823.     @overlap_window.hide.close.deactivate
  824.   end
  825.  
  826.   alias on_action_save_original on_action_save
  827.   def on_action_save
  828.     if File.exist?(DataManager.make_filename(@file_window.index)) # 存档已经存在
  829.       @action_window.deactivate
  830.       @overlap_window.show.open.activate
  831.     else
  832.       on_action_save_with_overlap
  833.     end
  834.   end
  835.  
  836.   def on_action_save_with_overlap
  837.     on_action_save_original
  838.     on_action_save_cancel
  839.   end
  840.  
  841.   def on_action_save_cancel
  842.     @action_window.activate
  843.     @overlap_window.hide.close.deactivate
  844.   end
  845. end


用头画头像,用脚写脚本
回复

使用道具 举报

头像被屏蔽

Lv2.观梦者 (禁止发言)

梦石
0
星屑
717
在线时间
914 小时
注册时间
2010-11-13
帖子
1023
8
发表于 2019-9-12 18:55:44 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复

使用道具 举报

头像被屏蔽

Lv2.观梦者 (禁止发言)

梦石
0
星屑
717
在线时间
914 小时
注册时间
2010-11-13
帖子
1023
9
发表于 2019-9-12 18:56:36 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
711
在线时间
137 小时
注册时间
2018-9-25
帖子
26
10
 楼主| 发表于 2019-9-12 21:38:30 | 只看该作者
KB.Driver 发表于 2019-9-12 13:03
#==============================================================================
#
# ▼ Yanfly Eng ...

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

未标题-1.jpg (30.4 KB, 下载次数: 41)

未标题-1.jpg

点评

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

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-16 16:36

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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