Archeia

Yanfly Engine Ace - Ace Save Engine v1.03

Mar 30th, 2014
442
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #==============================================================================
  2. #
  3. # ?\ Yanfly Engine Ace - Ace Save Engine v1.03
  4. # -- Last Updated: 2012.07.22
  5. # -- Level: Normal
  6. # -- Requires: n/a
  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. # ?\ Introduction
  23. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  24. # This script provides a new save interface for the player. Along with a new
  25. # interface, the player can also load and delete saves straight from the menu
  26. # itself. This will in turn make the save command from the Main Menu always
  27. # available, but the save option within the new save menu will be enabled
  28. # depending on whether or not it is allowed or disallowed. From the interface,
  29. # the player is given more information regarding the save file including the
  30. # the location the player saved at, the amount of gold available, and any
  31. # variables that you want to show the player as well.
  32. #
  33. #==============================================================================
  34. # ?\ Instructions
  35. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  36. # To install this script, open up your script editor and copy/paste this script
  37. # to an open slot below ?\ Materials/‘f?T but above ?\ Main. Remember to save.
  38. #
  39. # For first time installers, be warned that loading this script the first time
  40. # may not display all information in the status window for save files made
  41. # before the installation of this script. To remedy this, just load up the save
  42. # and save the file again.
  43. #
  44. #==============================================================================
  45. # ?\ Compatibility
  46. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  47. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  48. # it will run with RPG Maker VX without adjusting.
  49. #
  50. #==============================================================================
  51.  
  52. module YEA
  53.   module SAVE
  54.    
  55.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  56.     # - Slot Window Settings -
  57.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  58.     # This section adjusts how the slot window appears on the left side of the
  59.     # screen. This also adjusts the maximum number of saves a player can make,
  60.     # the way the slot names appear, and the icons used.
  61.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  62.     MAX_FILES = 24         # Maximum saves a player can make. Default: 16
  63.     SLOT_NAME = "File %s"  # How the file slots will be named.
  64.    
  65.     # These are the icons
  66.     SAVE_ICON  = 368       # Icon used to indicate a save is present.
  67.     EMPTY_ICON = 375       # Icon used to indicate an empty file.
  68.    
  69.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  70.     # - Action Window Settings -
  71.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  72.     # This section adjusts how the action window appears, the sound effect
  73.     # played when deleting files, and what appears in the help window above.
  74.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  75.     ACTION_LOAD   = "Load"           # Text used for loading games.
  76.     ACTION_SAVE   = "Save"           # Text used for saving games.
  77.     ACTION_DELETE = "Delete"         # Text used for deleting games.
  78.     DELETE_SOUND  = RPG::SE.new("Collapse3", 100, 100) # Sound for deleting.
  79.    
  80.     # These text settings adjust what displays in the help window.
  81.     SELECT_HELP = "Please select a file slot."
  82.     LOAD_HELP   = "Loads the data from the saved game."
  83.     SAVE_HELP   = "Saves the current progress in your game."
  84.     DELETE_HELP = "Deletes all data from this save file."
  85.    
  86.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  87.     # - Status Window Settings -
  88.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  89.     # This section adjusts how the status window appears in the middle of the
  90.     # screen (that displays the game's data) such as the total playtime, total
  91.     # times saved, total gold, the party's current location, and the variables
  92.     # to be displayed.
  93.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  94.     EMPTY_TEXT = "No Save Data"      # Text used when no save data is present.
  95.     PLAYTIME   = "Playtime"          # Text used for total playtime.
  96.     TOTAL_SAVE = "Total Saves: "     # Text used to indicate total saves.
  97.     TOTAL_GOLD = "Total Gold: "      # Text used to indicate total gold.
  98.     LOCATION   = "Location: "        # Text used to indicate current location.
  99.    
  100.     # These variables will be shown in each of the two columns for those who
  101.     # would want to display more information than just what's shown. Input the
  102.     # variables into the arrays below to designate what data will be shown.
  103.     COLUMN1_VARIABLES = [1, 2, 3]
  104.     COLUMN2_VARIABLES = [4, 5, 6]
  105.    
  106.   end # SAVE
  107. end # YEA
  108.  
  109. #==============================================================================
  110. # ?\ Editting anything past this point may potentially result in causing
  111. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  112. # halitosis so edit at your own risk.
  113. #==============================================================================
  114.  
  115. #==============================================================================
  116. # ?! Icon
  117. #==============================================================================
  118.  
  119. module Icon
  120.  
  121.   #--------------------------------------------------------------------------
  122.   # self.save_icon
  123.   #--------------------------------------------------------------------------
  124.   def self.save_icon; return YEA::SAVE::SAVE_ICON; end
  125.  
  126.   #--------------------------------------------------------------------------
  127.   # self.empty_icon
  128.   #--------------------------------------------------------------------------
  129.   def self.empty_icon; return YEA::SAVE::EMPTY_ICON; end
  130.    
  131. end # Icon
  132.  
  133. #==============================================================================
  134. # ?! Numeric
  135. #==============================================================================
  136.  
  137. class Numeric
  138.  
  139.   #--------------------------------------------------------------------------
  140.   # new method: group_digits
  141.   #--------------------------------------------------------------------------
  142.   unless $imported["YEA-CoreEngine"]
  143.   def group; return self.to_s; end
  144.   end # $imported["YEA-CoreEngine"]
  145.    
  146. end # Numeric
  147.  
  148. #==============================================================================
  149. # ?! DataManager
  150. #==============================================================================
  151.  
  152. module DataManager
  153.  
  154.   #--------------------------------------------------------------------------
  155.   # overwrite method: savefile_max
  156.   #--------------------------------------------------------------------------
  157.   def self.savefile_max
  158.     return YEA::SAVE::MAX_FILES
  159.   end
  160.  
  161.   #--------------------------------------------------------------------------
  162.   # overwrite method: self.make_save_header
  163.   #--------------------------------------------------------------------------
  164.   def self.make_save_header
  165.     header = {}
  166.     header[:characters]    = $game_party.characters_for_savefile
  167.     header[:playtime_s]    = $game_system.playtime_s
  168.     header[:system]        = Marshal.load(Marshal.dump($game_system))
  169.     header[:timer]         = Marshal.load(Marshal.dump($game_timer))
  170.     header[:message]       = Marshal.load(Marshal.dump($game_message))
  171.     header[:switches]      = Marshal.load(Marshal.dump($game_switches))
  172.     header[:variables]     = Marshal.load(Marshal.dump($game_variables))
  173.     header[:self_switches] = Marshal.load(Marshal.dump($game_self_switches))
  174.     header[:actors]        = Marshal.load(Marshal.dump($game_actors))
  175.     header[:party]         = Marshal.load(Marshal.dump($game_party))
  176.     header[:troop]         = Marshal.load(Marshal.dump($game_troop))
  177.     header[:map]           = Marshal.load(Marshal.dump($game_map))
  178.     header[:player]        = Marshal.load(Marshal.dump($game_player))
  179.     header
  180.   end
  181.  
  182. end # DataManager
  183.  
  184. #==============================================================================
  185. # ?! Window_MenuCommand
  186. #==============================================================================
  187.  
  188. class Window_MenuCommand < Window_Command
  189.  
  190.   #--------------------------------------------------------------------------
  191.   # overwrite method: save_enabled
  192.   #--------------------------------------------------------------------------
  193.   def save_enabled; return true; end
  194.  
  195. end # Window_MenuCommand
  196.  
  197. #==============================================================================
  198. # ?! Window_FileList
  199. #==============================================================================
  200.  
  201. class Window_FileList < Window_Selectable
  202.  
  203.   #--------------------------------------------------------------------------
  204.   # initialize
  205.   #--------------------------------------------------------------------------
  206.   def initialize(dx, dy)
  207.     super(dx, dy, 128, Graphics.height - dy)
  208.     refresh
  209.     activate
  210.     select(SceneManager.scene.first_savefile_index)
  211.   end
  212.  
  213.   #--------------------------------------------------------------------------
  214.   # item_max
  215.   #--------------------------------------------------------------------------
  216.   def item_max; return DataManager.savefile_max; end
  217.  
  218.   #--------------------------------------------------------------------------
  219.   # current_item_enabled?
  220.   #--------------------------------------------------------------------------
  221.   def current_item_enabled?
  222.     header = DataManager.load_header(index)
  223.     return false if header.nil? && SceneManager.scene_is?(Scene_Load)
  224.     return true
  225.   end
  226.  
  227.   #--------------------------------------------------------------------------
  228.   # refresh
  229.   #--------------------------------------------------------------------------
  230.   def refresh
  231.     create_contents
  232.     draw_all_items
  233.   end
  234.  
  235.   #--------------------------------------------------------------------------
  236.   # draw_item
  237.   #--------------------------------------------------------------------------
  238.   def draw_item(index)
  239.     header = DataManager.load_header(index)
  240.     enabled = !header.nil?
  241.     rect = item_rect(index)
  242.     rect.width -= 4
  243.     draw_icon(save_icon?(header), rect.x, rect.y, enabled)
  244.     change_color(normal_color, enabled)
  245.     text = sprintf(YEA::SAVE::SLOT_NAME, (index + 1).group)
  246.     draw_text(rect.x+24, rect.y, rect.width-24, line_height, text)
  247.   end
  248.  
  249.   #--------------------------------------------------------------------------
  250.   # save_icon?
  251.   #--------------------------------------------------------------------------
  252.   def save_icon?(header)
  253.     return Icon.empty_icon if header.nil?
  254.     return Icon.save_icon
  255.   end
  256.  
  257. end # Window_FileList
  258.  
  259. #==============================================================================
  260. # ?! Window_FileStatus
  261. #==============================================================================
  262.  
  263. class Window_FileStatus < Window_Base
  264.  
  265.   #--------------------------------------------------------------------------
  266.   # initialize
  267.   #--------------------------------------------------------------------------
  268.   def initialize(dx, dy, file_window)
  269.     super(dx, dy, Graphics.width - dx, Graphics.height - dy)
  270.     @file_window = file_window
  271.     @current_index = @file_window.index
  272.     refresh
  273.   end
  274.  
  275.   #--------------------------------------------------------------------------
  276.   # update
  277.   #--------------------------------------------------------------------------
  278.   def update
  279.     super
  280.     return if @file_window.index < 0
  281.     return if @current_index == @file_window.index
  282.     @current_index = @file_window.index
  283.     refresh
  284.   end
  285.  
  286.   #--------------------------------------------------------------------------
  287.   # refresh
  288.   #--------------------------------------------------------------------------
  289.   def refresh
  290.     contents.clear
  291.     reset_font_settings
  292.     @header = DataManager.load_header(@file_window.index)
  293.     if @header.nil?
  294.       draw_empty
  295.     else
  296.       draw_save_contents
  297.     end
  298.   end
  299.  
  300.   #--------------------------------------------------------------------------
  301.   # draw_empty
  302.   #--------------------------------------------------------------------------
  303.   def draw_empty
  304.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  305.     rect = Rect.new(0, 0, contents.width, contents.height)
  306.     contents.fill_rect(rect, colour)
  307.     text = YEA::SAVE::EMPTY_TEXT
  308.     change_color(system_color)
  309.     draw_text(rect, text, 1)
  310.   end
  311.  
  312.   #--------------------------------------------------------------------------
  313.   # draw_save_slot
  314.   #--------------------------------------------------------------------------
  315.   def draw_save_slot(dx, dy, dw)
  316.     reset_font_settings
  317.     change_color(system_color)
  318.     text = sprintf(YEA::SAVE::SLOT_NAME, "")
  319.     draw_text(dx, dy, dw, line_height, text)
  320.     cx = text_size(text).width
  321.     change_color(normal_color)
  322.     draw_text(dx+cx, dy, dw-cx, line_height, (@file_window.index+1).group)
  323.   end
  324.  
  325.   #--------------------------------------------------------------------------
  326.   # draw_save_playtime
  327.   #--------------------------------------------------------------------------
  328.   def draw_save_playtime(dx, dy, dw)
  329.     return if @header[:playtime_s].nil?
  330.     reset_font_settings
  331.     change_color(system_color)
  332.     draw_text(dx, dy, dw, line_height, YEA::SAVE::PLAYTIME, 0)
  333.     change_color(normal_color)
  334.     draw_text(dx, dy, dw, line_height, @header[:playtime_s], 2)
  335.   end
  336.  
  337.   #--------------------------------------------------------------------------
  338.   # draw_save_total_saves
  339.   #--------------------------------------------------------------------------
  340.   def draw_save_total_saves(dx, dy, dw)
  341.     return if @header[:system].nil?
  342.     reset_font_settings
  343.     change_color(system_color)
  344.     text = YEA::SAVE::TOTAL_SAVE
  345.     draw_text(dx, dy, dw, line_height, text)
  346.     cx = text_size(text).width
  347.     change_color(normal_color)
  348.     draw_text(dx+cx, dy, dw-cx, line_height, @header[:system].save_count.group)
  349.   end
  350.  
  351.   #--------------------------------------------------------------------------
  352.   # draw_save_gold
  353.   #--------------------------------------------------------------------------
  354.   def draw_save_gold(dx, dy, dw)
  355.     return if @header[:party].nil?
  356.     reset_font_settings
  357.     change_color(system_color)
  358.     draw_text(dx, dy, dw, line_height, YEA::SAVE::TOTAL_GOLD)
  359.     text = Vocab::currency_unit
  360.     draw_text(dx, dy, dw, line_height, text, 2)
  361.     cx = text_size(text).width
  362.     change_color(normal_color)
  363.     text = @header[:party].gold.group
  364.     draw_text(dx, dy, dw-cx, line_height, text, 2)
  365.   end
  366.  
  367.   #--------------------------------------------------------------------------
  368.   # draw_save_location
  369.   #--------------------------------------------------------------------------
  370.   def draw_save_location(dx, dy, dw)
  371.     return if @header[:map].nil?
  372.     reset_font_settings
  373.     change_color(system_color)
  374.     draw_text(dx, dy, dw, line_height, YEA::SAVE::LOCATION)
  375.     change_color(normal_color)
  376.     cx = text_size(YEA::SAVE::LOCATION).width
  377.     return if $data_mapinfos[@header[:map].map_id].nil?
  378.     text = @header[:map].display_name
  379.     text = $data_mapinfos[@header[:map].map_id].name if text == ""
  380.     draw_text(dx+cx, dy, dw-cx, line_height, text)
  381.   end
  382.  
  383.   #--------------------------------------------------------------------------
  384.   # draw_save_characters
  385.   #--------------------------------------------------------------------------
  386.   def draw_save_characters(dx, dy)
  387.     return if @header[:party].nil?
  388.     reset_font_settings
  389.     make_font_smaller
  390.     dw = (contents.width - dx) / @header[:party].max_battle_members
  391.     dx += dw/2
  392.     for member in @header[:party].battle_members
  393.       next if member.nil?
  394.       member = @header[:actors][member.id]
  395.       change_color(normal_color)
  396.       draw_actor_graphic(member, dx, dy)
  397.       text = member.name
  398.       draw_text(dx-dw/2, dy, dw, line_height, text, 1)
  399.       text = member.level.group
  400.       draw_text(dx-dw/2, dy-line_height, dw-4, line_height, text, 2)
  401.       cx = text_size(text).width
  402.       change_color(system_color)
  403.       text = Vocab::level_a
  404.       draw_text(dx-dw/2, dy-line_height, dw-cx-4, line_height, text, 2)
  405.       dx += dw
  406.     end
  407.   end
  408.  
  409.   #--------------------------------------------------------------------------
  410.   # draw_save_column1
  411.   #--------------------------------------------------------------------------
  412.   def draw_save_column1(dx, dy, dw)
  413.     data = YEA::SAVE::COLUMN1_VARIABLES
  414.     draw_column_data(data, dx, dy, dw)
  415.   end
  416.  
  417.   #--------------------------------------------------------------------------
  418.   # draw_save_column2
  419.   #--------------------------------------------------------------------------
  420.   def draw_save_column2(dx, dy, dw)
  421.     data = YEA::SAVE::COLUMN2_VARIABLES
  422.     draw_column_data(data, dx, dy, dw)
  423.   end
  424.  
  425.   #--------------------------------------------------------------------------
  426.   # draw_column_data
  427.   #--------------------------------------------------------------------------
  428.   def draw_column_data(data, dx, dy, dw)
  429.     return if @header[:variables].nil?
  430.     reset_font_settings
  431.     for variable_id in data
  432.       next if $data_system.variables[variable_id].nil?
  433.       change_color(system_color)
  434.       name = $data_system.variables[variable_id]
  435.       draw_text(dx, dy, dw, line_height, name, 0)
  436.       value = @header[:variables][variable_id].group
  437.       change_color(normal_color)
  438.       draw_text(dx, dy, dw, line_height, value, 2)
  439.       dy += line_height
  440.     end
  441.   end
  442.  
  443.   #--------------------------------------------------------------------------
  444.   # draw_save_contents
  445.   #--------------------------------------------------------------------------
  446.   def draw_save_contents
  447.     draw_save_slot(4, 0, contents.width/2-8)
  448.     draw_save_playtime(contents.width/2+4, 0, contents.width/2-8)
  449.     draw_save_total_saves(4, line_height, contents.width/2-8)
  450.     draw_save_gold(contents.width/2+4, line_height, contents.width/2-8)
  451.     draw_save_location(4, line_height*2, contents.width-8)
  452.     draw_save_characters(0, line_height*5 + line_height/3)
  453.     draw_save_column1(16, line_height*7, contents.width/2-48)
  454.     draw_save_column2(contents.width/2+16, line_height*7, contents.width/2-48)
  455.   end
  456.  
  457. end # Window_FileStatus
  458.  
  459. #==============================================================================
  460. # ?! Window_FileAction
  461. #==============================================================================
  462.  
  463. class Window_FileAction < Window_HorzCommand
  464.  
  465.   #--------------------------------------------------------------------------
  466.   # initialize
  467.   #--------------------------------------------------------------------------
  468.   def initialize(dx, dy, file_window)
  469.     @file_window = file_window
  470.     super(dx, dy)
  471.     deactivate
  472.     unselect
  473.   end
  474.  
  475.   #--------------------------------------------------------------------------
  476.   # window_width
  477.   #--------------------------------------------------------------------------
  478.   def window_width; Graphics.width - 128; end
  479.  
  480.   #--------------------------------------------------------------------------
  481.   # col_max
  482.   #--------------------------------------------------------------------------
  483.   def col_max; return 3; end
  484.  
  485.   #--------------------------------------------------------------------------
  486.   # update
  487.   #--------------------------------------------------------------------------
  488.   def update
  489.     super
  490.     return if @file_window.index < 0
  491.     return if @current_index == @file_window.index
  492.     @current_index = @file_window.index
  493.     refresh
  494.   end
  495.  
  496.   #--------------------------------------------------------------------------
  497.   # make_command_list
  498.   #--------------------------------------------------------------------------
  499.   def make_command_list
  500.     @header = DataManager.load_header(@file_window.index)
  501.     add_load_command
  502.     add_save_command
  503.     add_delete_command
  504.   end
  505.  
  506.   #--------------------------------------------------------------------------
  507.   # add_load_command
  508.   #--------------------------------------------------------------------------
  509.   def add_load_command
  510.     add_command(YEA::SAVE::ACTION_LOAD, :load, load_enabled?)
  511.   end
  512.  
  513.   #--------------------------------------------------------------------------
  514.   # load_enabled?
  515.   #--------------------------------------------------------------------------
  516.   def load_enabled?
  517.     return false if @header.nil?
  518.     return true
  519.   end
  520.  
  521.   #--------------------------------------------------------------------------
  522.   # add_save_command
  523.   #--------------------------------------------------------------------------
  524.   def add_save_command
  525.     add_command(YEA::SAVE::ACTION_SAVE, :save, save_enabled?)
  526.   end
  527.  
  528.   #--------------------------------------------------------------------------
  529.   # save_enabled?
  530.   #--------------------------------------------------------------------------
  531.   def save_enabled?
  532.     return false if @header.nil? && SceneManager.scene_is?(Scene_Load)
  533.     return false if SceneManager.scene_is?(Scene_Load)
  534.     return false if $game_system.save_disabled
  535.     return true
  536.   end
  537.  
  538.   #--------------------------------------------------------------------------
  539.   # add_delete_command
  540.   #--------------------------------------------------------------------------
  541.   def add_delete_command
  542.     add_command(YEA::SAVE::ACTION_DELETE, :delete, delete_enabled?)
  543.   end
  544.  
  545.   #--------------------------------------------------------------------------
  546.   # delete_enabled?
  547.   #--------------------------------------------------------------------------
  548.   def delete_enabled?
  549.     return false if @header.nil?
  550.     return true
  551.   end
  552.  
  553.   #--------------------------------------------------------------------------
  554.   # update_help
  555.   #--------------------------------------------------------------------------
  556.   def update_help
  557.     case current_symbol
  558.     when :load; @help_window.set_text(YEA::SAVE::LOAD_HELP)
  559.     when :save; @help_window.set_text(YEA::SAVE::SAVE_HELP)
  560.     when :delete; @help_window.set_text(YEA::SAVE::DELETE_HELP)
  561.     end
  562.   end
  563.  
  564. end # Window_FileAction
  565.  
  566. #==============================================================================
  567. # ?! Scene_File
  568. #==============================================================================
  569.  
  570. class Scene_File < Scene_MenuBase
  571.  
  572.   #--------------------------------------------------------------------------
  573.   # overwrite method: start
  574.   #--------------------------------------------------------------------------
  575.   def start
  576.     super
  577.     create_all_windows
  578.   end
  579.  
  580.   #--------------------------------------------------------------------------
  581.   # overwrite method: terminate
  582.   #--------------------------------------------------------------------------
  583.   def terminate
  584.     super
  585.   end
  586.  
  587.   #--------------------------------------------------------------------------
  588.   # overwrite method: update
  589.   #--------------------------------------------------------------------------
  590.   def update
  591.     super
  592.   end
  593.  
  594.   #--------------------------------------------------------------------------
  595.   # new method: create_all_windows
  596.   #--------------------------------------------------------------------------
  597.   def create_all_windows
  598.     create_help_window
  599.     create_file_window
  600.     create_action_window
  601.     create_status_window
  602.   end
  603.  
  604.   #--------------------------------------------------------------------------
  605.   # overwrite method: create_help_window
  606.   #--------------------------------------------------------------------------
  607.   def create_help_window
  608.     @help_window = Window_Help.new
  609.     @help_window.set_text(YEA::SAVE::SELECT_HELP)
  610.   end
  611.  
  612.   #--------------------------------------------------------------------------
  613.   # new method: create_file_window
  614.   #--------------------------------------------------------------------------
  615.   def create_file_window
  616.     wy = @help_window.height
  617.     @file_window = Window_FileList.new(0, wy)
  618.     @file_window.set_handler(:ok, method(:on_file_ok))
  619.     @file_window.set_handler(:cancel, method(:return_scene))
  620.   end
  621.  
  622.   #--------------------------------------------------------------------------
  623.   # new method: create_action_window
  624.   #--------------------------------------------------------------------------
  625.   def create_action_window
  626.     wx = @file_window.width
  627.     wy = @help_window.height
  628.     @action_window = Window_FileAction.new(wx, wy, @file_window)
  629.     @action_window.help_window = @help_window
  630.     @action_window.set_handler(:cancel, method(:on_action_cancel))
  631.     @action_window.set_handler(:load, method(:on_action_load))
  632.     @action_window.set_handler(:save, method(:on_action_save))
  633.     @action_window.set_handler(:delete, method(:on_action_delete))
  634.   end
  635.  
  636.   #--------------------------------------------------------------------------
  637.   # new method: create_status_window
  638.   #--------------------------------------------------------------------------
  639.   def create_status_window
  640.     wx = @action_window.x
  641.     wy = @action_window.y + @action_window.height
  642.     @status_window = Window_FileStatus.new(wx, wy, @file_window)
  643.   end
  644.  
  645.   #--------------------------------------------------------------------------
  646.   # new method: on_file_ok
  647.   #--------------------------------------------------------------------------
  648.   def on_file_ok
  649.     @action_window.activate
  650.     index = SceneManager.scene_is?(Scene_Load) ? 0 : 1
  651.     @action_window.select(index)
  652.   end
  653.  
  654.   #--------------------------------------------------------------------------
  655.   # new method: on_action_cancel
  656.   #--------------------------------------------------------------------------
  657.   def on_action_cancel
  658.     @action_window.unselect
  659.     @file_window.activate
  660.     @help_window.set_text(YEA::SAVE::SELECT_HELP)
  661.   end
  662.  
  663.   #--------------------------------------------------------------------------
  664.   # new method: on_action_load
  665.   #--------------------------------------------------------------------------
  666.   def on_action_load
  667.     if DataManager.load_game(@file_window.index)
  668.       on_load_success
  669.     else
  670.       Sound.play_buzzer
  671.     end
  672.   end
  673.  
  674.   #--------------------------------------------------------------------------
  675.   # overwrite method: on_load_success
  676.   #--------------------------------------------------------------------------
  677.   def on_load_success
  678.     Sound.play_load
  679.     fadeout_all
  680.     $game_system.on_after_load
  681.     SceneManager.goto(Scene_Map)
  682.   end
  683.  
  684.   #--------------------------------------------------------------------------
  685.   # new method: on_action_save
  686.   #--------------------------------------------------------------------------
  687.   def on_action_save
  688.     @action_window.activate
  689.     if DataManager.save_game(@file_window.index)
  690.       on_save_success
  691.       refresh_windows
  692.     else
  693.       Sound.play_buzzer
  694.     end
  695.   end
  696.  
  697.   #--------------------------------------------------------------------------
  698.   # overwrite method: on_save_success
  699.   #--------------------------------------------------------------------------
  700.   def on_save_success; Sound.play_save; end
  701.  
  702.   #--------------------------------------------------------------------------
  703.   # new method: on_action_delete
  704.   #--------------------------------------------------------------------------
  705.   def on_action_delete
  706.     @action_window.activate
  707.     DataManager.delete_save_file(@file_window.index)
  708.     on_delete_success
  709.     refresh_windows
  710.   end
  711.  
  712.   #--------------------------------------------------------------------------
  713.   # new method: on_delete_success
  714.   #--------------------------------------------------------------------------
  715.   def on_delete_success
  716.     YEA::SAVE::DELETE_SOUND.play
  717.   end
  718.  
  719.   #--------------------------------------------------------------------------
  720.   # new method: refresh_windows
  721.   #--------------------------------------------------------------------------
  722.   def refresh_windows
  723.     @file_window.refresh
  724.     @action_window.refresh
  725.     @status_window.refresh
  726.   end
  727.  
  728. end # Scene_File
  729.  
  730. #==============================================================================
  731. # ?! Scene_Save
  732. #==============================================================================
  733.  
  734. class Scene_Save < Scene_File
  735.  
  736.   #--------------------------------------------------------------------------
  737.   # overwrite method: on_savefile_ok
  738.   #--------------------------------------------------------------------------
  739.   def on_savefile_ok; super; end
  740.  
  741.   #--------------------------------------------------------------------------
  742.   # overwrite method: on_save_success
  743.   #--------------------------------------------------------------------------
  744.   def on_save_success; super; end
  745.  
  746. end # help_window_text
  747.  
  748. #==============================================================================
  749. # ?! Scene_Load
  750. #==============================================================================
  751.  
  752. class Scene_Load < Scene_File
  753.  
  754.   #--------------------------------------------------------------------------
  755.   # overwrite method: on_savefile_ok
  756.   #--------------------------------------------------------------------------
  757.   def on_savefile_ok; super; end
  758.  
  759.   #--------------------------------------------------------------------------
  760.   # overwrite method: on_load_success
  761.   #--------------------------------------------------------------------------
  762.   def on_load_success; super; end
  763.  
  764. end # Scene_Load
  765.  
  766. #==============================================================================
  767. #
  768. # ?\ End of File
  769. #
  770. #==============================================================================
RAW Paste Data