Advertisement
vindaca510

V's Variable Gauge Window v3.3

Mar 30th, 2013
2,820
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 43.96 KB | None | 0 0
  1. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  2. #                                                                              #
  3. #                          V's  Variable Gauge Window                          #
  4. #                                 Version  3.3                                 #
  5. #                                                                              #
  6. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  7. #                                Written By:  V                                #
  8. #                         Last Edited: January 29, 2014                        #
  9. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  10. #                                                                              #
  11. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  12. #==============================================================================#
  13. #------------------------------------------------------------------------------#
  14. # ** Disclaimer                                                                #
  15. #------------------------------------------------------------------------------#
  16. #                                                                              #
  17. # This script was intended for Non-Commercial use only, if you wish to use     #
  18. # this script in a commercial game please PM me at which ever site you found   #
  19. # this script. Either way please give me credit in your game script as the     #
  20. # writer of this script, and send me a PM abuot the release of the game/demo.  #
  21. #                                                                              #
  22. #------------------------------------------------------------------------------#
  23. # ** How To Use                                                                #
  24. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  25. #                                                                              #
  26. #  * Use anyone of these commands in a script call.                            #
  27. #  * Remember to use "" before and after your name's, and bg's.                #
  28. #  * The colors are the same as the text color number. 0..31                   #
  29. #                                                                              #
  30. #------------------------------------------------------------------------------#
  31. #                                                                              #
  32. # To access this window use SceneManager.call(Scene_VGW)                       #
  33. #                                                                              #
  34. # To add a new variable use                                                    #
  35. #      add_var( page_index, name, icon, var_id, max_value, color1, color2 )    #
  36. #                                                                              #
  37. # To remove a variable use                                                     #
  38. #      remove_var(variable_id)                                                 #
  39. #                                                                              #
  40. # To change the color of a gauge use                                           #
  41. #      change_var_color( variable_id, color1, color2 )                         #
  42. #                                                                              #
  43. #------------------------------------------------------------------------------#
  44. # ** Description                                                               #
  45. #------------------------------------------------------------------------------#
  46. #                                                                              #
  47. #  v0.1                                                                        #
  48. # ~=~=~=~                                                                      #
  49. #                                                                              #
  50. # In v0.1, this script basically just creates a status window that displays    #
  51. # variables set to a gauge, there are options to set a name, icon, and         #
  52. # abbereviations for each variable. There is also an option to set a           #
  53. # game_variable, max lv and an option to change the background.                #
  54. #                                                                              #
  55. #                                                                              #
  56. #  v0.2                                                                        #
  57. # ~=~=~=~                                                                      #
  58. #                                                                              #
  59. # In v0.2, I've changed the set-up to a variableid array to handle the         #
  60. # variables to make it more user friendly and visually appealing.              #
  61. #                                                                              #
  62. #                                                                              #
  63. #  v0.3                                                                        #
  64. # ~=~=~=~                                                                      #
  65. #                                                                              #
  66. # In v0.3, I've added a option to add the menu command.                        #
  67. #                                                                              #
  68. #                                                                              #
  69. #  v0.4                                                                        #
  70. # ~=~=~=~                                                                      #
  71. #                                                                              #
  72. # In v0.4, I've added a option to use the icons and abbrvs. If you choose not  #
  73. # to use them the screen will almost center its self accrodingly. I have also  #
  74. # add an option to use the numbers along with the gauges. I have also added a  #
  75. # spot in variable_id array to control an independent max_lv for each variable.#
  76. #                                                                              #
  77. #                                                                              #
  78. #  v1.0                                                                        #
  79. # ~=~=~=~                                                                      #
  80. #                                                                              #
  81. # In v1.0, I've basically re-written the script to handle up to 11 variables,  #
  82. # you can use more then 11 but they are not able to be displayed for now. I've #
  83. # also added options to display a percentage instead of "amount/max_amount"    #
  84. # above the gauges and an option to change the gauge color. The colors are     #
  85. # listed in the variableid description in the editable area of the script.     #
  86. #                                                                              #
  87. #                                                                              #
  88. #  v1.1                                                                        #
  89. # ~=~=~=~                                                                      #
  90. #                                                                              #
  91. # In v1.1, I have fixed the scrolling issues the window will now scroll        #
  92. # through as many variables as you want.                                       #
  93. #                                                                              #
  94. #                                                                              #
  95. #  v1.2                                                                        #
  96. # ~=~=~=~                                                                      #
  97. #                                                                              #
  98. # In v1.2, I have added a script call to add variables to the window.          #
  99. #                                                                              #
  100. #                                                                              #
  101. #  v1.3                                                                        #
  102. # ~=~=~=~                                                                      #
  103. #                                                                              #
  104. # In v1.3, I have added a script call to remove variables from the window.     #
  105. #                                                                              #
  106. #  v1.4                                                                        #
  107. # ~=~=~=~                                                                      #
  108. #                                                                              #
  109. # In v1.4, I fixed the saving issue now everything should save fine.           #
  110. #                                                                              #
  111. #  v2.0                                                                        #
  112. # ~=~=~=~                                                                      #
  113. #                                                                              #
  114. # In v2.0, I Re-wrote the entire script and added a page feature, and made it  #
  115. # a little more user friendly.                                                 #
  116. #                                                                              #  #                                                                              #
  117. #  v2.1                                                                        #
  118. # ~=~=~=~                                                                      #
  119. #                                                                              #
  120. # In v2.1, I fixed the issues with the page scrolling.                         #
  121. #                                                                              #  #                                                                              #
  122. #  v2.2                                                                        #
  123. # ~=~=~=~                                                                      #
  124. #                                                                              #
  125. # In v2.2, I adjusted the page scrolling to fit and not exceed the page        #
  126. # contents.                                                                    #
  127. #                                                                              #  #                                                                              #
  128. #  v2.3                                                                        #
  129. # ~=~=~=~                                                                      #
  130. #                                                                              #
  131. # In v2.3, I fixed a few bugs I found.                                         #
  132. #                                                                              #  #                                                                              #
  133. #  v3.0                                                                        #
  134. # ~=~=~=~                                                                      #
  135. #                                                                              #
  136. # I re-wrote the entire script. It handles pertty much the same way as it did  #
  137. # before the upgrades were mainly for preformance and compadability.           #
  138. #                                                                              #  #                                                                              #
  139. #  v3.1                                                                        #
  140. # ~=~=~=~                                                                      #
  141. #                                                                              #
  142. # I have added a lot more options in the editable region below. This script    #
  143. # can now be used with V's Live H.U.D. Menu System v0.2+ also.                 #
  144. #                                                                              #  #                                                                              #
  145. #  v3.2                                                                        #
  146. # ~=~=~=~                                                                      #
  147. #                                                                              #
  148. # Bug Fixed.                                                                   #
  149. #                                                                              #  #                                                                              #
  150. #  v3.3                                                                        #
  151. # ~=~=~=~                                                                      #
  152. #                                                                              #
  153. # I added a lot more customization to the script.                              #
  154. #                                                                              #  #                                                                              #
  155. #------------------------------------------------------------------------------#
  156. #==============================================================================#
  157. $imported = {} if $imported.nil?
  158. $imported["Vs_VGW"] = true
  159. #==============================================================================
  160. # ** V's Variable Gauge Window Module
  161. #------------------------------------------------------------------------------
  162. #  This module manages customizable features and methods.
  163. #==============================================================================
  164. module VGW
  165. module Specs
  166. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  167. #                                                                              #
  168. #                           Start Customizable Area.                           #
  169. #                                                                              #
  170. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  171. #                                                                              #
  172. #                      ONLY EDIT AFTER THE EQUALS SYMBOL.                      #
  173. #                                                                              #
  174. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  175.    
  176.  
  177.  
  178.  
  179.  
  180.  
  181.   #============================================================================
  182.   # Use Menu Command for Access
  183.   # ~=~=~=~=~=~=~=~=~=~=~=~=~=~
  184.   # If you choose not to use a window command you can still access the window
  185.   # by using SceneManager.call(Scene_VGW)
  186.   #============================================================================
  187.  
  188.   Use_Menu_Command = true
  189.   Command_Name     = "Game Stats"
  190.  
  191.   #============================================================================
  192.   # Name of all Pages and the File Used for Background
  193.   # ~=~=~=~=~=~=~=~=~=~=~=~=~=~
  194.   # The pages will not be available to view until you place contents in them.
  195.   # This is just for the backgounds.
  196.   # As a side note if you are using V's Live H.U.D. Menu System you can just
  197.   # leave the backgorund names as empty quotes. ("")
  198.   #============================================================================
  199.                         #  Page Name, Background Image
  200.   Page_Info             = [   ["Game Stats", "StarlitSky"   ],
  201.                               ["Inventory", "Relic Title BG"],
  202.                           ]
  203.  
  204.   #============================================================================
  205.   # Cosmetic Options
  206.   #============================================================================
  207.  
  208.     #--------------------------------------------------------------------------
  209.     # Window Options
  210.     #--------------------------------------------------------------------------
  211.  
  212.     Affect_Boarders       = true
  213.     Opacity               = 0
  214.  
  215.     #--------------------------------------------------------------------------
  216.     # Title Window Options
  217.     #--------------------------------------------------------------------------
  218.  
  219.     Title_Font_Size       = 32
  220.    
  221.     Title_Window_X        = 0
  222.     Title_Window_Y        = 0
  223.     Title_Window_Width    = Graphics.width
  224.     Title_Window_Height   = 50
  225.  
  226.     #--------------------------------------------------------------------------
  227.     # Content Window Options
  228.     #--------------------------------------------------------------------------
  229.  
  230.     Content_Window_X      = 0
  231.     Content_Window_Y      = Title_Window_Height
  232.     Content_Window_Width  = Graphics.width
  233.     Content_Window_Height = Graphics.height - Title_Window_Height
  234.  
  235.     #--------------------------------------------------------------------------
  236.     # Item Display Options
  237.     #--------------------------------------------------------------------------
  238.  
  239.     Display_Icons         = true
  240.     Display_Numbers       = true
  241.     Show_Percentage       = true
  242.  
  243.     #--------------------------------------------------------------------------
  244.     # Extended Item Options
  245.     #--------------------------------------------------------------------------
  246.  
  247.     Icon_X                = 25
  248.     Icon_Y                = 0
  249.  
  250.     Gauge_Width           = Content_Window_Width / 7 * 5
  251.     Gauge_X               = Content_Window_Width / 7
  252.     Gauge_Y               = 0                    
  253.  
  254.     Name_Size             = 16
  255.     Name_Alignment        = 2
  256.     Name_X                = -75
  257.     Name_Y                = 0
  258.      
  259.     Number_Size           = 16
  260.     Number_Alignment      = 0
  261.     Number_X              = 115
  262.     Number_Y              = 0
  263.      
  264.  
  265.      
  266. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  267. #                                                                              #
  268. #                            End Customizable Area.                            #
  269. #                                                                              #
  270. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  271. #                                                                              #
  272. #         DO NOT EDIT PAST THIS POINT UNLESS YOU KNOW WHAT YOUR DOING.         #
  273. #                                                                              #
  274. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  275.    
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292. end
  293. end #<--- End Module===========================================================
  294. #==============================================================================
  295. # ** Game_System
  296. #------------------------------------------------------------------------------
  297. #  This class handles system data. It saves the disable state of saving and
  298. # menus. Instances of this class are referenced by $game_system.
  299. #==============================================================================
  300.  
  301. class Game_System
  302.  
  303.   #--------------------------------------------------------------------------
  304.   # * Include Module
  305.   #--------------------------------------------------------------------------
  306.   include VGW::Specs
  307.  
  308.   #--------------------------------------------------------------------------
  309.   # * Public Instance Variables
  310.   #--------------------------------------------------------------------------
  311.   attr_accessor :use_menu_command            # Use Menu Command
  312.   attr_accessor :vgw_info                # VGW Variable Info
  313.  
  314.   #--------------------------------------------------------------------------
  315.   # * Aliasing Method: Object Initialization
  316.   #--------------------------------------------------------------------------
  317.   alias :gsi450412042040005 :initialize
  318.  
  319.   #--------------------------------------------------------------------------
  320.   # * Object Initialization
  321.   #--------------------------------------------------------------------------
  322.   def initialize
  323.     @use_menu_command = Use_Menu_Command
  324.     @vgw_info = {}
  325.     gsi450412042040005()
  326.   end
  327.  
  328. end #<--- End Class============================================================
  329.  
  330.  
  331. #==============================================================================
  332. # ** Game_Interpreter
  333. #------------------------------------------------------------------------------
  334. #  An interpreter for executing event commands. This class is used within the
  335. # Game_Map, Game_Troop, and Game_Event classes.
  336. #==============================================================================
  337.  
  338. class Game_Interpreter
  339.  
  340.   #--------------------------------------------------------------------------
  341.   # * Add Variable
  342.   #--------------------------------------------------------------------------
  343.    
  344.   def add_var( page_index, name, icon, var_id, max_value, color1, color2)
  345.     $game_system.vgw_info[page_index] = {} if $game_system.vgw_info.has_key?(page_index) != true
  346.     $game_system.vgw_info[page_index][name] = { :var_id      => var_id,        
  347.                                                 :icon        => icon,
  348.                                                 :max_value   => max_value,
  349.                                                 :color1      => color1,
  350.                                                 :color2      => color2,
  351.                                               } unless $game_system.vgw_info[page_index].has_key?(var_id)
  352.   end
  353.  
  354.   #--------------------------------------------------------------------------
  355.   # * Remove Variable
  356.   #--------------------------------------------------------------------------
  357.    
  358.   def remove_var( var_id )
  359.     $game_system.vgw_info.each_key { |p|
  360.       $game_system.vgw_info[p].each_key { |v|
  361.         if $game_system.vgw_info[p][v][:var_id] == var_id
  362.           $game_system.vgw_info[p].delete(v)
  363.         end
  364.       }
  365.     }
  366.   end
  367.  
  368.   #--------------------------------------------------------------------------
  369.   # * Change Menu Availability
  370.   #--------------------------------------------------------------------------
  371.    
  372.   def use_menu( useable )
  373.     $game_system.use_menu_command = useable
  374.   end
  375.  
  376. end #<--- End Class============================================================
  377.  
  378.  
  379. #==============================================================================
  380. # ** Window VGW Page Title
  381. #------------------------------------------------------------------------------
  382. #  This Class Handles the Page Titles Window.
  383. #==============================================================================
  384.  
  385. class Window_VGW_Title < Window_Base
  386.  
  387.   #--------------------------------------------------------------------------
  388.   # * Include Module
  389.   #--------------------------------------------------------------------------
  390.   include VGW::Specs
  391.  
  392.   #--------------------------------------------------------------------------
  393.   # * Public Instance Variables
  394.   #--------------------------------------------------------------------------
  395.   attr_accessor :current_vgw            # Current VGW
  396.  
  397.   #--------------------------------------------------------------------------
  398.   # * Object Initialization
  399.   #--------------------------------------------------------------------------
  400.   def initialize
  401.     super(Title_Window_X, Title_Window_Y, Title_Window_Width, Title_Window_Height)
  402.     @current_vgw = 0
  403.     refresh
  404.   end
  405.    
  406.   #--------------------------------------------------------------------------
  407.   # * Refresh Processing
  408.   #--------------------------------------------------------------------------
  409.   def refresh
  410.     contents.clear
  411.     draw_vgw_page_name
  412.   end
  413.    
  414.   #--------------------------------------------------------------------------
  415.   # * Draw VGW Page Name
  416.   #--------------------------------------------------------------------------
  417.   def draw_vgw_page_name
  418.     page_name = Page_Info[@current_vgw][0]
  419.     draw_title_text(-10, - 10, Title_Window_Width, Title_Window_Height, page_name, 1)
  420.   end
  421.    
  422.   #--------------------------------------------------------------------------
  423.   # * Draw Title Text
  424.   #--------------------------------------------------------------------------
  425.   def draw_title_text(x, y, w, h, text, alignment)
  426.     reset_font_settings
  427.     contents.font.size = Title_Font_Size
  428.     contents.draw_text(x, y, w, h, text, alignment)
  429.     reset_font_settings
  430.   end
  431.  
  432. end #<--- End Class============================================================
  433.  
  434.  
  435. #==============================================================================
  436. # ** Window VGW Page Contents
  437. #------------------------------------------------------------------------------
  438. #  This Class Handles the Page Contents Window.
  439. #==============================================================================
  440.  
  441. class Window_VGW_Contents < Window_Command
  442.  
  443.   #--------------------------------------------------------------------------
  444.   # * Include Module
  445.   #--------------------------------------------------------------------------
  446.   include VGW::Specs
  447.  
  448.   #--------------------------------------------------------------------------
  449.   # * Public Instance Variables
  450.   #--------------------------------------------------------------------------
  451.   attr_accessor :current_vgw            # Current VGW
  452.  
  453.   #--------------------------------------------------------------------------
  454.   # * Object Initialization
  455.   #--------------------------------------------------------------------------
  456.   def initialize
  457.     @current_vgw = 0
  458.     super(Content_Window_X, Content_Window_Y)
  459.   end
  460.    
  461.   #--------------------------------------------------------------------------
  462.   # * Get Window Height
  463.   #--------------------------------------------------------------------------
  464.   def window_height
  465.     Content_Window_Height
  466.   end
  467.  
  468.   #--------------------------------------------------------------------------
  469.   # * Get Window Width
  470.   #--------------------------------------------------------------------------
  471.   def window_width
  472.     Content_Window_Width
  473.   end
  474.  
  475.   #--------------------------------------------------------------------------
  476.   # * Make Command List
  477.   #--------------------------------------------------------------------------
  478.   def make_command_list
  479.     if $game_system.vgw_info.size > 0
  480.       $game_system.vgw_info[@current_vgw].each_key { |i|
  481.         add_command(i, :vgw_info)
  482.       }
  483.     end
  484.   end
  485.  
  486.   #--------------------------------------------------------------------------
  487.   # * Item Height
  488.   #--------------------------------------------------------------------------
  489.   def item_height
  490.     return (Graphics.height / 5) / 2
  491.   end
  492.  
  493.   #--------------------------------------------------------------------------
  494.   # * Draw Var Name Text
  495.   #--------------------------------------------------------------------------
  496.   def draw_var_name_text(x, y, w, h, text)
  497.     reset_font_settings
  498.     contents.font.size = Name_Size
  499.     contents.draw_text(x + Name_X, y + Name_Y, w, h, text, Name_Alignment)
  500.     reset_font_settings
  501.   end
  502.  
  503.   #--------------------------------------------------------------------------
  504.   # * Draw Var Number Text
  505.   #--------------------------------------------------------------------------
  506.   def draw_var_number_text(x, y, w, h, text)
  507.     reset_font_settings
  508.     contents.font.size = Number_Size
  509.     contents.draw_text(x + Number_X, y + Number_Y, w, h, text, Number_Alignment)
  510.     reset_font_settings
  511.   end
  512.  
  513.   #--------------------------------------------------------------------------
  514.   # * Draw Item
  515.   #--------------------------------------------------------------------------
  516.   def draw_item(index)
  517.     c = 0
  518.     $game_system.vgw_info[@current_vgw].each_key { |i|
  519.       y = (item_height * c)
  520.       current_info = $game_system.vgw_info[@current_vgw][i]
  521.       var = $game_variables[current_info[:var_id]]
  522.       max = current_info[:max_value]
  523.       rate = var.to_f / max
  524.       color1 = current_info[:color1]
  525.       color2 = current_info[:color2]
  526.       draw_var_name_text(-10, y, Content_Window_Width, 24, i)
  527.       if Display_Numbers
  528.         if Show_Percentage
  529.           draw_var_number_text(-35, y, Content_Window_Width, 24, (rate * 100).to_i.to_s + "%")
  530.         else
  531.           draw_var_number_text(-35, y, Content_Window_Width, 24, var.to_s + " / " + max.to_s)
  532.         end
  533.       end
  534.       draw_icon(current_info[:icon], 10 + Icon_X, y + 10 + Icon_Y, Display_Icons)
  535.       draw_gauge(Gauge_X, y + 5 + Gauge_Y, Gauge_Width, rate, text_color(color1), text_color(color2))
  536.       c += 1
  537.     }
  538.   end
  539.  
  540. end #<--- End Class============================================================
  541.  
  542. unless $imported["Vs_Live_HUD_Menu"] == true
  543. #==============================================================================
  544. # ** Scene Variable Gauge Window
  545. #------------------------------------------------------------------------------
  546. #  This Class Handles the Variable Gauge Window Scene.
  547. #==============================================================================
  548.  
  549. class Scene_VGW < Scene_Base
  550.  
  551.   #--------------------------------------------------------------------------
  552.   # * Include Module
  553.   #--------------------------------------------------------------------------
  554.   include VGW::Specs
  555.  
  556.   #--------------------------------------------------------------------------
  557.   # * Object Initialization
  558.   #--------------------------------------------------------------------------
  559.   def initialize
  560.     super
  561.     @current_vgw = 0
  562.     create_all_windows
  563.   end
  564.    
  565.   #--------------------------------------------------------------------------
  566.   # * Create All Windows
  567.   #--------------------------------------------------------------------------
  568.   def create_all_windows
  569.     create_background
  570.     create_vgw_windows
  571.   end
  572.  
  573.   #--------------------------------------------------------------------------
  574.   # * Create VGW Title Window
  575.   #--------------------------------------------------------------------------
  576.   def create_vgw_windows
  577.     @page_title_window = Window_VGW_Title.new
  578.     @page_title_window.opacity = Opacity if Affect_Boarders
  579.     @page_title_window.back_opacity = Opacity unless Affect_Boarders
  580.     @page_contents_window = Window_VGW_Contents.new
  581.     @page_contents_window.opacity = Opacity if Affect_Boarders
  582.     @page_contents_window.back_opacity = Opacity unless Affect_Boarders
  583.   end  
  584.      
  585.   #--------------------------------------------------------------------------
  586.   # * Create Background
  587.   #--------------------------------------------------------------------------
  588.   def create_background
  589.     @background = Sprite.new
  590.     @background.bitmap = Cache.picture(Page_Info[@current_vgw][1])
  591.     @background.x = 0
  592.     @background.y = 0
  593.     @background.zoom_x = (@background.width / Graphics.width)
  594.     @background.zoom_y = (@background.height / Graphics.height)
  595.   end  
  596.      
  597.   #--------------------------------------------------------------------------
  598.   # * Dispose Background
  599.   #--------------------------------------------------------------------------
  600.   def dispose_background
  601.     @background.bitmap.dispose
  602.     @background.dispose
  603.   end  
  604.      
  605.   #--------------------------------------------------------------------------
  606.   # * Refresh Background
  607.   #--------------------------------------------------------------------------
  608.   def refresh_background
  609.     dispose_background
  610.     create_background
  611.   end  
  612.      
  613.   #--------------------------------------------------------------------------
  614.   # * Refresh VGW
  615.   #--------------------------------------------------------------------------
  616.   def refresh_vgw
  617.     refresh_background
  618.     @page_contents_window.select(0)
  619.     @page_contents_window.current_vgw = @current_vgw
  620.     @page_title_window.current_vgw = @current_vgw
  621.     @page_contents_window.refresh
  622.     @page_title_window.refresh
  623.   end  
  624.      
  625.   #--------------------------------------------------------------------------
  626.   # * Next VGW
  627.   #--------------------------------------------------------------------------
  628.   def next_vgw
  629.     Sound.play_cursor
  630.     (@current_vgw + 1) > last_vgw ? @current_vgw = 0 : @current_vgw += 1
  631.     refresh_vgw
  632.   end  
  633.      
  634.   #--------------------------------------------------------------------------
  635.   # * Previous VGW
  636.   #--------------------------------------------------------------------------
  637.   def previous_vgw
  638.     Sound.play_cursor
  639.     (@current_vgw - 1) < 0 ? @current_vgw = last_vgw : @current_vgw -= 1
  640.     refresh_vgw
  641.   end  
  642.      
  643.   #--------------------------------------------------------------------------
  644.   # * Returns Last VGW With Content
  645.   #--------------------------------------------------------------------------
  646.   def last_vgw
  647.     page = 0
  648.     last_page_with_content = 0
  649.     if $game_system.vgw_info.size > 1
  650.       $game_system.vgw_info.each_key { |i|
  651.         if $game_system.vgw_info[i].size > 0
  652.           last_page_with_content = page
  653.         end
  654.         page += 1
  655.       }
  656.     end
  657.     return last_page_with_content
  658.   end  
  659.      
  660.   #--------------------------------------------------------------------------
  661.   # * Update Processing
  662.   #--------------------------------------------------------------------------
  663.   def update
  664.     super
  665.     return_scene if Input.trigger?(:B)
  666.     next_vgw if Input.trigger?(:R)
  667.     previous_vgw if Input.trigger?(:L)
  668.   end  
  669.    
  670. end #<--- End Class============================================================
  671.  
  672.  
  673. #==============================================================================
  674. # ** Window_MenuCommand
  675. #------------------------------------------------------------------------------
  676. #  This command window appears on the menu screen.
  677. #==============================================================================
  678.  
  679. class Window_MenuCommand < Window_Command
  680.  
  681.   #--------------------------------------------------------------------------
  682.   # * Include Module
  683.   #--------------------------------------------------------------------------
  684.   include VGW::Specs
  685.  
  686.   #--------------------------------------------------------------------------
  687.   # * Aliasing Method: Create Command Window
  688.   #--------------------------------------------------------------------------
  689.   alias :wmcaoc75750005 :add_original_commands
  690.  
  691.   #--------------------------------------------------------------------------
  692.   # * For Adding Original Commands
  693.   #--------------------------------------------------------------------------
  694.   def add_original_commands
  695.     wmcaoc75750005()
  696.     add_command(Command_Name, :vgw, $game_system.use_menu_command)
  697.   end
  698.  
  699. end #<--- End Class============================================================
  700.  
  701.  
  702. #==============================================================================
  703. # ** Scene_Menu
  704. #------------------------------------------------------------------------------
  705. #  This class performs the menu screen processing.
  706. #==============================================================================
  707.  
  708. class Scene_Menu < Scene_MenuBase
  709.  
  710.   #--------------------------------------------------------------------------
  711.   # * Include Module
  712.   #--------------------------------------------------------------------------
  713.   include VGW::Specs
  714.  
  715.   #--------------------------------------------------------------------------
  716.   # * Aliasing Method: Create Command Window
  717.   #--------------------------------------------------------------------------
  718.   alias :smccw45240420475750005 :create_command_window
  719.  
  720.   #--------------------------------------------------------------------------
  721.   # * Create Command Window
  722.   #--------------------------------------------------------------------------
  723.   def create_command_window
  724.     smccw45240420475750005()
  725.     @command_window.set_handler(:vgw,    method(:command_vgw))
  726.   end
  727.  
  728.   #--------------------------------------------------------------------------
  729.   # * Create Command(command_vgw)
  730.   #--------------------------------------------------------------------------
  731.   def command_vgw
  732.     SceneManager.call(Scene_VGW)
  733.   end
  734.  
  735. end #<--- End Class============================================================
  736.  
  737.  
  738. else
  739.  
  740.  
  741. #==============================================================================
  742. # ** Window_Hud
  743. #------------------------------------------------------------------------------
  744. #  This is a super class of all windows within the game.
  745. #==============================================================================
  746.  
  747. class Window_Hud < Window_Command
  748.  
  749.   #--------------------------------------------------------------------------
  750.   # * Include Module
  751.   #--------------------------------------------------------------------------
  752.   include VGW::Specs
  753.  
  754.   #--------------------------------------------------------------------------
  755.   # * Aliasing Method: Add Original Commands
  756.   #--------------------------------------------------------------------------
  757.   alias :whaocl44878673424879 :add_original_command
  758.  
  759.   #--------------------------------------------------------------------------
  760.   # * Add Original Commands
  761.   #--------------------------------------------------------------------------
  762.   def add_original_command
  763.     whaocl44878673424879()
  764.     add_command(Command_Name, :vgw)
  765.   end
  766.  
  767.   #--------------------------------------------------------------------------
  768.   # * Draw Item
  769.   #--------------------------------------------------------------------------
  770.   def draw_item(index)
  771.     y = 60
  772.     height = 35
  773.     @command_icons.size.times { |i|
  774.       draw_icon(@command_icons[i], 5, y + (height * i))
  775.     }
  776.     draw_original_icons(y + (height * @command_icons.size))
  777.     draw_icon(@option_icon, 5, y + (height * 5))
  778.   end
  779.  
  780.   #--------------------------------------------------------------------------
  781.   # * Aliasing Method: Draw Original Icons
  782.   #--------------------------------------------------------------------------
  783.   alias :whdoi452242557 :draw_original_icons
  784.  
  785.   #--------------------------------------------------------------------------
  786.   # * Draw Original Icons
  787.   #--------------------------------------------------------------------------
  788.   def draw_original_icons(y)
  789.     whdoi452242557(y)
  790.     draw_icon(229, 5, y)
  791.   end
  792.  
  793. end #<--- End Class============================================================
  794.  
  795.  
  796. #==============================================================================
  797. # ** Scene_Map
  798. #------------------------------------------------------------------------------
  799. #  This class performs the map screen processing.
  800. #==============================================================================
  801.  
  802. class Scene_Map < Scene_Base
  803.  
  804.   #--------------------------------------------------------------------------
  805.   # * Include Module
  806.   #--------------------------------------------------------------------------
  807.   include VGW::Specs
  808.  
  809.   #--------------------------------------------------------------------------
  810.   # * Aliasing Method: Create All Windows
  811.   #--------------------------------------------------------------------------
  812.   alias :smcaw787866331000 :create_all_windows
  813.  
  814.   #--------------------------------------------------------------------------
  815.   # * Create All Windows
  816.   #--------------------------------------------------------------------------
  817.   def create_all_windows
  818.     smcaw787866331000()
  819.     create_vgw_windows
  820.   end
  821.  
  822.   #--------------------------------------------------------------------------
  823.   # * Create VGW Title Window
  824.   #--------------------------------------------------------------------------
  825.   def create_vgw_windows
  826.     @current_vgw = 0
  827.     @vgw_page_title_window = Window_VGW_Title.new
  828.     @vgw_page_title_window.close
  829.     @vgw_page_title_window.opacity = Opacity if Affect_Boarders
  830.     @vgw_page_title_window.back_opacity = Opacity unless Affect_Boarders
  831.     @vgw_page_contents_window = Window_VGW_Contents.new
  832.     @vgw_page_contents_window.close
  833.     @vgw_page_contents_window.opacity = Opacity if Affect_Boarders
  834.     @vgw_page_contents_window.back_opacity = Opacity unless Affect_Boarders
  835.     @vgw_page_contents_window.deactivate
  836.   end  
  837.      
  838.   #--------------------------------------------------------------------------
  839.   # * Aliasing Method: Create All Windows
  840.   #--------------------------------------------------------------------------
  841.   alias :smch45404000455339 :create_hud_window
  842.  
  843.   #--------------------------------------------------------------------------
  844.   # * Create Hud Window
  845.   #--------------------------------------------------------------------------
  846.   def create_hud_window
  847.     smch45404000455339()
  848.     @hud_window.set_handler(:vgw, method(:command_vgw_select))
  849.   end
  850.  
  851.   #--------------------------------------------------------------------------
  852.   # * [To Title] Command
  853.   #--------------------------------------------------------------------------
  854.   def command_options_cancel
  855.     @menu_index -= 7
  856.     @options_window.close
  857.     Sound.play_cancel
  858.     @hud_window.select(5)
  859.     @hud_window.activate
  860.     @hud_window.change_text_cursor(5)
  861.   end
  862.  
  863.   #--------------------------------------------------------------------------
  864.   # * Empty Method: Command Menu Select
  865.   #--------------------------------------------------------------------------
  866.   def command_vgw_select
  867.     @menu_index = 7
  868.     @vgw_page_title_window.refresh
  869.     @vgw_page_title_window.open
  870.     @vgw_page_contents_window.refresh
  871.     @vgw_page_contents_window.select(0)
  872.     @vgw_page_contents_window.activate
  873.     @vgw_page_contents_window.open
  874.     @hud_window.deactivate
  875.   end
  876.  
  877.   #--------------------------------------------------------------------------
  878.   # * Refresh VGW
  879.   #--------------------------------------------------------------------------
  880.   def refresh_vgw
  881.     @vgw_page_contents_window.select(0)
  882.     @vgw_page_contents_window.current_vgw = @current_vgw
  883.     @vgw_page_title_window.current_vgw = @current_vgw
  884.     @vgw_page_contents_window.refresh
  885.     @vgw_page_title_window.refresh
  886.   end  
  887.      
  888.   #--------------------------------------------------------------------------
  889.   # * Next VGW
  890.   #--------------------------------------------------------------------------
  891.   def next_vgw
  892.     Sound.play_cursor
  893.     (@current_vgw + 1) > last_vgw ? @current_vgw = 0 : @current_vgw += 1
  894.     refresh_vgw
  895.   end  
  896.      
  897.   #--------------------------------------------------------------------------
  898.   # * Previous VGW
  899.   #--------------------------------------------------------------------------
  900.   def previous_vgw
  901.     Sound.play_cursor
  902.     (@current_vgw - 1) < 0 ? @current_vgw = last_vgw : @current_vgw -= 1
  903.     refresh_vgw
  904.   end  
  905.      
  906.   #--------------------------------------------------------------------------
  907.   # * Returns Last VGW With Content
  908.   #--------------------------------------------------------------------------
  909.   def last_vgw
  910.     page = 0
  911.     last_page_with_content = 0
  912.     if $game_system.vgw_info.size > 1
  913.       $game_system.vgw_info.each_key { |i|
  914.         if $game_system.vgw_info[i].size > 0
  915.           last_page_with_content = page
  916.         end
  917.         page += 1
  918.       }
  919.     end
  920.     return last_page_with_content
  921.   end  
  922.      
  923.   #--------------------------------------------------------------------------
  924.   # * Aliasing Method: Frame Update
  925.   #--------------------------------------------------------------------------
  926.   alias :smu777788899333000 :update
  927.  
  928.   #--------------------------------------------------------------------------
  929.   # * Frame Update
  930.   #--------------------------------------------------------------------------
  931.   def update
  932.     smu777788899333000()
  933.     case @menu_index
  934.     when 7
  935.       case
  936.       when Input.trigger?(:UP)
  937.         @vgw_page_contents_window.refresh
  938.       when Input.trigger?(:DOWN)
  939.         @vgw_page_contents_window.refresh
  940.       when Input.trigger?(:LEFT)
  941.         previous_vgw
  942.       when Input.trigger?(:RIGHT)
  943.         next_vgw
  944.       when Input.trigger?(:L)
  945.         previous_vgw
  946.       when Input.trigger?(:R)
  947.         next_vgw
  948.       end
  949.     end
  950.     if Input.trigger?(:B)
  951.       case @menu_index
  952.       when 7
  953.         @menu_index -= 6
  954.         @vgw_page_contents_window.deactivate
  955.         @vgw_page_contents_window.unselect
  956.         @vgw_page_title_window.close
  957.         @vgw_page_contents_window.close
  958.         Sound.play_cancel
  959.         @hud_window.select(4)
  960.         @hud_window.activate
  961.         @hud_window.change_text_cursor(4)
  962.       end
  963.     end
  964.   end
  965.  
  966. end #<--- End Class============================================================
  967.  
  968. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement