Advertisement
thiago_d_d

Custom Menu 2

Jan 15th, 2013
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 8.24 KB | None | 0 0
  1. #===============================================================================
  2. #   http://thiagodd.blogspot.com.br
  3. # [TSDA] Custom Menu 2
  4. #    --> Version 1.0
  5. #    by thiago_d_d
  6. #
  7. # -----------------------------------------------------------------------------
  8. # * Features
  9. # -----------------------------------------------------------------------------
  10. #  + Just another menu, with an different layout.
  11. #
  12. # -----------------------------------------------------------------------------
  13. # * Install
  14. # -----------------------------------------------------------------------------
  15. #  Put it in the aditional scripts section.
  16. #  Configure it below
  17. #===============================================================================
  18. #===============================================================================
  19. # TSDA
  20. #===============================================================================
  21. module TSDA
  22.   #Vocabulary
  23.   GAME_TIME_SK = "Tempo"
  24.   GAME_STEPS_SK = "Passos"
  25.   GAME_PLACE_SK = "Local"
  26.   #Icons indexes
  27.   GAME_PLACEICON_SK = 153
  28.   GAME_TIMEICON_SK = 188
  29.   GAME_STEPSICON_SK = 48
  30.   GAME_GOLDICON_SK = 205
  31. end
  32. #===============================================================================
  33. # Game_Map
  34. #===============================================================================
  35. class Game_Map
  36.   alias menu_skull_init initialize
  37.   #---
  38.   #--------------------------------------------------------------------------
  39.   # initialize
  40.   #--------------------------------------------------------------------------
  41.   def initialize
  42.     menu_skull_init
  43.     @map_info = load_data("Data/MapInfos.rvdata")
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # map_name
  47.   #--------------------------------------------------------------------------
  48.   def map_name
  49.     return @map_info[@map_id].name
  50.   end
  51. end
  52. #===============================================================================
  53. # Scene_Menu
  54. #===============================================================================
  55. class Scene_Menu < Scene_Base
  56.   #--------------------------------------------------------------------------
  57.   # start
  58.   #--------------------------------------------------------------------------
  59.   def start
  60.     super
  61.     create_menu_background
  62.     create_command_window
  63.     @gold_window = Window_Gold.new(384, 360)
  64.     @status_window = Window_MenuStatus.new(0, 0)
  65.     @mapname_window = Window_MapName.new(384,0)
  66.     @playtime_window = Window_PlayTimeSteps.new(384,232)
  67.   end
  68.   #--------------------------------------------------------------------------
  69.   # terminate
  70.   #--------------------------------------------------------------------------
  71.   def terminate
  72.     super
  73.     dispose_menu_background
  74.     @command_window.dispose
  75.     @gold_window.dispose
  76.     @status_window.dispose
  77.     @mapname_window.dispose
  78.     @playtime_window.dispose
  79.   end
  80.   #--------------------------------------------------------------------------
  81.   # update
  82.   #--------------------------------------------------------------------------
  83.   def update
  84.     super
  85.     update_menu_background
  86.     @command_window.update
  87.     @gold_window.update
  88.     @status_window.update
  89.     @mapname_window.update
  90.     @playtime_window.update
  91.     if @command_window.active
  92.       update_command_selection
  93.     elsif @status_window.active
  94.       update_actor_selection
  95.     end
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # create_command_window
  99.   #--------------------------------------------------------------------------
  100.   def create_command_window
  101.     s1 = Vocab::item
  102.     s2 = Vocab::skill
  103.     s3 = Vocab::equip
  104.     s4 = Vocab::status
  105.     s5 = Vocab::game_end
  106.     @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5])
  107.     @command_window.x = 384
  108.     @command_window.y = 80
  109.     if @menu_index == 4
  110.       @command_window.index = 0
  111.     elsif @menu_index == 5
  112.       @command_window.index = 4
  113.     else
  114.       @command_window.index = @menu_index
  115.     end
  116.     if $game_party.members.size == 0
  117.       @command_window.draw_item(0, false)
  118.       @command_window.draw_item(1, false)
  119.       @command_window.draw_item(2, false)
  120.       @command_window.draw_item(3, false)
  121.     end
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # update_command_selection
  125.   #--------------------------------------------------------------------------
  126.   def update_command_selection
  127.     if Input.trigger?(Input::B)
  128.       Sound.play_cancel
  129.       $scene = Scene_Map.new
  130.     elsif Input.trigger?(Input::C)
  131.       if $game_party.members.size == 0 and @command_window.index < 4
  132.         Sound.play_buzzer
  133.         return
  134.       elsif $game_system.save_disabled and @command_window.index == 4
  135.         Sound.play_buzzer
  136.         return
  137.       end
  138.       Sound.play_decision
  139.       case @command_window.index
  140.       when 0
  141.         $scene = Scene_Item.new
  142.       when 1,2,3
  143.         start_actor_selection
  144.       when 4
  145.         $scene = Scene_End.new
  146.       end
  147.     end
  148.   end
  149. end
  150. #===============================================================================
  151. # Window_PlayTime
  152. #===============================================================================
  153. class Window_PlayTimeSteps < Window_Base
  154.   include TSDA
  155.   #--------------------------------------------------------------------------
  156.   # initialize
  157.   #--------------------------------------------------------------------------
  158.   def initialize(x,y)
  159.     super(x,y, 160,WLH * 4 + 32)
  160.     refresh
  161.   end
  162.   #--------------------------------------------------------------------------
  163.   # update
  164.   #--------------------------------------------------------------------------
  165.   def update
  166.     super
  167.     if Graphics.frame_count / Graphics.frame_rate != @total_sec
  168.       refresh
  169.     end
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # refresh
  173.   #--------------------------------------------------------------------------
  174.   def refresh(total_sec = nil)
  175.     self.contents.clear
  176.     self.contents.font.color = system_color
  177.     draw_icon(GAME_TIMEICON_SK, 0, 0, true)
  178.     self.contents.draw_text(26, 0, 94, WLH, GAME_TIME_SK)
  179.     @total_sec = Graphics.frame_count / Graphics.frame_rate
  180.     hour = @total_sec / 60 / 60
  181.     min = @total_sec / 60 % 60
  182.     sec = @total_sec % 60
  183.     text = sprintf("%02d:%02d:%02d", hour, min, sec)
  184.     self.contents.font.color = normal_color
  185.     self.contents.draw_text(4, WLH, 120, WLH, text, 2)
  186.     self.contents.font.color = system_color
  187.     draw_icon(GAME_STEPSICON_SK, 0, WLH * 2, true)
  188.     self.contents.draw_text(26, WLH * 2, 94, WLH, GAME_STEPS_SK)
  189.     self.contents.font.color = normal_color
  190.     self.contents.draw_text(0, WLH * 3, 120, WLH, $game_party.steps, 2)
  191.   end
  192. end
  193. #===============================================================================
  194. # Window_MapName
  195. #===============================================================================
  196. class Window_MapName < Window_Base
  197.   include TSDA
  198.   #--------------------------------------------------------------------------
  199.   # initialize
  200.   #--------------------------------------------------------------------------
  201.   def initialize(x,y)
  202.     super(x,y, 160,WLH * 2 + 32)
  203.     refresh
  204.   end
  205.   #--------------------------------------------------------------------------
  206.   # refresh
  207.   #--------------------------------------------------------------------------
  208.   def refresh
  209.     self.contents.clear
  210.     self.contents.font.color = system_color
  211.     draw_icon(GAME_PLACEICON_SK, 0, 0, true)
  212.     self.contents.draw_text(26, 0, 94, WLH, GAME_PLACE_SK)
  213.     self.contents.font.color = normal_color
  214.     self.contents.draw_text(0, WLH, 120, WLH, $game_map.map_name, 1)
  215.   end
  216. end
  217. #===============================================================================
  218. # Window_Base
  219. #===============================================================================
  220. class Window_Base
  221.   include TSDA
  222.   def draw_currency_value(value, x, y, width)
  223.     draw_icon(GAME_GOLDICON_SK, x, y, true)
  224.     cx = contents.text_size(Vocab::gold).width
  225.     self.contents.font.color = normal_color
  226.     self.contents.draw_text(x, y, width-cx-2, WLH, value, 2)
  227.     self.contents.font.color = system_color
  228.     self.contents.draw_text(x, y, width, WLH, Vocab::gold, 2)
  229.   end
  230. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement