pigu_6

Yanfly| Ace Save Engine

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