Advertisement
Guest User

XS - Menu Delux

a guest
Sep 8th, 2016
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.58 KB | None | 0 0
  1. #==============================================================================
  2. # XaiL System - Menu Delux
  3. # Author: Nicke
  4. # Created: 20/11/2012
  5. # Edited: 08/02/2013
  6. # Version: 1.1b
  7. #==============================================================================
  8. # Instructions
  9. # -----------------------------------------------------------------------------
  10. # To install this script, open up your script editor and copy/paste this script
  11. # to an open slot below ? Materials but above ? Main. Remember to save.
  12. #==============================================================================
  13. # Requires: XS - Core Script.
  14. #==============================================================================
  15. #
  16. # This script changes the way the menu scene works. Not compatible with
  17. # XS - Menu or XS - Icon Menu.
  18. #
  19. # Instructions are in the settings module below. Make sure you read through
  20. # everything so you understand each section.
  21. #
  22. # *** Only for RPG Maker VX Ace. ***
  23. #==============================================================================
  24. ($imported ||= {})["XAIL-XS-MENU_DELUX"] = true
  25.  
  26. module XAIL
  27. module MENU_DELUX
  28. #--------------------------------------------------------------------------#
  29. # * Settings
  30. #--------------------------------------------------------------------------#
  31. # FONT:
  32. # FONT = [name, size, color, bold, shadow]
  33. FONT = [["Calibri", "Verdana"], 18, Color.new(255,255,255), true, true]
  34.  
  35. # PLAYTIME_ICON:
  36. # Set playtime window icon.
  37. # PLAYTIME_ICON = icon_id
  38. PLAYTIME_ICON = 280
  39.  
  40. # MENU_ALIGNMENT:
  41. # MENU_ALIGNMENT = 0 (left), 1 (center), 2 (right)
  42. MENU_ALIGNMENT = 0 # Default: 2.
  43.  
  44. # MENU_SKIN:
  45. # The windowskin to use for the windows.
  46. # Set to nil to disable.
  47. # MENU_SKIN = string
  48. MENU_SKIN = nil
  49.  
  50. # MENU_LIST:
  51. # name, icon_index and custom are optional.
  52. # If name is empty it will use the corresponding symbol as name instead.
  53. # To make a command a common event you need to set custom to the common event
  54. # id you want to run as seen below.
  55. # symbol => [name, description, icon_index, enabled, personal, custom]
  56. MENU_LIST = {
  57. :item => ["", "Browse through your acquired items.", 4148, true, false],
  58. :equip => ["Equipment", "Change your equipment.", 4145, true, true],
  59. :skill => ["Spells", "Manage your available skills.", 4147, true, true],
  60. :status => ["Stats", "See the current status of the hero.", 4136, true, true],
  61. :formation => ["", "Change the formation of the party.", 4134, true, false],
  62. :save => ["", "Record your progress.", 4139, true, false],
  63. :load => ["", "Load your saved progress.", 4165, true, false, Scene_Load],
  64. :game_end => ["Quit", "Exit the program.", 4162, true, false],
  65. :title => ["", "Return to title.", 4133, true, false, Scene_Title],
  66. :quest => ["Quests", "Read about your quests", 4132, true, true, Scene_Quest],
  67.  
  68. } # Don't remove this line!
  69.  
  70. # MENU_SAVE = true/false
  71. # Override enabled option for save (so you can change it ingame).
  72. MENU_SAVE = true
  73.  
  74. # If MENU_CUSTOM is true you will have to add the commands yourself
  75. # ingame, which can be useful for certain quest related stuff or if you
  76. # want to enable/disable menu commands.
  77. # To add/remove a command ingame follow these instructions:
  78. #
  79. # In a script call do like this:
  80. # menu_scene(key, type)
  81. # menu_scene(:item,:add) # To add item to menu list.
  82. # menu_scene(:item,:del) # To remove item from menu list.
  83. #
  84. # In a conditional branch you can check if a menu command is
  85. # enabled/disabled:
  86. # menu_active?(key)
  87. # menu_active?(:item) # Check if item is enabled.
  88. # !menu_active?(:item) # Check if item is disabled.
  89. #
  90. # To set a id to be enabled do like this:
  91. # menu_active(:skill, true) # Set menu skill to be enabled.
  92. #
  93. # To add/remove all available menu commands use one of the
  94. # following methods in a script call:
  95. # menu_add_all
  96. # menu_del_all
  97. #
  98. # MENU_CUSTOM = true/false
  99. MENU_CUSTOM = false
  100.  
  101. # The text to be displayed if no menu items is available.
  102. # Only used if MENU_CUSTOM is true.
  103. # MENU_EMPTY = string
  104. EMPTY = "Menu is not available at this point..."
  105.  
  106. # MENU_MUSIC:
  107. # Set the music to be played at the menu scene.
  108. # This is optional.
  109. # MUSIC = true/false
  110. MUSIC = true
  111. # MUSIC_BGM = [name, volume, pitch]
  112. MUSIC_BGM = ["Theme4", 70, 100]
  113. # MUSIC_BGS = [name, volume, pitch]
  114. MUSIC_BGS = ["Darkness", 50, 100]
  115.  
  116. # ANIM_LIST:
  117. # A list of animation images.
  118. # name => [z, zoom_x, zoom_y, blend_type, opacity]
  119. ANIM_LIST = {
  120. "Menu_Fog1" => [1, 1.2, 1.2, 1, 125],
  121. "Menu_Fog2" => [1, 1.8, 1.8, 1, 155]
  122. } # Don't remove this line!
  123.  
  124. # BACKGROUND:
  125. # name => [x, y, z, opacity]
  126. BACKGROUND = {
  127. #"" => [0, 0, 200, 255]
  128. } # Don't remove this line!
  129.  
  130. # Show vocab for HP, MP and TP.
  131. # BAR_VOCAB = true/false
  132. BAR_VOCAB = false
  133.  
  134. # BAR_COLOR = rgba(255,255,255,255)
  135. # Set the color of the gauges.
  136. BAR_HP = [Color.new(255,25,25,32), Color.new(255,150,150)]
  137. BAR_MP = [Color.new(25,25,255,32), Color.new(150,150,255)]
  138. BAR_TP = [Color.new(25,255,25,32), Color.new(150,255,150)]
  139.  
  140. # DETAILS:
  141. # Setup details here. (Recommended to use the default ones since you will
  142. # need a bit RGSS knowledge to add more.)
  143. def self.details
  144. ["#{Vocab::currency_unit}: #{$game_party.gold}",
  145. "Steps: #{$game_party.steps}",
  146. "Collected Items: #{$game_party.all_items.size}",
  147. "Map: #{$data_mapinfos[$game_map.map_id].name}",
  148. "Leader: #{$game_party.leader.name}",
  149. "Battle Count: #{$game_system.battle_count}",
  150. "Save Count: #{$game_system.save_count}",
  151. "Party Members: #{$game_party.all_members.size}",
  152. "Highest Level: #{$game_party.highest_level}",
  153. "Variable I: #{$game_variables[1]}",
  154. "Variable II: #{$game_variables[2]}"]
  155. end
  156.  
  157. # DETAILS_ICONS:
  158. # DETAILS_ICONS[id] = icon_id
  159. # Set the details icon_id. (optional)
  160. # Should be in the same order as details.
  161. # Use nil to disable a icon.
  162. DETAILS_ICONS = []
  163. DETAILS_ICONS[0] = 2114 # GOLD
  164. DETAILS_ICONS[1] = 172 # STEPS
  165. DETAILS_ICONS[2] = 270 # ITEMS
  166. DETAILS_ICONS[3] = 232 # MAP
  167. DETAILS_ICONS[4] = 4425 # LEADER
  168. DETAILS_ICONS[5] = 115 # BATTLE COUNT
  169. DETAILS_ICONS[6] = 224 # SAVE COUNT
  170. DETAILS_ICONS[7] = 121 # PARTY MEMBERS
  171. DETAILS_ICONS[8] = 14 # HIGHEST LEVEL
  172. DETAILS_ICONS[9] = nil # VARIABLE 1
  173. DETAILS_ICONS[10] = nil # VARIABLE 2
  174.  
  175. # Transition, nil to use default.
  176. # TRANSITION [speed, transition, opacity]
  177. TRANSITION = nil
  178.  
  179. end
  180. end
  181. # *** Don't edit below unless you know what you are doing. ***
  182. #==============================================================================#
  183. # ** Error Handler
  184. #==============================================================================#
  185. unless $imported["XAIL-XS-CORE"]
  186. # // Error handler when XS - Core is not installed.
  187. msg = "The script %s requires the latest version of XS - Core in order to function properly."
  188. name = "XS - Menu Delux"
  189. msgbox(sprintf(msg, name))
  190. exit
  191. end
  192. #==============================================================================#
  193. # ** Game_System
  194. #==============================================================================#
  195. class Game_System
  196.  
  197. attr_accessor :menu_list
  198.  
  199. alias xail_menu_delux_gm_sys_initialize initialize
  200. def initialize(*args, &block)
  201. # // Method to initialize game system.
  202. xail_menu_delux_gm_sys_initialize(*args, &block)
  203. @menu_list = {}
  204. end
  205.  
  206. def get_menu
  207. # // Method to get the menu list.
  208. XAIL::MENU_DELUX::MENU_CUSTOM ? @menu_list : XAIL::MENU_DELUX::MENU_LIST
  209. end
  210.  
  211. end
  212. #==============================================================================#
  213. # ** Game_Interpreter
  214. #==============================================================================#
  215. class Game_Interpreter
  216.  
  217. def menu_scene(key, type = :add)
  218. # // Method to add/remove a menu item to the list.
  219. case type
  220. when :add # // Add menu id.
  221. unless $game_system.menu_list.include?(XAIL::MENU_DELUX::MENU_LIST[key])
  222. $game_system.menu_list[key] = XAIL::MENU_DELUX::MENU_LIST[key]
  223. end unless XAIL::MENU_DELUX::MENU_LIST[key].nil?
  224. when :del # // Remove menu id.
  225. unless XAIL::MENU_DELUX::MENU_LIST[key].nil?
  226. $game_system.menu_list.delete(key)
  227. end
  228. end
  229. end
  230.  
  231. def menu_active?(key)
  232. # // Method to check if menu key is enabled.
  233. # This will return nil if menu item not added in the list.
  234. return $game_system.menu_list[key][3] rescue nil
  235. end
  236.  
  237. def menu_active(key, enabled)
  238. # // Method to enable id.
  239. $game_system.menu_list[key][3] = enabled
  240. end
  241.  
  242. def menu_add_all
  243. # // Method to add all available menu items.
  244. XAIL::MENU_DELUX::MENU_LIST.each_key {|key| menu_scene(key) }
  245. end
  246.  
  247. def menu_del_all
  248. # // Method to remove all available menu items.
  249. XAIL::MENU_DELUX::MENU_LIST.each_key {|key| menu_scene(key, :del) }
  250. end
  251.  
  252. end
  253. #==============================================================================
  254. # ** Window_MenuCommand
  255. #==============================================================================
  256. class Window_MenuCommand < Window_Command
  257.  
  258. def window_width
  259. # // Method to return the width of the window.
  260. return Graphics.width / 4
  261. end
  262.  
  263. def window_height
  264. # // Method to return the height of the window.
  265. return Graphics.height
  266. end
  267.  
  268. def alignment
  269. # // Method to return the alignment.
  270. return XAIL::MENU_DELUX::MENU_ALIGNMENT
  271. end
  272.  
  273. def menu_color(color, enabled = true)
  274. # // Method to set the color and alpha if not enabled.
  275. contents.font.color.set(color)
  276. contents.font.color.alpha = Colors::AlphaMenu unless enabled
  277. end
  278.  
  279. def item_rect_for_text(index)
  280. # // Method to draw item rect for text.
  281. rect = item_rect(index)
  282. rect.x += 25
  283. draw_line_ex(rect.x - 4, rect.y + 9, Color.new(255,255,255), Color.new(0,0,0,128))
  284. draw_icon(XAIL::MENU_DELUX::MENU_LIST.values[index][2], -2, rect.y) unless XAIL::MENU_DELUX::MENU_LIST.values[index][2].nil?
  285. rect
  286. end
  287.  
  288. def draw_item(index)
  289. # // Method to draw the command item.
  290. contents.font.name = XAIL::MENU_DELUX::FONT[0]
  291. contents.font.size = XAIL::MENU_DELUX::FONT[1]
  292. # // Save enable option.
  293. XAIL::MENU_DELUX::MENU_LIST[:save][3] = save_enabled if XAIL::MENU_DELUX::MENU_SAVE
  294. # // Default enable option.
  295. menu_color(XAIL::MENU_DELUX::FONT[2], menu_enabled?(index))
  296. # // Font settings
  297. contents.font.bold = XAIL::MENU_DELUX::FONT[3]
  298. contents.font.shadow = XAIL::MENU_DELUX::FONT[4]
  299. draw_text(item_rect_for_text(index), command_name(index), alignment)
  300. reset_font_settings
  301. end
  302.  
  303. def menu_enabled?(index)
  304. # // Method to check if menu item is enabled.
  305. return $game_system.get_menu.values[index][3]
  306. end
  307.  
  308. def make_command_list
  309. # // Method to add the commands.
  310. $game_system.get_menu.each {|key, value|
  311. name = value[0] == "" ? key.id2name.capitalize : value[0]
  312. XAIL::MENU_DELUX::MENU_LIST[:save][3] = save_enabled if XAIL::MENU_DELUX::MENU_SAVE
  313. add_command(name, key, value[3], value[5].nil? ? nil : value[5])
  314. }
  315. end
  316.  
  317. end
  318. #==============================================================================
  319. # ** Window_MenuStatus
  320. #==============================================================================
  321. class Window_MenuStatus < Window_Selectable
  322.  
  323. def initialize(x, y)
  324. # // Method to initialize the window.
  325. super(x, y, window_width, window_height)
  326. self.arrows_visible = false
  327. @pending_index = -1
  328. refresh
  329. end
  330.  
  331. def window_width
  332. # // Method to determine window width.
  333. return Graphics.width / 2.4
  334. end
  335.  
  336. def col_max
  337. # // Method to determine col max.
  338. return 2
  339. end
  340.  
  341. def spacing
  342. # // Method to determine spacing.
  343. return 6 if Graphics.width == 544 # For standard resolution.
  344. return 44 # For high resolution.
  345. end
  346.  
  347. def item_width
  348. # // Method to determine item width.
  349. return 98
  350. end
  351.  
  352. def item_height
  353. # // Method to determine item height.
  354. return 128
  355. end
  356.  
  357. def refresh
  358. # // Method to refresh the window.
  359. super
  360. # // Only display cursor arrow if more or equal to 5 party members.
  361. if $game_party.all_members.size >= 5
  362. self.arrows_visible = true
  363. end
  364. end
  365.  
  366. def draw_item(index)
  367. # // Method to draw item.
  368. actor = $game_party.members[index]
  369. rect = item_rect(index)
  370. # // Face
  371. draw_actor_face(actor, rect.x + 1, rect.y + 1, true)
  372. # // Name
  373. draw_font_text(actor.name, rect.x + 4, rect.y, rect.width, 0, XAIL::MENU_DELUX::FONT[0], 20, XAIL::MENU_DELUX::FONT[2])
  374. # // Level
  375. lvl = "#{Vocab::level_a}: #{actor.level}"
  376. draw_font_text(lvl, rect.x + 4, rect.y + 64, rect.width, 0, XAIL::MENU_DELUX::FONT[0], 18, XAIL::MENU_DELUX::FONT[2])
  377. # // Class
  378. # // Check if Yanfly Class System is installed.
  379. if $imported["YEA-ClassSystem"]
  380. actor_class = actor.subclass.nil? ? actor.class.name : "#{actor.class.name} [#{actor.subclass.name}]"
  381. else
  382. actor_class = actor.class.name
  383. end
  384. draw_font_text(actor_class, rect.x - 4, rect.y + 76, rect.width, 2, XAIL::MENU_DELUX::FONT[0], 16, XAIL::MENU_DELUX::FONT[2])
  385. # // Stats
  386. draw_menu_stats(actor, :hp, rect.x, rect.y + 90, XAIL::MENU_DELUX::BAR_HP[0], XAIL::MENU_DELUX::BAR_HP[1], rect.width - 2)
  387. draw_menu_stats(actor, :mp, rect.x, rect.y + 100, XAIL::MENU_DELUX::BAR_MP[0], XAIL::MENU_DELUX::BAR_MP[1], rect.width - 2)
  388. draw_menu_stats(actor, :tp, rect.x, rect.y + 110, XAIL::MENU_DELUX::BAR_TP[0], XAIL::MENU_DELUX::BAR_TP[1], rect.width - 2)
  389. end
  390.  
  391. def draw_menu_stats(actor, stat, x, y, color1, color2, width)
  392. # // Method to draw actor hp & mp.
  393. case stat
  394. when :hp
  395. rate = actor.hp_rate ; vocab = Vocab::hp_a ; values = [actor.hp, actor.mhp]
  396. when :mp
  397. rate = actor.mp_rate ; vocab = Vocab::mp_a ; values = [actor.mp, actor.mmp]
  398. when :tp
  399. rate = actor.tp_rate ; vocab = Vocab::tp_a ; values = [actor.tp, actor.max_tp]
  400. end
  401. contents.font.name = XAIL::MENU_DELUX::FONT[0]
  402. contents.font.size = 14 # // Override font size.
  403. contents.font.color = XAIL::MENU_DELUX::FONT[2]
  404. contents.font.bold = XAIL::MENU_DELUX::FONT[3]
  405. contents.font.shadow = XAIL::MENU_DELUX::FONT[4]
  406. # // Draw guage.
  407. draw_gauge_ex(x, y - 8, width, 8, rate, color1, color2)
  408. # // Draw stats.
  409. draw_text(x + 2, y, width, line_height, values[0], 0)
  410. draw_text(x + 1, y, width, line_height, values[1], 2)
  411. # // Draw vocab.
  412. draw_text(x, y, width, line_height, vocab, 1) if XAIL::MENU_DELUX::BAR_VOCAB
  413. reset_font_settings
  414. end
  415.  
  416. end
  417. #==============================================================================
  418. # ** Window_Menu_Details
  419. #==============================================================================
  420. class Window_Menu_Details < Window_Base
  421.  
  422. def initialize(x, y)
  423. # // Method to initialize.
  424. super(x, y, window_width, window_height)
  425. @leader = $game_party.leader
  426. refresh
  427. end
  428.  
  429. def window_width
  430. # // Method to determine window width.
  431. return Graphics.width / 3
  432. end
  433.  
  434. def window_height
  435. # // Method to determine window height.
  436. return Graphics.height
  437. end
  438.  
  439. def refresh
  440. # // Method to refresh the window.
  441. contents.clear
  442. # // Draw details.
  443. y = -10
  444. XAIL::MENU_DELUX.details.each_index {|i|
  445. draw_line_ex(0, y += 24, Color.new(255,255,255,32), Color.new(0,0,0,64))
  446. draw_font_text(XAIL::MENU_DELUX.details[i], -4, line_height * i + 4, contents_width, 2, XAIL::MENU_DELUX::FONT[0], 16, XAIL::MENU_DELUX::FONT[2])
  447. }
  448. # // Draw icons.
  449. draw_icons(XAIL::MENU_DELUX::DETAILS_ICONS, :vertical, 2, line_height * 0 + 2)
  450. end
  451.  
  452. def update
  453. # // Method to update details window.
  454. super
  455. if @leader != $game_party.leader
  456. @leader = $game_party.leader
  457. refresh
  458. end
  459. end
  460.  
  461. end
  462. #==============================================================================
  463. # ** Window_Menu_Playtime
  464. #==============================================================================
  465. class Window_Menu_Playtime < Window_Base
  466.  
  467. def initialize(x, y)
  468. # // Method to initialize.
  469. super(x, y, 120, fitting_height(1))
  470. @playtime = $game_system.playtime_s
  471. refresh
  472. end
  473.  
  474. def refresh
  475. # // Method to refresh the window.
  476. contents.clear
  477. # // Draw icon.
  478. draw_icon(XAIL::MENU_DELUX::PLAYTIME_ICON, 4, 0)
  479. # // Draw playtime.
  480. draw_font_text(@playtime, 0, 6, contents_width, 2, XAIL::MENU_DELUX::FONT[0], 22, XAIL::MENU_DELUX::FONT[2])
  481. end
  482.  
  483. def update
  484. # // Method to update the window.
  485. super
  486. @playtime = $game_system.playtime_s
  487. refresh
  488. end
  489.  
  490. end
  491. #==============================================================================#
  492. # ** Window_Menu_Help
  493. #==============================================================================#
  494. class Window_Menu_Help < Window_Help
  495.  
  496. attr_accessor :index
  497.  
  498. alias xail_icon_menu_winhelp_init initialize
  499. def initialize(*args, &block)
  500. # // Method to initialize help window.
  501. xail_icon_menu_winhelp_init(*args, &block)
  502. @index = 0
  503. end
  504.  
  505. def set_text(text, enabled)
  506. # // Method to set a new help text.
  507. if text != @text
  508. menu_color(XAIL::MENU_DELUX::FONT[2], enabled)
  509. @text = text
  510. refresh
  511. end
  512. end
  513.  
  514. def refresh
  515. # // Refresh help contents.
  516. contents.clear
  517. draw_help_text
  518. end
  519.  
  520. def draw_help_text
  521. # // Method to draw the help text.
  522. contents.font.name = XAIL::MENU_DELUX::FONT[0]
  523. contents.font.size = XAIL::MENU_DELUX::FONT[1]
  524. menu_color(XAIL::MENU_DELUX::FONT[2], menu_enabled?(@index))
  525. contents.font.bold = XAIL::MENU_DELUX::FONT[3]
  526. contents.font.shadow = XAIL::MENU_DELUX::FONT[4]
  527. # // Draw title and description for the menu.
  528. draw_line_ex(0, 14, Color.new(255,255,255), Color.new(0,0,0,128))
  529. draw_text_ex_no_reset(0, 0, @text)
  530. reset_font_settings
  531. end
  532.  
  533. def menu_enabled?(index)
  534. # // Method to check if menu item is enabled.
  535. return $game_system.get_menu.values[index][3]
  536. end
  537.  
  538. def menu_color(color, enabled = true)
  539. # // Method to set the color and alpha if not enabled.
  540. contents.font.color.set(color)
  541. contents.font.color.alpha = 150 unless enabled
  542. end
  543.  
  544. end
  545. #==============================================================================#
  546. # ** Scene_MenuBase
  547. #==============================================================================#
  548. class Scene_MenuBase < Scene_Base
  549.  
  550. def start
  551. # // Method to start the scene.
  552. super
  553. @actor = $game_party.menu_actor
  554. if SceneManager.scene_is?(Scene_Menu)
  555. @backgrounds = []
  556. @animations = []
  557. create_menu_backgrounds
  558. create_menu_animations
  559. end
  560. end
  561.  
  562. def create_menu_backgrounds
  563. # // Method to create custom background(s).
  564. XAIL::MENU_DELUX::BACKGROUND.each {|key, value| @backgrounds << [Sprite.new, key] }
  565. @backgrounds.each {|i|
  566. i[0].bitmap = Cache.system(i[1])
  567. i[0].x = XAIL::MENU_DELUX::BACKGROUND[i[1]][0]
  568. i[0].y = XAIL::MENU_DELUX::BACKGROUND[i[1]][1]
  569. i[0].z = XAIL::MENU_DELUX::BACKGROUND[i[1]][2]
  570. i[0].opacity = XAIL::MENU_DELUX::BACKGROUND[i[1]][3]
  571. }
  572. end
  573.  
  574. def create_menu_animations
  575. # // Method to create custom animation(s).
  576. # name => [z, zoom_x, zoom_y, blend_type, opacity]
  577. XAIL::MENU_DELUX::ANIM_LIST.each {|key, value| @animations.push << [Plane.new, key] }
  578. @animations.each {|i|
  579. i[0].bitmap = Cache.system(i[1])
  580. i[0].z = XAIL::MENU_DELUX::ANIM_LIST[i[1]][0]
  581. i[0].zoom_x = XAIL::MENU_DELUX::ANIM_LIST[i[1]][1]
  582. i[0].zoom_y = XAIL::MENU_DELUX::ANIM_LIST[i[1]][2]
  583. i[0].blend_type = XAIL::MENU_DELUX::ANIM_LIST[i[1]][3]
  584. i[0].opacity = XAIL::MENU_DELUX::ANIM_LIST[i[1]][4]
  585. }
  586. end
  587.  
  588. alias xail_upd_menubase_delux_upd update
  589. def update(*args, &block)
  590. # // Method for updating the scene.
  591. xail_upd_menubase_delux_upd(*args, &block)
  592. if SceneManager.scene_is?(Scene_Menu)
  593. for i in 0...@animations.size
  594. @animations[i][0].ox += 1.2 - i
  595. @animations[i][0].oy -= 0.6 + i
  596. end unless scene_changing?
  597. delay?(1)
  598. end
  599. end
  600.  
  601. def delay?(amount)
  602. # // Method to delay.
  603. amount.times do
  604. update_basic
  605. end
  606. end
  607.  
  608. alias xail_menubase_delux_transition perform_transition
  609. def perform_transition(*args, &block)
  610. # // Method to create the transition.
  611. return if $game_system.get_menu.empty?
  612. if XAIL::MENU_DELUX::TRANSITION.nil?
  613. xail_menubase_delux_transition(*args, &block)
  614. else
  615. Graphics.transition(XAIL::MENU_DELUX::TRANSITION[0],XAIL::MENU_DELUX::TRANSITION[1],XAIL::MENU_DELUX::TRANSITION[2])
  616. end
  617. end
  618.  
  619. def dispose_sprites
  620. # // Method to dispose sprites.
  621. @backgrounds.each {|i| i[0].dispose unless i[0].nil? ; i[0] = nil } rescue nil
  622. @animations.each {|i| i[0].dispose unless i[0].nil? ; i[0] = nil } rescue nil
  623. end
  624.  
  625. def terminate
  626. # // Method to terminate.
  627. super
  628. dispose_sprites unless SceneManager.scene_is?(Scene_Menu)
  629. end
  630.  
  631. end
  632. #==============================================================================#
  633. # ** Scene_Menu
  634. #==============================================================================#
  635. class Scene_Menu < Scene_MenuBase
  636.  
  637. def start
  638. super
  639. # // Method to start the scene.
  640. # // Return if menu empty.
  641. return command_map if $game_system.get_menu.empty?
  642. # // Create windows.
  643. create_menu_command_window
  644. create_menu_status_window
  645. create_menu_details_window
  646. create_menu_playtime_window
  647. create_menu_help_window
  648. # // Set help text to first menu command.
  649. help_update(@command_window.index)
  650. # // Play music if enabled.
  651. play_menu_music if XAIL::MENU_DELUX::MUSIC
  652. end
  653.  
  654. def create_menu_command_window
  655. # // Method to create the command window.
  656. @command_window = Window_MenuCommand.new
  657. @command_window.windowskin = Cache.system(XAIL::MENU_DELUX::MENU_SKIN) unless XAIL::MENU_DELUX::MENU_SKIN.nil?
  658. @command_window.back_opacity = 96
  659. $game_system.get_menu.each {|key, value|
  660. unless value[5].nil?
  661. @command_window.set_handler(key, method(:command_custom))
  662. else
  663. if value[4]
  664. @command_window.set_handler(key, method(:command_personal))
  665. else
  666. @command_window.set_handler(key, method("command_#{key}".to_sym))
  667. end
  668. end
  669. }
  670. @command_window.set_handler(:cancel, method(:return_scene))
  671. end
  672.  
  673. def create_menu_status_window
  674. # // Method to create the status window.
  675. @status_window = Window_MenuStatus.new(0, 0)
  676. @status_window.height = Graphics.height - 72
  677. @status_window.x = @command_window.width
  678. @status_window.back_opacity = 96
  679. end
  680.  
  681. def create_menu_details_window
  682. # // Method to create the details window.
  683. @details_window = Window_Menu_Details.new(0, 0)
  684. @details_window.x = Graphics.width - @details_window.width
  685. @details_window.back_opacity = 96
  686. end
  687.  
  688. def create_menu_playtime_window
  689. # // Method to create the playtime window.
  690. @playtime_window = Window_Menu_Playtime.new(0, 0)
  691. @playtime_window.x = Graphics.width - @playtime_window.width
  692. @playtime_window.y = Graphics.height - @playtime_window.height - 26
  693. @playtime_window.opacity = 0
  694. @playtime_window.z = 201
  695. end
  696.  
  697. def create_menu_help_window
  698. # // Method to create the help window.
  699. @help_window = Window_Menu_Help.new(2)
  700. @help_window.viewport = @viewport
  701. @help_window.windowskin = Cache.system(XAIL::MENU_DELUX::MENU_SKIN) unless XAIL::MENU_DELUX::MENU_SKIN.nil?
  702. @help_window.index = @command_window.index
  703. @help_window.y = Graphics.height - @help_window.height
  704. @help_window.back_opacity = 255
  705. @help_window.z = 200
  706. end
  707.  
  708. def play_menu_music
  709. # // Method to play menu music.
  710. @last_bgm = RPG::BGM.last
  711. @last_bgs = RPG::BGS.last
  712. bgm = XAIL::MENU_DELUX::MUSIC_BGM
  713. bgs = XAIL::MENU_DELUX::MUSIC_BGS
  714. Sound.play(bgm[0], bgm[1], bgm[2], :bgm)
  715. Sound.play(bgs[0], bgs[1], bgs[2], :bgs)
  716. end
  717.  
  718. alias xail_upd_menu_delux_upd update
  719. def update(*args, &block)
  720. # // Method for updating the scene.
  721. xail_upd_menu_delux_upd(*args, &block)
  722. old_index = @help_window.index
  723. help_update(@command_window.index) if old_index != @command_window.index
  724. end
  725.  
  726. def help_update(index)
  727. # // If index changes update help window text.
  728. list = XAIL::MENU_DELUX::MENU_LIST
  729. icon = list.values[index][2].nil? ? "" : list.values[index][2]
  730. name = list.values[index][0] == "" ? list.keys[index].id2name.capitalize : list.values[index][0]
  731. if icon == "" ; title = name ; else ; title = '\i[' + icon.to_s + ']' + name ; end
  732. desc = '\c[0]' + list.values[index][1]
  733. text = "#{title}\n#{desc}"
  734. enabled = list.values[index][3]
  735. @help_window.index = index
  736. @help_window.set_text(text, enabled)
  737. end
  738.  
  739. def on_personal_ok
  740. # // Method override on personal ok.
  741. scene = "Scene_#{@command_window.current_symbol.to_s.capitalize}".to_class
  742. SceneManager.call(scene)
  743. end
  744.  
  745. def command_custom
  746. # // Method to call a custom command. (Don't remove)
  747. if @command_window.current_ext.is_a?(Integer)
  748. $game_temp.reserve_common_event(@command_window.current_ext)
  749. return command_map
  750. end
  751. SceneManager.call(@command_window.current_ext)
  752. end
  753.  
  754. def command_map
  755. # // command_map (Don't remove)
  756. if $game_system.get_menu.empty?
  757. Sound.play_buzzer
  758. $game_message.texts << XAIL::MENU_DELUX::EMPTY
  759. end
  760. SceneManager.call(Scene_Map)
  761. end
  762.  
  763. def pre_terminate
  764. # // Method to pre terminate scene menu.
  765. # // Play last bgm and bgs if menu music is enabled.
  766. if XAIL::MENU_DELUX::MUSIC
  767. @last_bgm.replay rescue nil
  768. @last_bgs.replay rescue nil
  769. end
  770. end
  771.  
  772. end # END OF FILE
  773.  
  774. #=*==========================================================================*=#
  775. # ** END OF FILE
  776. #=*==========================================================================*=#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement