Advertisement
Rafael_Sol_Maker

RSM's PRETTY BUTTONS ON TITLE SCREEN ACE v1.0

Jul 11th, 2017
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.95 KB | None | 0 0
  1. #===============================================================================
  2. #              RSM's PRETTY BUTTONS ON TITLE SCREEN ACE v1.0
  3. #           Projeto Baú dos Scripts do RSM - www.condadobraveheart.com
  4. #_______________________________________________________________________________
  5. #    Descrição   | Esse script troca os botões da tela de título por uns um
  6. #                | pouco mais interessante com direito a organização horizontal
  7. #                | e ícones bonitinhos. As consigurações estão no módulo Config.
  8. #________________|______________________________________________________________
  9. #===============================================================================
  10.  
  11. #==============================================================================
  12. # ** Aqui é onde nóis configura os bagulho
  13. #------------------------------------------------------------------------------
  14. module Config
  15.  
  16.   # Ajuste fino da coordenada Y da posição da janela
  17.   Title_Window_Y = -32
  18.  
  19.   # Fundo transparente da janela?
  20.   Title_Window_Vis = false
  21.  
  22.   # Imagem pra pegar os ícones (ficará na pasta 'System')
  23.   Title_Buttons = "Title_Buttons"
  24.  
  25. end
  26.  
  27. #==============================================================================
  28. # ** Window_Base
  29. #------------------------------------------------------------------------------
  30. class Window_Base < Window
  31.  
  32.   # Uma propriedade nova que pode vir a calhar...
  33.   attr_accessor :text_align
  34.   def text_align
  35.     0
  36.   end
  37.  
  38.   #--------------------------------------------------------------------------
  39.   # * Função sobrescrita, porém só com um argumento opcional
  40.   #--------------------------------------------------------------------------
  41.   def process_normal_character(c, pos, a = text_align)
  42.     text_width = text_size(c).width
  43.     draw_text(pos[:x], pos[:y], text_width * 2, pos[:height], c, a)
  44.     pos[:x] += text_width
  45.   end
  46.  
  47.   #--------------------------------------------------------------------------
  48.   # * Função sobrescrita, porém só com um argumento opcional
  49.   #--------------------------------------------------------------------------
  50.   def draw_text_ex(x, y, text, reset = true)
  51.     reset_font_settings if reset
  52.     text = convert_escape_characters(text)
  53.     pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
  54.     process_character(text.slice!(0, 1), text, pos) until text.empty?
  55.   end
  56.  
  57. end
  58.  
  59. #==============================================================================
  60. # ** Window_TitleCommand
  61. #------------------------------------------------------------------------------
  62. class Window_TitleCommand
  63.  
  64.   #--------------------------------------------------------------------------
  65.   # * Nossas opções
  66.   #--------------------------------------------------------------------------
  67.   def text_align
  68.     1 # Centro
  69.   end
  70.  
  71.   def col_max
  72.     return 3
  73.   end
  74.  
  75.   def window_width
  76.     return 128 * 3
  77.   end
  78.  
  79.   def window_height
  80.     return 128
  81.   end
  82.  
  83.   #--------------------------------------------------------------------------
  84.   # * Fazendo ajuste fino
  85.   #--------------------------------------------------------------------------
  86.   alias rsm_diff_title_upd_placemente update_placement
  87.   def update_placement
  88.     rsm_diff_title_upd_placemente
  89.     self.y += Config::Title_Window_Y
  90.   end
  91.  
  92.   #--------------------------------------------------------------------------
  93.   # * (SOBRESCRITO) Dando uam mudada na hora de desenhar as opções da janela
  94.   #--------------------------------------------------------------------------
  95.   def draw_item(index)
  96.     rect = item_rect_for_text(index)
  97.     pos_x = (index * item_width) + (index * spacing) + 24
  98.     draw_title_icon(Config::Title_Buttons, index, pos_x, 16, command_enabled?(index))
  99.     change_color(normal_color, command_enabled?(index))
  100.     draw_text_ex(rect.x, rect. y + rect.height - 32, command_name(index), false)
  101.   end
  102.  
  103.   #--------------------------------------------------------------------------
  104.   # * Tirando o fundo da janela, se assim for desejado...
  105.   #--------------------------------------------------------------------------
  106.   def update
  107.     super
  108.     unless Config::Title_Window_Vis
  109.       self.opacity = 0
  110.       self.back_opacity = 0
  111.     end
  112.   end
  113.  
  114.   #--------------------------------------------------------------------------
  115.   # * (SOBRESCRITO)Largura da linha para ajeitarmos o cursor
  116.   #--------------------------------------------------------------------------
  117.   def item_height
  118.     (height - standard_padding * 2 + spacing) / 1 - spacing
  119.   end
  120.  
  121.   #--------------------------------------------------------------------------
  122.   # * (NOVO) Desenhando as figuras diretamente da imagem
  123.   #--------------------------------------------------------------------------
  124.   def draw_title_icon(file, icon_index, x, y, enabled = true)
  125.     bitmap = Cache.system(file)
  126.     rect = Rect.new(icon_index * 48, 0, 48, 48)
  127.     contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  128.   end
  129.  
  130. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement